/* PC 화면 최적화 CSS */
* {
    font-family: 'Inter', 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f4f7f9;
    margin: 0;
    padding: 0;
}

/* PC 전용 레이아웃 - 사이드바와 메인 콘텐츠 */
.pc-layout {
    display: flex;
    min-height: 100vh;
}

/* 사이드바 - PC 최적화 */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex-shrink: 0;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-title {
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin: 0;
}

.sidebar-nav {
    padding: 20px 16px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(2px);
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.nav-link svg {
    margin-right: 12px;
}

/* 메인 콘텐츠 영역 - PC 최적화 */
.main-content {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
    background-color: #f8fafc;
}

/* 대시보드 카드 그리드 - PC 전용 */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-left: 4px solid;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-card.blue { border-left-color: #3b82f6; }
.stat-card.green { border-left-color: #10b981; }
.stat-card.yellow { border-left-color: #f59e0b; }

.stat-label {
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

/* 데이터 입력 폼 - PC 최적화 */
.input-form {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    max-width: 1000px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.form-input, .form-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

/* 버튼 스타일 - PC 최적화 */
.btn {
    padding: 14px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.btn-full {
    width: 100%;
}

/* 테이블 스타일 - PC 최적화 */
.data-table {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.table-header {
    background: #f8fafc;
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.table-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: #f9fafb;
    padding: 16px 24px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e7eb;
}

.table td {
    padding: 16px 24px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    color: #374151;
}

.table tbody tr:hover {
    background: #f9fafb;
}

/* 문서 뷰어 - PC 최적화 */
.document-viewer {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    min-height: 80vh;
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
}

.viewer-toolbar {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.document-content {
    padding: 40px;
    line-height: 1.8;
    font-size: 15px;
    color: #374151;
}

/* 문서 페이지 스타일 */
.page {
    min-height: calc(100vh - 200px);
    margin-bottom: 40px;
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
}

.page:last-child {
    margin-bottom: 0;
}

.page h1 {
    color: #1e40af;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 32px;
    border-bottom: 3px solid #3b82f6;
    padding-bottom: 12px;
}

.page h2 {
    color: #1f2937;
    font-size: 24px;
    font-weight: 600;
    margin: 32px 0 16px 0;
}

.page h3 {
    color: #374151;
    font-size: 20px;
    font-weight: 600;
    margin: 24px 0 12px 0;
}

.content-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 24px;
    margin: 16px 0;
    border-radius: 8px;
    line-height: 1.7;
}

.highlight-box {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 20px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
}

/* 커버 페이지 스타일 */
.cover-page {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
}

.cover-title {
    font-size: 52px;
    font-weight: 700;
    margin: 40px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.company-name {
    font-size: 28px;
    color: rgba(255, 255, 255, 0.9);
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    padding: 12px 0;
    margin: 40px 0;
    min-width: 400px;
}

/* 편집 모드 스타일 */
.editable-content {
    border: 2px dashed transparent;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.editable-content:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.editable-content:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 로딩 모달 */
.loading-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 500px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* API 키 모달 스타일 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    text-align: center;
    margin-bottom: 32px;
}

.modal-title {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

.modal-subtitle {
    font-size: 16px;
    color: #6b7280;
}

.api-key-input {
    width: 100%;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    margin-bottom: 16px;
}

.api-key-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-buttons button {
    flex: 1;
    padding: 14px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

/* 상태 메시지 */
.message {
    padding: 16px 20px;
    border-radius: 8px;
    margin: 16px 0;
    font-weight: 500;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* 프린트 최적화 CSS */
@media print {
    /* 네비게이션과 UI 요소 숨기기 */
    .sidebar,
    .viewer-toolbar,
    .btn,
    .loading-modal,
    .modal {
        display: none !important;
    }

    /* 페이지 설정 */
    @page {
        size: A4;
        margin: 20mm;
    }

    body {
        margin: 0;
        padding: 0;
        background: white;
        color: black;
        font-size: 12pt;
        line-height: 1.6;
    }

    .main-content {
        padding: 0;
        background: white;
    }

    .document-viewer {
        box-shadow: none;
        border-radius: 0;
        max-width: none;
        margin: 0;
    }

    .document-content {
        padding: 0;
    }

    .page {
        min-height: 250mm;
        page-break-after: always;
        margin-bottom: 0;
        padding: 20mm;
        box-shadow: none;
        border-radius: 0;
        background: white;
    }

    .page:last-child {
        page-break-after: avoid;
    }

    .cover-page {
        background: white !important;
        color: black !important;
    }

    .cover-title {
        color: #1e40af !important;
        text-shadow: none;
    }

    .company-name {
        color: #6b7280 !important;
    }

    .editable-content {
        border: none !important;
        padding: 0 !important;
        background: transparent !important;
    }

    /* 페이지 내 요소 조정 */
    h1 {
        font-size: 18pt;
        page-break-after: avoid;
    }

    h2 {
        font-size: 16pt;
        page-break-after: avoid;
    }

    h3 {
        font-size: 14pt;
        page-break-after: avoid;
    }

    .content-box,
    .highlight-box {
        page-break-inside: avoid;
        border: 1pt solid #e2e8f0;
        margin: 8pt 0;
    }

    .highlight-box {
        border-left: 3pt solid #3b82f6;
    }

    /* 테이블 인쇄 최적화 */
    table {
        page-break-inside: avoid;
        width: 100%;
        border-collapse: collapse;
    }

    th, td {
        border: 1pt solid #e5e7eb;
        padding: 6pt;
    }
}

/* 반응형 조정 */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }

    .main-content {
        padding: 24px 20px;
    }

    .input-form {
        padding: 24px;
        margin: 0 16px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .pc-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
    }

    .main-content {
        padding: 16px;
    }

    .viewer-toolbar {
        flex-direction: column;
        gap: 8px;
    }

    .modal-buttons {
        flex-direction: column;
    }

    .cover-title {
        font-size: 36px;
    }

    .company-name {
        min-width: 300px;
        font-size: 22px;
    }
}

/* 다크모드 지원 (선택사항) */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #111827;
        color: #f9fafb;
    }

    .main-content {
        background-color: #1f2937;
    }

    .stat-card,
    .input-form,
    .data-table,
    .document-viewer,
    .page {
        background: #374151;
        color: #f9fafb;
    }

    .form-input,
    .form-textarea {
        background: #4b5563;
        border-color: #6b7280;
        color: #f9fafb;
    }

    .content-box {
        background: #4b5563;
        border-color: #6b7280;
    }

    .highlight-box {
        background: #1e3a8a;
        border-left-color: #60a5fa;
    }
}