/* ============================================================
   AUTOBIOGRAPHY.CSS — PAGE-SPECIFIC STYLES
   (Wrapper, Hero, Chapters, Stats, Language Toggle, Modal)
   ============================================================ */

/* ============================================================
   WRAPPER
   ============================================================ */
.autobio-wrapper {
    max-width: 880px;
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 45px 40px;
    box-shadow: var(--shadow);
    animation: fadeIn 0.6s ease;
    position: relative;
    overflow: hidden;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.autobio-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 20%, rgba(9, 132, 227, 0.03) 0%, transparent 60%);
    pointer-events: none;
    transition: opacity var(--transition);
}

[data-theme="dark"] .autobio-wrapper::before {
    opacity: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   HERO
   ============================================================ */
.autobio-header {
    text-align: center;
    margin-bottom: 35px;
    position: relative;
    z-index: 1;
}

.profile-photo {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 4px solid var(--primary);
    object-fit: cover;
    margin-bottom: 16px;
    box-shadow: 0 0 40px rgba(9, 132, 227, 0.2);
    transition: var(--transition);
}

.profile-photo:hover {
    transform: scale(1.04);
    box-shadow: 0 0 60px rgba(9, 132, 227, 0.3);
}

.autobio-header h1 {
    font-size: 36px;
    font-weight: 700;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2px;
    min-height: 48px;
}

.autobio-header .intro-line {
    font-size: 20px;
    font-style: italic;
    color: var(--primary);
    letter-spacing: 1px;
    margin-bottom: 4px;
    opacity: 0.9;
}

.autobio-header .sub-line {
    color: var(--text-muted);
    font-size: 14px;
    letter-spacing: 0.5px;
}

.autobio-header .bio-line {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 8px;
}

/* ============================================================
   BACK LINK (Top)
   ============================================================ */
.back-link-top {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    z-index: 1;
}

.back-link-top:hover {
    color: var(--text-primary);
    transform: translateX(-4px);
}

/* ============================================================
   STATS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 30px 0 35px;
    position: relative;
    z-index: 1;
}

.stat-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 18px 12px;
    text-align: center;
    transition: all var(--transition);
}

.stat-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(9, 132, 227, 0.1);
}

[data-theme="dark"] .stat-card:hover {
    box-shadow: 0 8px 30px rgba(9, 132, 227, 0.2);
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

/* ============================================================
   LANGUAGE TOGGLE
   ============================================================ */
.lang-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 10px 0 15px;
    position: relative;
    z-index: 1;
}

.lang-btn {
    padding: 10px 28px;
    border: 2px solid var(--primary);
    border-radius: 50px;
    background: transparent;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
}

.lang-btn:hover {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 20px rgba(9, 132, 227, 0.3);
}

.lang-btn.active {
    background: var(--primary);
    color: #fff;
}

/* ============================================================
   DOWNLOAD ACTIONS
   ============================================================ */
.download-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 5px 0 20px;
    padding: 12px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
}

.download-btn {
    padding: 8px 24px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.download-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(9, 132, 227, 0.05);
    transform: translateY(-2px);
}

[data-theme="dark"] .download-btn:hover {
    background: rgba(9, 132, 227, 0.15);
}

.download-btn.primary {
    background: var(--gradient-accent);
    color: #fff;
    border: none;
}

.download-btn.primary:hover {
    box-shadow: 0 4px 20px rgba(9, 132, 227, 0.4);
    transform: translateY(-2px) scale(1.02);
}

/* ============================================================
   CHAPTER PROGRESS
   ============================================================ */
.chapter-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px 4px 4px 4px;
    margin-top: 4px;
    position: relative;
    z-index: 1;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.chapter-progress-info .chapter-num {
    color: var(--primary);
}

.chapter-progress-info .chapter-percent {
    color: var(--primary);
}

/* ============================================================
   PROGRESS DOTS
   ============================================================ */
.progress-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0 10px;
    position: relative;
    z-index: 1;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    transition: all var(--transition);
    cursor: pointer;
}

.dot.active {
    background: var(--primary);
    box-shadow: 0 0 20px rgba(9, 132, 227, 0.3);
    transform: scale(1.2);
}

.dot:hover {
    background: var(--primary);
    transform: scale(1.1);
}

/* ============================================================
   CHAPTERS
   ============================================================ */
.chapter {
    display: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 30px 28px;
    border: 1px solid var(--border-color);
    margin-top: 10px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease;
    transition: all var(--transition);
}

.chapter.active {
    display: block;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.chapter h3 {
    color: var(--primary);
    font-size: 20px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chapter h3 .emoji-big {
    font-size: 26px;
    display: inline-block;
    animation: floatEmoji 3s ease-in-out infinite;
}

@keyframes floatEmoji {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.chapter p {
    color: var(--text-secondary);
    line-height: 1.9;
    font-size: 16px;
    margin-bottom: 10px;
    transition: color var(--transition);
}

.chapter p strong {
    color: var(--text-primary);
}

.chapter ul {
    color: var(--text-secondary);
    padding-left: 20px;
    list-style: none;
}

.chapter ul li {
    margin-bottom: 6px;
    padding-left: 6px;
}

.chapter ul li::before {
    content: "▸ ";
    color: var(--primary);
}

/* ============================================================
   PHOTO PLACEHOLDER
   ============================================================ */
.chapter-photo-placeholder {
    margin: 20px 0 25px 0;
    text-align: center;
}

.photo-slot {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1/1;
    margin: 0 auto;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    flex-direction: column;
    gap: 8px;
}

.photo-slot:hover {
    border-color: var(--primary);
    background: rgba(9, 132, 227, 0.05);
}

[data-theme="dark"] .photo-slot:hover {
    background: rgba(9, 132, 227, 0.1);
}

.photo-slot .upload-hint {
    color: var(--text-muted);
    font-size: 14px;
    letter-spacing: 1px;
    background: var(--bg-tertiary);
    padding: 8px 20px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
}

.photo-slot .fig-caption {
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
    margin-top: 4px;
}

.photo-slot.has-image {
    border: 2px solid var(--primary);
    background: transparent;
    padding: 0;
}

.photo-slot.has-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-slot.has-image .fig-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    font-size: 13px;
    font-style: italic;
    text-align: center;
    margin: 0;
}

[data-theme="dark"] .photo-slot.has-image .fig-caption {
    background: rgba(0, 0, 0, 0.8);
}

/* ============================================================
   QUOTE BOXES
   ============================================================ */
.quote-box {
    background: rgba(9, 132, 227, 0.06);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 18px 22px;
    margin: 20px 0;
    font-style: italic;
    color: var(--text-secondary);
    font-size: 17px;
    line-height: 1.7;
    transition: all var(--transition);
}

[data-theme="dark"] .quote-box {
    background: rgba(9, 132, 227, 0.1);
}

.quote-box .author {
    display: block;
    margin-top: 6px;
    font-size: 14px;
    color: var(--primary);
    font-style: normal;
    font-weight: 500;
}

.quote-box.purple {
    border-left-color: var(--accent);
}

/* ============================================================
   TEACHER TRIBUTE
   ============================================================ */
.teacher-tribute {
    background: rgba(9, 132, 227, 0.06);
    border-radius: var(--radius-sm);
    padding: 18px 22px;
    margin: 16px 0;
    border: 1px solid rgba(9, 132, 227, 0.15);
    transition: all var(--transition);
}

[data-theme="dark"] .teacher-tribute {
    background: rgba(9, 132, 227, 0.08);
    border-color: rgba(9, 132, 227, 0.2);
}

.teacher-tribute h4 {
    color: var(--primary);
    font-size: 17px;
    margin-bottom: 4px;
}

.teacher-tribute p {
    margin-bottom: 0;
    font-size: 15px;
}

/* ============================================================
   FAMILY GRID
   ============================================================ */
.family-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 12px 0 6px;
}

.family-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    transition: all var(--transition);
}

.family-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.family-item .label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.family-item .value {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
    margin-top: 2px;
}

/* ============================================================
   FRIEND MEMORY PDF
   ============================================================ */
.friend-memory-pdf {
    background: rgba(9, 132, 227, 0.04);
    border: 1px dashed rgba(9, 132, 227, 0.3);
    border-radius: var(--radius-sm);
    padding: 20px 24px;
    margin: 16px 0;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.8;
    transition: all var(--transition);
}

[data-theme="dark"] .friend-memory-pdf {
    background: rgba(9, 132, 227, 0.08);
    border-color: rgba(9, 132, 227, 0.2);
}

.friend-memory-pdf strong {
    color: var(--primary);
}

.friend-memory-pdf .pdf-label {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 14px;
    border-radius: 30px;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* ============================================================
   NAVIGATION BUTTONS
   ============================================================ */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    gap: 16px;
}

.nav-btn {
    padding: 12px 28px;
    background: var(--gradient-accent);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    box-shadow: 0 4px 20px rgba(9, 132, 227, 0.3);
    min-width: 130px;
}

.nav-btn:hover:not(:disabled) {
    transform: scale(1.04);
    box-shadow: 0 8px 30px rgba(9, 132, 227, 0.5);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.nav-btn.prev-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    box-shadow: none;
    border: 1px solid var(--border-color);
}

.nav-btn.prev-btn:hover:not(:disabled) {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--primary);
}

/* ============================================================
   BACK LINK (Bottom)
   ============================================================ */
.back-link {
    display: inline-block;
    margin-top: 30px;
    color: var(--primary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
    z-index: 1;
}

.back-link:hover {
    color: var(--text-primary);
    transform: translateX(-4px);
}

/* ============================================================
   THANK YOU NOTE
   ============================================================ */
.thank-you-box {
    background: linear-gradient(135deg, rgba(9, 132, 227, 0.06), rgba(108, 92, 231, 0.06));
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 30px 35px;
    margin: 25px 0;
    text-align: center;
    transition: all var(--transition);
}

[data-theme="dark"] .thank-you-box {
    background: linear-gradient(135deg, rgba(9, 132, 227, 0.1), rgba(108, 92, 231, 0.1));
}

.thank-you-box h2 {
    color: var(--primary);
    font-size: 28px;
    margin-bottom: 10px;
}

.thank-you-box p {
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.thank-you-box .signature {
    font-style: italic;
    font-size: 20px;
    color: var(--primary);
    margin-top: 15px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px 36px;
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow);
    animation: fadeIn 0.4s ease;
    position: relative;
}

.modal-content h2 {
    color: var(--text-primary);
    font-size: 24px;
    margin-bottom: 6px;
}

.modal-content .modal-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-muted);
    background: none;
    border: none;
    font-family: var(--font);
    transition: all var(--transition);
}

.modal-close:hover {
    color: var(--primary);
    transform: rotate(90deg);
}

.modal-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    transition: all var(--transition);
}

.modal-option:hover {
    border-color: var(--primary);
}

.modal-option .opt-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.modal-option .opt-title {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 15px;
}

.modal-option .opt-desc {
    color: var(--text-muted);
    font-size: 12px;
}

.modal-btn {
    padding: 6px 18px;
    border-radius: 30px;
    border: none;
    background: var(--gradient-accent);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
}

.modal-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(9, 132, 227, 0.4);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 700px) {
    .autobio-wrapper {
        padding: 28px 18px;
    }

    .autobio-header h1 {
        font-size: 28px;
    }

    .autobio-header .intro-line {
        font-size: 17px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

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

    .chapter {
        padding: 20px 16px;
    }

    .profile-photo {
        width: 100px;
        height: 100px;
    }

    .modal-content {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .autobio-wrapper {
        padding: 20px 14px;
    }

    .autobio-header h1 {
        font-size: 24px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-number {
        font-size: 22px;
    }

    .lang-btn {
        padding: 6px 16px;
        font-size: 12px;
    }

    .quote-box {
        font-size: 15px;
        padding: 14px 16px;
    }

    .nav-btn {
        padding: 10px 20px;
        font-size: 14px;
        min-width: 100px;
    }

    .nav-buttons {
        flex-direction: column;
        gap: 12px;
    }

    .nav-btn {
        width: 100%;
        min-width: unset;
    }

    .chapter-progress-info {
        font-size: 11px;
        flex-wrap: wrap;
        gap: 4px;
    }

    .progress-dots {
        gap: 6px;
    }

    .dot {
        width: 8px;
        height: 8px;
    }

    .modal-content {
        padding: 24px 16px;
    }

    .modal-content h2 {
        font-size: 20px;
    }

    .modal-option {
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-btn {
        padding: 4px 14px;
        font-size: 12px;
    }

    .download-btn {
        padding: 6px 14px;
        font-size: 12px;
    }

    .thank-you-box {
        padding: 20px 16px;
    }

    .thank-you-box h2 {
        font-size: 22px;
    }

    .thank-you-box p {
        font-size: 16px;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .lang-controls,
    .nav-buttons,
    .progress-dots,
    .chapter-progress-info,
    .download-actions,
    .modal-overlay {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
        padding: 20px;
    }

    .autobio-wrapper {
        box-shadow: none;
        border: 1px solid #ddd;
        background: #fff;
        padding: 30px;
        border-radius: 0;
    }

    .chapter {
        background: #fff;
        border: 1px solid #eee;
        page-break-inside: avoid;
        padding: 20px;
    }

    .chapter p {
        color: #333;
    }

    .chapter p strong {
        color: #000;
    }

    .chapter h3 {
        color: #0984e3;
    }

    .photo-slot {
        border: 1px solid #ddd;
    }

    .stat-card {
        background: #f9f9f9;
        border: 1px solid #eee;
    }

    .stat-number {
        color: #0984e3;
    }

    .stat-label {
        color: #666;
    }

    .quote-box {
        background: #f9f9f9;
    }

    .autobio-header h1 {
        background: none;
        -webkit-text-fill-color: #000;
        color: #000;
    }

    .autobio-wrapper::before {
        display: none;
    }

    .friend-memory-pdf {
        border-color: #ddd;
    }

    .family-item {
        background: #f9f9f9;
        border-color: #eee;
    }

    .family-item .value {
        color: #000;
    }

    .teacher-tribute {
        background: #f9f9f9;
        border-color: #ddd;
    }

    .back-link {
        color: #0984e3;
    }

    .back-link-top {
        color: #0984e3;
    }

    .intro-line {
        color: #0984e3;
    }

    .sub-line {
        color: #999;
    }

    .bio-line {
        color: #666;
    }

    .thank-you-box {
        border-color: #0984e3;
        background: #f9f9f9;
    }

    .thank-you-box p {
        color: #333;
    }

    .thank-you-box .signature {
        color: #0984e3;
    }
}
