/* 전체 페이지 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ForestMermaid 브랜드 헤더 */
.brand-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    padding: 15px 30px;
    z-index: 1002;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: #e2e8f0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

.brand-tagline {
    font-size: 14px;
    color: rgba(148, 163, 184, 0.8);
    font-style: italic;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 모드 전환 버튼 */
.mode-switcher {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 1001;
    background: rgba(30, 30, 50, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.mode-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: rgba(59, 130, 246, 0.8);
    border-color: rgba(59, 130, 246, 0.6);
    color: #ffffff;
}

/* 모드 컨테이너 */
.editor-mode,
.preview-mode {
    width: 100%;
    height: 100vh;
    padding-top: 140px;
    transition: all 0.3s ease;
}

.hidden {
    display: none !important;
}

/* 에디터 컨테이너 스타일 */
.editor-container {
    width: 100%;
    height: calc(100vh - 100px);
    margin: 0 auto;
    background: rgba(30, 30, 50, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.editor-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.editor-header h3 {
    color: #3b82f6;
    font-size: 20px;
    font-weight: 600;
}

.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.guide-btn {
    background: rgba(59, 130, 246, 0.8);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.guide-btn:hover {
    background: rgba(59, 130, 246, 1);
    transform: scale(1.05);
}

.clear-btn {
    background: rgba(244, 67, 54, 0.8);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: rgba(244, 67, 54, 1);
    transform: scale(1.05);
}

#mermaidInput {
    width: 100%;
    flex: 1;
    background: rgba(20, 20, 35, 0.8);
    border: none;
    color: #e0e0e0;
    padding: 20px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    border-radius: 0 0 12px 12px;
}

#mermaidInput::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* 미리보기 컨테이너 스타일 */
.preview-container {
    width: 100%;
    height: calc(100vh - 100px);
    background: rgba(30, 30, 50, 0.8);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(40, 40, 60, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.preview-header h3 {
    color: #3b82f6;
    font-size: 20px;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-btn {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
}

.preview-btn:hover {
    background: linear-gradient(135deg, #45a049, #4caf50);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.download-btn {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: white;
}

.download-btn:hover {
    background: linear-gradient(135deg, #1976d2, #2196f3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.pdf-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.pdf-btn:hover {
    background: linear-gradient(135deg, #d32f2f, #f44336);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

/* 미리보기 영역 스타일 */
.preview-area {
    padding: 30px;
    min-height: 500px;
    background: rgba(20, 20, 35, 0.6);
    position: relative;
}

/* 프리뷰 컨트롤 스타일 */
.preview-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(30, 30, 50, 0.9);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.control-btn {
    background: rgba(64, 181, 246, 0.8);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: rgba(64, 181, 246, 1);
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.reset {
    background: rgba(255, 152, 0, 0.8);
}

.control-btn.reset:hover {
    background: rgba(255, 152, 0, 1);
}

.control-btn.fit {
    background: rgba(76, 175, 80, 0.8);
}

.control-btn.fit:hover {
    background: rgba(76, 175, 80, 1);
}

.zoom-info {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

/* 공유 성공 메시지 스타일 */
.share-success {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

.share-message {
    background: rgba(76, 175, 80, 0.95);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 300px;
}

.share-message span {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.share-message small {
    opacity: 0.8;
    font-size: 12px;
}

.share-message button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 8px;
    font-size: 12px;
}

.share-message button:hover {
    background: rgba(255, 255, 255, 0.3);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.mermaid-preview {
    width: 100%;
    min-height: 400px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: grab;
    overflow: hidden;
    position: relative;
}

.mermaid-preview:active {
    cursor: grabbing;
}

.mermaid-preview.has-content {
    border: none;
    background: transparent;
    padding: 20px;
}

.placeholder {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

.placeholder p {
    font-size: 16px;
    margin-bottom: 10px;
}

/* Mermaid 차트 스타일 커스터마이징 */
.mermaid {
    background: transparent !important;
}

.mermaid svg {
    max-width: 100% !important;
    height: auto !important;
}

/* 다운로드용 컨테이너 스타일 */
.download-mode {
    background: rgba(20, 20, 35, 0.6) !important;
}

.download-mode svg {
    background: transparent !important;
    max-width: none !important;
    height: auto !important;
}

/* 반응형 디자인 */
@media (max-width: 1200px) {
    .floating-input {
        width: 350px;
    }
    
    .preview-container {
        margin-left: 390px;
    }
}

@media (max-width: 768px) {
    .floating-input {
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        margin: 20px;
    }
    
    .preview-container {
        margin-left: 20px;
        margin-right: 20px;
    }
    
    .preview-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: center;
    }
}

/* 로딩 애니메이션 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #64b5f6;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 에러 메시지 스타일 */
.error-message {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 14px;
}

/* 공유 관련 메시지 스타일 */
.share-loading,
.share-success,
.share-error {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
}

.share-message {
    background: rgba(20, 20, 35, 0.95);
    border: 1px solid rgba(100, 181, 246, 0.3);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    color: #ffffff;
    font-size: 14px;
    line-height: 1.5;
}

.share-loading .share-message {
    border-color: rgba(255, 193, 7, 0.3);
}

.share-success .share-message {
    border-color: rgba(76, 175, 80, 0.3);
}

.share-error .share-message {
    border-color: rgba(255, 107, 107, 0.3);
}

.share-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.copy-btn,
.close-btn {
    background: rgba(100, 181, 246, 0.2);
    border: 1px solid rgba(100, 181, 246, 0.4);
    color: #64b5f6;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.copy-btn:hover,
.close-btn:hover {
    background: rgba(100, 181, 246, 0.3);
    border-color: rgba(100, 181, 246, 0.6);
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* 토스트 메시지 스타일 */
.toast-message {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(76, 175, 80, 0.9);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1001;
    animation: slideInUp 0.3s ease-out;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* 애니메이션 */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .brand-header {
        padding: 10px 20px;
        flex-direction: column;
        gap: 8px;
    }
    
    .logo-text {
        font-size: 20px;
    }
    
    .brand-tagline {
        font-size: 12px;
    }
    
    .mode-switcher {
        top: 120px;
        padding: 6px;
    }
    
    .mode-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .editor-mode,
    .preview-mode {
        padding-top: 160px;
    }
    
    .share-loading,
    .share-success,
    .share-error {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .share-actions {
        flex-direction: column;
    }
    
    .toast-message {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
}

/* 가이드 위젯 스타일 */
.guide-widget {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    background: rgba(20, 20, 35, 0.98);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    border: 1px solid rgba(100, 181, 246, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    overflow: hidden;
}

.guide-widget.show {
    display: block;
    animation: slideInUp 0.3s ease-out;
}

.guide-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(59, 130, 246, 0.1);
}

.guide-header h3 {
    color: #3b82f6;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.guide-content {
    padding: 25px;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
}

.guide-section {
    margin-bottom: 30px;
}

.guide-section h4 {
    color: #3b82f6;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.3);
    padding-bottom: 8px;
}

.code-example {
    background: rgba(20, 20, 35, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.code-title {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.code-example pre {
    margin: 0;
    padding: 15px;
    background: rgba(10, 10, 20, 0.8);
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    overflow-x: auto;
}

.code-example code {
    color: #e0e0e0;
}

.guide-tips {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.guide-tips h4 {
    color: #4caf50;
    margin-bottom: 15px;
}

.guide-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.guide-tips li {
    color: #e0e0e0;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
}

/* 가이드 위젯 스크롤바 스타일 */
.guide-content::-webkit-scrollbar {
    width: 8px;
}

.guide-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.guide-content::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.5);
    border-radius: 4px;
}

.guide-content::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.7);
}

/* 가이드 위젯 오버레이 */
.guide-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1999;
    display: none;
}

.guide-overlay.show {
    display: block;
}
