/* CSS 변수 정의 - 라이트 모드 */
:root {
    --primary-color: #4A90E2;
    --secondary-color: #757575;
    --success-color: #4CAF50;
    --danger-color: #E53935;
    --warning-color: #FF9800;
    --background-color: #F5F5F5;
    --card-background: #FFFFFF;
    --text-color: #333333;
    --text-light: #666666;
    --border-color: #DDDDDD;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

/* 다크 모드 변수 */
[data-theme="dark"] {
    --primary-color: #5BA3F5;
    --secondary-color: #B0B0B0;
    --success-color: #66BB6A;
    --danger-color: #EF5350;
    --warning-color: #FFA726;
    --background-color: #1A1A1A;
    --card-background: #2D2D2D;
    --text-color: #E0E0E0;
    --text-light: #B0B0B0;
    --border-color: #404040;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 스킵 네비게이션 - 접근성 개선 */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    z-index: 10000;
}

.skip-to-content:focus {
    top: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 네비게이션 바 */
nav {
    background-color: var(--card-background);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-brand:hover {
    opacity: 0.8;
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--background-color);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

/* 헤더 */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #357ABD 100%);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1rem;
    opacity: 0.9;
}

/* 메인 컨텐츠 */
main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* 소개 섹션 */
.intro-section {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    text-align: center;
}

.intro-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.intro-section p {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.intro-section .note {
    color: var(--text-light);
    font-size: 0.9rem;
    font-style: italic;
}

/* 업로드 섹션 */
.upload-section {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.upload-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    text-align: center;
}

/* 드래그 앤 드롭 영역 */
.drop-zone {
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: var(--background-color);
}

.drop-zone:hover {
    border-color: var(--primary-color);
    background: var(--card-background);
}

.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(74, 144, 226, 0.1);
    transform: scale(1.02);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.drop-zone-content > * {
    pointer-events: none;
}

.drop-zone-content button {
    pointer-events: auto;
}

.upload-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

.drop-text {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.drop-subtext {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* 이미지 프리뷰 */
.image-preview {
    text-align: center;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-preview h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.image-preview img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    display: block;
    margin: 0 auto;
}

.image-preview button {
    margin-top: 1rem;
    position: relative;
}

/* 로딩 상태 */
.loading {
    text-align: center;
    padding: 2rem;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.loading p {
    color: var(--text-light);
}

/* 결과 섹션 */
.result-section {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.result-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    text-align: center;
}

.label-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.label-container .empty-message {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
}

.prediction-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.prediction-item .character-name {
    font-weight: 600;
    color: var(--text-color);
    min-width: 120px;
}

.prediction-item .progress-container {
    flex: 1;
    background: var(--border-color);
    height: 24px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.prediction-item .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    border-radius: 12px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.prediction-item .percentage {
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 독후감 섹션 */
.reviews-section {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.reviews-header {
    margin-bottom: 1.5rem;
}

.reviews-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 1rem;
}

.review-count {
    color: var(--text-light);
    font-size: 0.95rem;
}

.review-count strong {
    color: var(--primary-color);
    font-size: 1.2rem;
}

/* 독후감 리스트 */
.reviews-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* 독후감 카드 */
.review-card {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: var(--transition);
}

.review-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.review-header {
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--background-color);
    padding-bottom: 0.75rem;
}

.review-header h3 {
    color: var(--text-color);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    word-wrap: break-word;
}

.review-header .author {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.review-header .date {
    color: var(--secondary-color);
    font-size: 0.875rem;
}

.review-content {
    margin-bottom: 1rem;
}

.review-content p {
    color: var(--text-color);
    line-height: 1.7;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.review-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.review-actions button {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.edit-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.edit-btn:hover {
    background-color: #357ABD;
}

.delete-btn {
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.delete-btn:hover {
    background-color: #C62828;
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.empty-state p:last-child {
    color: var(--secondary-color);
}

/* 오류 메시지 */
.error-message {
    display: block;
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    min-height: 1.2rem;
}

.form-group input.error,
.form-group textarea.error {
    border-color: var(--danger-color);
}

/* 폼 섹션 */
.form-section {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.form-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
    margin-left: 0.5rem;
}

.btn-secondary:hover {
    background-color: #616161;
}

/* 폼 스타일 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background-color: var(--card-background);
    color: var(--text-color);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

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

/* 버튼 스타일 */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #357ABD;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #C62828;
}

.btn-icon {
    font-size: 1.2rem;
}

.form-actions {
    display: flex;
    justify-content: end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* 문의 섹션 */
.contact-section {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-width: 1200px;
    width: calc(100% - 2rem);
    margin: 2rem auto;
}

.contact-section h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.contact-section > p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* 푸터 */
footer {
    background-color: var(--text-color);
    color: white;
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: 2rem;
}

footer p {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 테마 토글 버튼 */
.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-hover);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(20deg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    header p {
        font-size: 0.9rem;
    }

    main {
        padding: 1rem 0.5rem;
    }

    .intro-section,
    .upload-section,
    .result-section,
    .contact-section,
    .form-section,
    .reviews-section {
        padding: 1.5rem;
        border-radius: 8px;
    }

    .reviews-list {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stats-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .upload-icon {
        font-size: 3rem;
    }

    .drop-text {
        font-size: 1rem;
    }

    .image-preview img {
        max-height: 300px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions button {
        width: 100%;
    }

    .theme-toggle {
        width: 50px;
        height: 50px;
        bottom: 1.5rem;
        right: 1.5rem;
        font-size: 1.25rem;
    }

    .prediction-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .prediction-item .character-name {
        width: 100%;
    }

    .prediction-item .progress-container {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .form-group input,
    .form-group textarea {
        font-size: 0.95rem;
    }

    .btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.95rem;
    }
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.prediction-item {
    animation: fadeIn 0.3s ease-out;
}

/* 추가된 스타일 */
.services-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.service-card {
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    border: 2px solid transparent;
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.service-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.service-card h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.service-card p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.service-card .btn {
    width: 100%;
}

.landing-header {
    text-align: center;
    margin-bottom: 3rem;
}

.landing-header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.landing-header p {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* 유틸리티 클래스 */
.text-left { text-align: left; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.lh-1-8 { line-height: 1.8; }
.text-primary { color: var(--primary-color); }
.fs-1-1 { font-size: 1.1rem; }
.mb-0-5 { margin-bottom: 0.5rem; }
.m-1-0 { margin: 1rem 0; }
.p-1-5 { padding: 1.5rem; }
.p-1 { padding: 1rem; }
.bg-background { background: var(--background-color); }
.br-8 { border-radius: 8px; }
.br-4 { border-radius: 4px; }
.bl-4-primary { border-left: 4px solid var(--primary-color); }
.bg-primary--10 { background: rgba(74, 144, 226, 0.1); }
.m-0 { margin: 0; }
.mb-0-75 { margin-bottom: 0.75rem; }
