/* === Gnani — Navy & Gold (Light + Dark + Mobile) === */

:root {
    --bg: #FFFFFF;
    --bg-card: #F8F8F8;
    --bg-card-hover: #F0F0F0;
    --navy: #002147;
    --navy-light: #1A3A5C;
    --gold: #B89344;
    --gold-light: #D4AB5E;
    --gold-pale: rgba(184, 147, 68, 0.08);
    --text-primary: #002147;
    --text-secondary: #4A5A6E;
    --text-muted: #8899AA;
    --border: #E5E5E5;
    --border-gold: rgba(184, 147, 68, 0.3);
    --shadow: 0 2px 16px rgba(0, 33, 71, 0.06);
    --shadow-lg: 0 8px 40px rgba(0, 33, 71, 0.10);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg: #0d1117;
    --bg-card: #161b22;
    --bg-card-hover: #1c2333;
    --navy: #8899CC;
    --navy-light: #AABBEE;
    --gold: #B89344;
    --gold-light: #D4AB5E;
    --gold-pale: rgba(184, 147, 68, 0.06);
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #555d66;
    --border: #21262d;
    --border-gold: rgba(184, 147, 68, 0.25);
    --shadow: 0 2px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', 'Noto Serif Tamil', serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s ease, color 0.3s ease;
}

/* === Theme Toggle === */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    padding: 8px;
    border-radius: 50%;
    transition: all var(--transition);
    line-height: 1;
    margin-left: auto;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle:hover {
    transform: scale(1.15);
    background: var(--bg-card-hover);
}

/* === Header === */
header {
    text-align: center;
    padding: 80px 20px 50px;
}

.compact-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color var(--transition);
    padding: 8px 0;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
}
.back-link:hover { color: var(--gold); }

.logo-img {
    width: 200px;
    height: auto;
    margin-bottom: 20px;
    max-width: 80%;
}

.logo-tamil {
    font-family: 'Noto Serif Tamil', serif;
    font-size: 56px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: 1px;
}

.logo.small .logo-tamil {
    font-size: 30px;
}

.logo.small .logo-img-sm {
    height: 32px;
    width: auto;
}
/* Dark mode: give logo a white badge so JPG white bg blends in */
[data-theme="dark"] .logo-img {
    background: #fff;
    padding: 12px 20px;
    border-radius: 16px;
}

[data-theme="dark"] .logo-img-sm {
    background: #fff;
    padding: 6px 12px;
    border-radius: 10px;
}


.tagline {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* === Main === */
main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 32px 16px 80px;
}

.welcome-section {
    text-align: center;
    margin-bottom: 40px;
}

.welcome-section h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 6px;
}

.welcome-section p {
    color: var(--text-secondary);
    font-size: 15px;
}

/* === Tool Cards Grid === */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.tool-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tool-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-gold);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.tool-card:active {
    transform: scale(0.98);
}

.card-primary {
    border-color: var(--border-gold);
}

.card-primary:hover {
    border-color: var(--gold);
    box-shadow: var(--shadow-lg);
}

.card-coming {
    opacity: 0.6;
    cursor: default;
}
.card-coming:hover {
    opacity: 0.75;
    transform: none;
    box-shadow: none;
    border-color: var(--border);
}
.card-coming:active {
    transform: none;
}

.card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    flex-shrink: 0;
}

.card-icon svg { width: 24px; height: 24px; }

.card-content { flex: 1; min-width: 0; }

.card-content h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 2px;
}

.card-content p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.coming-tag {
    display: inline-block;
    margin-top: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 2px 10px;
    border: 1px solid var(--border);
    border-radius: 20px;
}

.card-arrow {
    font-size: 18px;
    color: var(--gold);
    transition: transform var(--transition);
    flex-shrink: 0;
}
.tool-card:hover .card-arrow { transform: translateX(3px); }
.card-coming .card-arrow { display: none; }

/* === Files === */
.files-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.files-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--navy);
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition);
}

.file-item:hover {
    border-color: var(--border-gold);
    background: var(--bg-card-hover);
}

.file-icon { font-size: 22px; flex-shrink: 0; }

.file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.file-download-icon {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: color var(--transition);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.file-item:hover .file-download-icon { color: var(--gold); }

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 48px 16px;
}

.empty-icon { font-size: 40px; margin-bottom: 12px; }

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 6px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* === Footer === */
footer {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border);
}

.files-page main {
    max-width: 750px;
}

/* ======================================== */
/* === RESPONSIVE BREAKPOINTS === */
/* ======================================== */

/* Tablet — 768px and below */
@media (max-width: 768px) {
    header {
        padding: 48px 16px 32px;
    }

    .logo-img {
        width: 150px;
    }

    .logo-tamil {
        font-size: 42px;
    }

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

    .tool-card {
        padding: 16px 18px;
        gap: 12px;
    }

    .welcome-section h2 {
        font-size: 22px;
    }

    main {
        padding: 24px 12px 60px;
    }
}

/* Phone — 480px and below */
@media (max-width: 480px) {
    header {
        padding: 36px 12px 24px;
    }

    .compact-header {
        padding: 12px 12px;
        gap: 8px;
    }

    .logo-img {
        width: 130px;
        max-width: 70%;
    }

    .logo-img-sm {
        height: 28px !important;
    }

    .logo-tamil {
        font-size: 32px;
    }

    .tagline {
        font-size: 14px;
    }

    main {
        padding: 20px 10px 48px;
    }

    .welcome-section {
        margin-bottom: 28px;
    }

    .welcome-section h2 {
        font-size: 20px;
    }

    .welcome-section p {
        font-size: 14px;
    }

    .tool-card {
        padding: 14px 16px;
        gap: 10px;
    }

    .card-icon {
        width: 36px;
        height: 36px;
    }

    .card-icon svg {
        width: 22px;
        height: 22px;
    }

    .card-content h3 {
        font-size: 14px;
    }

    .card-content p {
        font-size: 12px;
    }

    .card-arrow {
        font-size: 16px;
    }

    /* Talk page */
    .talk-orb {
        width: 110px !important;
        height: 110px !important;
    }

    .talk-orb-icon {
        font-size: 32px !important;
    }

    .talk-bubble {
        margin-left: 12px !important;
        margin-right: 12px !important;
        font-size: 13px !important;
        padding: 12px 14px !important;
    }

    .talk-bubble.user {
        margin-left: 24px !important;
    }

    .talk-bubble.gnani {
        margin-right: 24px !important;
    }

    .talk-lang {
        gap: 4px;
    }

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

    .talk-transcript {
        max-width: 100% !important;
        padding: 0 4px;
    }

    .talk-container h2 {
        font-size: 18px !important;
    }

    /* History page */
    .history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .history-header h2 {
        font-size: 18px;
    }

    .export-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 13px;
    }

    .session-item {
        padding: 12px 14px;
        gap: 10px;
    }

    .session-preview {
        font-size: 13px;
    }

    .conv-bubble {
        max-width: 92% !important;
        font-size: 13px !important;
        padding: 10px 14px !important;
    }

    /* Files page */
    .files-header h2 {
        font-size: 18px;
    }

    .file-item {
        padding: 12px 14px;
        gap: 10px;
    }

    .file-name {
        font-size: 13px;
    }

    /* Footer */
    footer {
        padding: 24px 12px;
        font-size: 12px;
    }

    /* Back link */
    .back-link {
        font-size: 14px;
    }

    /* Toggle button sizing */
    .theme-toggle {
        font-size: 20px;
        padding: 6px;
        min-width: 40px;
        min-height: 40px;
    }

    /* Detail back link */
    .detail-back {
        font-size: 13px;
    }
}

/* Very small phones — 360px and below */
@media (max-width: 360px) {
    .compact-header {
        padding: 10px 8px;
        gap: 6px;
    }

    .logo-img-sm {
        height: 24px !important;
    }

    .theme-toggle {
        font-size: 18px;
        min-width: 36px;
        min-height: 36px;
    }

    .back-link {
        font-size: 13px;
    }

    .tool-card {
        padding: 12px 14px;
    }

    .talk-orb {
        width: 96px !important;
        height: 96px !important;
    }
}

/* Safe area insets for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }

    main {
        padding-bottom: calc(48px + env(safe-area-inset-bottom));
    }
}
