/* ========== Variables ========== */
:root {
    --color-primary: #2c3e50;
    --color-secondary: #34495e;
    --color-accent: #3498db;
    --color-text: #333;
    --color-text-light: #666;
    --color-bg: #ffffff;
    --color-bg-alt: #f8f9fa;
    --color-border: #e1e4e8;
    --color-success: #27ae60;

    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;

    --header-height: 70px;
    --transition: all 0.3s ease;
}

/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg-alt);
}

/* ========== Header ========== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border);
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-content {
    height: 100%;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 5px;
    background: var(--color-bg-alt);
    padding: 4px;
    border-radius: 6px;
}

.lang-btn {
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-light);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.lang-btn:hover {
    color: var(--color-accent);
}

.lang-btn.active {
    color: var(--color-bg);
    background: var(--color-accent);
}

/* PDF Download Button */
.pdf-btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-bg);
    background: var(--color-success);
    text-decoration: none;
    border-radius: 6px;
    transition: var(--transition);
    white-space: nowrap;
}

.pdf-btn:hover {
    background: #229954;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-bg-alt);
    padding: 4px 8px;
    border-radius: 6px;
}

.zoom-btn {
    width: 32px;
    height: 32px;
    font-size: 18px;
    font-weight: bold;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    background: var(--color-accent);
    color: var(--color-bg);
    border-color: var(--color-accent);
}

.zoom-level {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    min-width: 50px;
    text-align: center;
}

/* ========== Loading ========== */
.loading {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-alt);
    z-index: 999;
    transition: opacity 0.3s ease;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    margin-top: 20px;
    color: var(--color-text-light);
    font-size: 16px;
}

/* ========== PDF Container ========== */
.pdf-container {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: #525659;
    overflow: hidden;
}

.pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #525659;
}

/* ========== Info Panel ========== */
.info-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
}

.info-toggle {
    width: 50px;
    height: 50px;
    font-size: 24px;
    background: var(--color-accent);
    color: var(--color-bg);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: var(--transition);
}

.info-toggle:hover {
    background: var(--color-primary);
    transform: scale(1.05);
}

.info-content {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 350px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 150px);
    background: var(--color-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    overflow-y: auto;
}

.info-content.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.info-content h3 {
    font-size: 18px;
    color: var(--color-primary);
    margin-bottom: 12px;
}

.info-content h4 {
    font-size: 15px;
    color: var(--color-secondary);
    margin: 16px 0 8px 0;
}

.info-content p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
    margin-bottom: 12px;
}

.info-content ul {
    margin: 0 0 12px 20px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
}

.info-content li {
    margin-bottom: 8px;
}

.tip {
    padding: 12px;
    background: var(--color-bg-alt);
    border-left: 3px solid var(--color-accent);
    border-radius: 4px;
    font-size: 13px !important;
    margin-top: 16px !important;
}

/* ========== Responsive Design ========== */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    .header-content {
        padding: 10px 15px;
    }

    .zoom-controls {
        order: 3;
        flex: 1;
        justify-content: center;
    }

    .zoom-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    .zoom-level {
        font-size: 12px;
        min-width: 45px;
    }

    .pdf-container {
        top: var(--header-height);
    }

    .loading {
        top: var(--header-height);
    }

    .info-panel {
        bottom: 15px;
        right: 15px;
    }

    .info-toggle {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .info-content {
        width: 300px;
    }
}

@media (max-width: 480px) {
    .lang-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .zoom-controls {
        gap: 5px;
        padding: 3px 6px;
    }

    .zoom-btn {
        width: 26px;
        height: 26px;
        font-size: 14px;
    }

    .zoom-level {
        font-size: 11px;
        min-width: 40px;
    }

    .info-content {
        width: calc(100vw - 30px);
        padding: 15px;
    }

    .info-content h3 {
        font-size: 16px;
    }

    .info-content h4 {
        font-size: 14px;
    }
}

/* ========== Welcome Screen ========== */
.welcome-screen {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    overflow-y: auto;
}

.welcome-content {
    max-width: 900px;
    width: 100%;
    text-align: center;
}

.welcome-title {
    font-size: 32px;
    font-weight: 700;
    color: white;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.welcome-author {
    font-size: 18px;
    color: rgba(255,255,255,0.9);
    margin-bottom: 8px;
}

.welcome-screen .author-email {
    font-size: 16px;
    color: white;
    text-decoration: none;
    opacity: 0.85;
    transition: var(--transition);
    display: inline-block;
    margin-bottom: 50px;
}

.welcome-screen .author-email:hover {
    opacity: 1;
    text-decoration: underline;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.option-card {
    background: white;
    border: none;
    border-radius: 12px;
    padding: 30px 20px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.option-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.option-icon {
    font-size: 48px;
}

.option-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-primary);
    text-align: center;
}

.option-desc {
    font-size: 13px;
    color: var(--color-text-light);
}

/* ========== Audio Player ========== */
.audio-player {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.audio-content {
    max-width: 600px;
    width: 100%;
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.audio-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 30px;
    text-align: center;
}

audio {
    width: 100%;
    margin-top: 10px;
}

/* ========== Back Button ========== */
.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    background: rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.back-btn:hover {
    background: rgba(0,0,0,0.5);
    border-color: rgba(255,255,255,0.5);
}

/* ========== Utility Classes ========== */
.hidden {
    display: none !important;
}

/* ========== Responsive Design for Welcome Screen ========== */
@media (max-width: 768px) {
    .welcome-screen {
        top: var(--header-height);
        padding: 40px 15px 30px;
        align-items: flex-start;
        justify-content: flex-start;
    }

    .welcome-content {
        padding-top: 20px;
    }

    .welcome-title {
        font-size: 24px;
    }

    .welcome-author {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .welcome-screen .author-email {
        font-size: 14px;
        margin-bottom: 30px;
    }

    .options-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .option-card {
        padding: 25px 15px;
    }

    .audio-player {
        top: var(--header-height);
        padding: 20px 15px;
    }

    .audio-content {
        padding: 30px 20px;
    }

    .audio-title {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .back-btn {
        top: 10px;
        left: 10px;
        padding: 8px 15px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .welcome-screen {
        padding: 30px 15px 20px;
    }

    .welcome-content {
        padding-top: 10px;
    }

    .welcome-title {
        font-size: 20px;
    }

    .welcome-author {
        font-size: 14px;
        margin-bottom: 5px;
    }

    .welcome-screen .author-email {
        font-size: 13px;
        margin-bottom: 25px;
    }

    .option-icon {
        font-size: 40px;
    }

    .option-title {
        font-size: 14px;
    }

    .option-desc {
        font-size: 12px;
    }

    .audio-content {
        padding: 20px 15px;
    }

    .audio-title {
        font-size: 18px;
    }
}

/* ========== Print Styles ========== */
@media print {
    .header,
    .info-panel,
    .welcome-screen,
    .audio-player,
    .back-btn {
        display: none;
    }

    .pdf-container {
        top: 0;
    }
}
