/* =============================================
   Island Gorilla SPA Styles
   ============================================= */

/* === CSS Variables === */
:root {
    --ig-primary: #2D5016;
    --ig-primary-dark: #1a3009;
    --ig-primary-light: #3d6b1e;
    --ig-accent: #8BC34A;
    --ig-accent-dark: #689f38;
    --ig-bg: #ffffff;
    --ig-bg-secondary: #f5f5f5;
    --ig-text: #1a1a1a;
    --ig-text-muted: #666666;
    --ig-border: #e0e0e0;
    --ig-error: #EF4444;
    --ig-success: #10B981;
    --ig-warning: #F59E0B;

    /* Word status colors */
    --ig-word-new: #E3F2FD;
    --ig-word-learning1: #FFF9C4;
    --ig-word-learning2: #FFE0B2;
    --ig-word-learning3: #FFCC80;
    --ig-word-known: transparent;
    --ig-word-ignored: transparent;
}

/* === Reset & Base === */
.ig-spa-body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--ig-bg);
    color: var(--ig-text);
    -webkit-font-smoothing: antialiased;
}

/* === Loading === */
.ig-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: var(--ig-text-muted);
}

.ig-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--ig-border);
    border-top-color: var(--ig-primary);
    border-radius: 50%;
    animation: ig-spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes ig-spin {
    to { transform: rotate(360deg); }
}

/* === Offline Banner === */
.ig-offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--ig-warning);
    color: #1a1a1a;
    padding: 8px 16px;
    text-align: center;
    font-size: 14px;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Auth Pages === */
.ig-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ig-primary), var(--ig-primary-dark));
    padding: 20px;
}

.ig-auth-container {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

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

.ig-auth-header .ig-logo {
    font-size: 48px;
    margin-bottom: 8px;
}

.ig-auth-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--ig-text);
}

.ig-auth-header p {
    color: var(--ig-text-muted);
    margin: 0;
}

/* === Forms === */
.ig-form-group {
    margin-bottom: 16px;
}

.ig-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--ig-text);
}

.ig-form-group input,
.ig-form-group select,
.ig-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--ig-border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.ig-form-group input:focus,
.ig-form-group select:focus,
.ig-form-group textarea:focus {
    outline: none;
    border-color: var(--ig-primary);
    box-shadow: 0 0 0 3px rgba(45, 80, 22, 0.1);
}

/* === Buttons === */
.ig-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-decoration: none;
}

.ig-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ig-btn-primary {
    background: var(--ig-primary);
    color: white;
    width: 100%;
}

.ig-btn-primary:hover:not(:disabled) {
    background: var(--ig-primary-light);
}

.ig-btn-secondary {
    background: var(--ig-bg-secondary);
    color: var(--ig-text);
    border: 1px solid var(--ig-border);
}

.ig-btn-secondary:hover:not(:disabled) {
    background: #eee;
}

.ig-btn-accent {
    background: var(--ig-accent);
    color: var(--ig-primary-dark);
}

.ig-btn-accent:hover:not(:disabled) {
    background: var(--ig-accent-dark);
}

.ig-btn-outline {
    background: transparent;
    color: var(--ig-text);
    border: 1px solid var(--ig-border);
    padding: 8px 16px;
}

.ig-btn-outline:hover:not(:disabled) {
    background: var(--ig-bg-secondary);
}

.ig-btn-premium {
    background: linear-gradient(135deg, #8BC34A, #689f38);
    color: white;
    padding: 8px 16px;
    font-size: 13px;
}

.ig-btn-icon {
    background: transparent;
    border: none;
    color: var(--ig-text);
    padding: 8px;
    cursor: pointer;
    font-size: 16px;
}

.ig-btn-full {
    width: 100%;
}

.ig-btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* === Alerts === */
.ig-alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.4;
}

.ig-alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.ig-alert-success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.ig-alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

/* === Auth Footer === */
.ig-auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--ig-text-muted);
}

.ig-auth-footer a {
    color: var(--ig-primary);
    text-decoration: none;
    font-weight: 600;
}

/* === Divider === */
.ig-divider {
    display: flex;
    align-items: center;
    margin: 16px 0;
    color: var(--ig-text-muted);
    font-size: 13px;
}

.ig-divider::before,
.ig-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--ig-border);
}

.ig-divider span {
    padding: 0 12px;
}

/* === Verification === */
.ig-verification-sent {
    text-align: center;
    padding: 24px 0;
}

.ig-verification-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.ig-verification-message {
    font-size: 16px;
    color: var(--ig-text);
    margin-bottom: 12px;
}

.ig-verification-hint {
    font-size: 14px;
    color: var(--ig-text-muted);
    margin-bottom: 16px;
}

/* === Spinner === */
.ig-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: ig-spin 0.6s linear infinite;
    vertical-align: middle;
}

/* === Header === */
.ig-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: white;
    border-bottom: 1px solid var(--ig-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.ig-header-logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--ig-primary);
}

.ig-header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.ig-header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ig-nav-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    color: var(--ig-text-muted);
    font-weight: 500;
    transition: all 0.2s;
}

.ig-nav-btn:hover {
    background: var(--ig-bg-secondary);
    color: var(--ig-text);
}

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

/* === Main Layout === */
.ig-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* === Home Page === */
.ig-home-page {
    min-height: 100vh;
}

.ig-welcome-card {
    text-align: center;
    padding: 32px;
    margin-bottom: 32px;
}

.ig-welcome-card h1 {
    font-size: 28px;
    margin: 0 0 8px;
}

.ig-welcome-card p {
    color: var(--ig-text-muted);
    margin: 0;
    font-size: 16px;
}

/* === Content Library === */
.ig-content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.ig-content-card {
    background: white;
    border: 1px solid var(--ig-border);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.1s;
}

.ig-content-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.ig-content-card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--ig-text);
}

.ig-content-card-meta {
    font-size: 13px;
    color: var(--ig-text-muted);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ig-content-card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.ig-tag {
    background: var(--ig-bg-secondary);
    color: var(--ig-text-muted);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.ig-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.ig-badge-difficulty {
    background: #E8F5E9;
    color: #2E7D32;
}

/* === Import Page === */
.ig-import-page {
    min-height: 100vh;
}

.ig-import-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 24px;
}

.ig-import-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--ig-border);
    padding-bottom: 12px;
}

.ig-import-tab {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--ig-text-muted);
    transition: all 0.2s;
}

.ig-import-tab.active {
    background: var(--ig-primary);
    color: white;
}

.ig-textarea {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border: 1px solid var(--ig-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    resize: vertical;
    box-sizing: border-box;
}

.ig-textarea:focus {
    outline: none;
    border-color: var(--ig-primary);
    box-shadow: 0 0 0 3px rgba(45, 80, 22, 0.1);
}

/* === Reader Page === */
.ig-reader-page {
    min-height: 100vh;
    background: var(--ig-bg);
}

.ig-reader-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: white;
    border-bottom: 1px solid var(--ig-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.ig-reader-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ig-reader-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 24px 100px;
    line-height: 2.8;
    font-size: 18px;
}

.ig-reader-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--ig-text);
    line-height: 1.3;
}

/* Tokenized text container */
.ig-reader-tokens {
    line-height: 2.8;
}

/* === Word Highlighting === */
.ig-word {
    cursor: pointer;
    padding: 2px 1px;
    border-radius: 3px;
    transition: background-color 0.15s;
}

.ig-word:hover {
    filter: brightness(0.9);
}

.ig-word-new {
    background-color: var(--ig-word-new);
}

.ig-word-learning1 {
    background-color: var(--ig-word-learning1);
}

.ig-word-learning2 {
    background-color: var(--ig-word-learning2);
}

.ig-word-learning3 {
    background-color: var(--ig-word-learning3);
}

.ig-word-known {
    background-color: var(--ig-word-known);
}

.ig-word-ignored {
    background-color: var(--ig-word-ignored);
    opacity: 0.5;
}

/* === Word Popup === */
.ig-word-popup {
    position: fixed;
    background: white;
    border: 1px solid var(--ig-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 20px;
    width: 320px;
    max-width: calc(100vw - 32px);
    z-index: 1000;
    animation: ig-popup-in 0.15s ease-out;
}

@keyframes ig-popup-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ig-popup-word {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ig-popup-translation {
    font-size: 16px;
    color: var(--ig-primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.ig-popup-pos {
    font-size: 13px;
    color: var(--ig-text-muted);
    font-style: italic;
    margin-bottom: 8px;
}

.ig-popup-example {
    font-size: 14px;
    color: var(--ig-text-muted);
    line-height: 1.5;
    padding: 8px 12px;
    background: var(--ig-bg-secondary);
    border-radius: 6px;
    margin-bottom: 12px;
}

.ig-popup-status-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.ig-status-btn {
    flex: 1;
    padding: 6px 4px;
    border: 1px solid var(--ig-border);
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    background: white;
    transition: all 0.15s;
    text-align: center;
}

.ig-status-btn.active {
    border-color: var(--ig-primary);
    background: var(--ig-primary);
    color: white;
}

.ig-popup-audio-btn {
    background: none;
    border: 1px solid var(--ig-border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.15s;
}

.ig-popup-audio-btn:hover {
    background: var(--ig-bg-secondary);
}

.ig-popup-note {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--ig-border);
    border-radius: 6px;
    font-size: 13px;
    resize: none;
    font-family: inherit;
    box-sizing: border-box;
}

.ig-save-note-btn {
    margin-top: 6px;
    font-size: 12px;
    padding: 4px 12px;
}

.ig-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--ig-text-muted);
    padding: 4px;
}

/* === Progress Bar === */
.ig-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--ig-accent);
    z-index: 1000;
    transition: width 0.15s;
}

/* === Sticky Page Navigation Bar === */
.ig-pager {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--ig-border);
    z-index: 100;
}

.ig-pager-btn {
    padding: 8px 20px;
    border: 1px solid var(--ig-border);
    border-radius: 8px;
    background: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--ig-text);
    transition: all 0.15s;
    min-width: 90px;
}

.ig-pager-btn:hover:not(:disabled) {
    background: var(--ig-bg-secondary);
    border-color: var(--ig-primary);
}

.ig-pager-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ig-pager-info {
    font-size: 14px;
    font-weight: 500;
    color: var(--ig-text-muted);
    min-width: 100px;
    text-align: center;
}

/* === Auto-mark Toast === */
.ig-page-toast {
    position: fixed;
    bottom: 72px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: var(--ig-primary);
    color: white;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 200;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    animation: ig-toast-in 0.25s ease-out;
    white-space: nowrap;
}

@keyframes ig-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.ig-toast-undo {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    color: white;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.ig-toast-undo:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* === CJK Ruby / Romanization Annotations === */
.ig-ruby {
    ruby-align: center;
}

.ig-rt {
    font-size: 10px;
    font-weight: 400;
    color: var(--ig-text-muted);
    letter-spacing: 0.5px;
    opacity: 0.85;
    user-select: none;
}

/* Dark theme pager */
.ig-theme-dark .ig-pager {
    background: rgba(26, 26, 46, 0.95);
    border-color: #333;
}

.ig-theme-dark .ig-pager-btn {
    background: #2a2a3e;
    border-color: #555;
    color: #e0e0e0;
}

.ig-theme-dark .ig-pager-btn:hover:not(:disabled) {
    background: #333;
}

/* Sepia theme pager */
.ig-theme-sepia .ig-pager {
    background: rgba(250, 240, 230, 0.95);
    border-color: #d4c4b0;
}

.ig-theme-sepia .ig-pager-btn {
    background: #faf0e6;
    border-color: #d4c4b0;
    color: #5B4636;
}

/* Dark theme ruby annotation */
.ig-theme-dark .ig-rt {
    color: #999;
}

/* === Sentence highlighting (TTS) === */
.ig-sentence-active {
    background: rgba(139, 195, 74, 0.15);
    border-radius: 4px;
}

/* === Reader Themes === */
.ig-theme-light {
    background: #ffffff;
    color: #1a1a1a;
}

.ig-theme-sepia {
    background: #FAF0E6;
    color: #5B4636;
}

.ig-theme-dark {
    background: #1a1a2e;
    color: #e0e0e0;
}

.ig-theme-dark .ig-reader-header {
    background: #16162a;
    border-color: #333;
}

.ig-theme-dark .ig-btn-icon {
    color: #e0e0e0;
}

.ig-theme-dark .ig-word-popup {
    background: #2a2a3e;
    border-color: #444;
    color: #e0e0e0;
}

/* Dark mode: word status colors need good contrast on dark bg */
.ig-theme-dark .ig-word-new {
    background: #1e3a5f !important;
    color: #b3d4fc !important;
}

.ig-theme-dark .ig-word-learning1 {
    background: #5c4a00 !important;
    color: #ffe57f !important;
}

.ig-theme-dark .ig-word-learning2 {
    background: #6d3b00 !important;
    color: #ffcc80 !important;
}

.ig-theme-dark .ig-word-learning3 {
    background: #7a3000 !important;
    color: #ffab91 !important;
}

.ig-theme-dark .ig-reader-title {
    color: #f0f0f0;
}

.ig-theme-dark .ig-popup-translation {
    color: #90caf9;
}

.ig-theme-dark .ig-popup-pos {
    color: #a5d6a7;
}

.ig-theme-dark .ig-popup-example {
    background: #1e1e32;
    border-color: #444;
    color: #ccc;
}

.ig-theme-dark .ig-popup-note {
    background: #1e1e32;
    border-color: #444;
    color: #e0e0e0;
}

.ig-theme-dark .ig-status-btn {
    background: #333;
    color: #ccc;
    border-color: #555;
}

.ig-theme-dark .ig-status-btn.active {
    background: var(--ig-primary);
    color: white;
}

.ig-theme-dark .ig-btn-outline {
    border-color: #555;
    color: #ccc;
}

.ig-theme-dark .ig-alert-info {
    background: #1e2a3a;
    border-color: #2a4060;
    color: #b3d4fc;
}

.ig-theme-dark .ig-speed-select {
    background: #2a2a3e;
    color: #e0e0e0;
    border-color: #555;
}

/* === Audio Player Bar === */
.ig-audio-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin-bottom: 20px;
    background: var(--ig-bg-secondary, #f5f5f5);
    border: 1px solid var(--ig-border, #e0e0e0);
    border-radius: 10px;
    line-height: 1;
}

.ig-audio-bar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--ig-primary, #16A34A);
    color: white;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.ig-audio-bar-btn:hover {
    background: var(--ig-primary-hover, #15803d);
}

.ig-audio-bar-progress {
    flex: 1;
    cursor: pointer;
    padding: 6px 0;
}

.ig-audio-bar-track {
    height: 4px;
    background: var(--ig-border, #d4d4d4);
    border-radius: 2px;
    overflow: hidden;
}

.ig-audio-bar-fill {
    height: 100%;
    background: var(--ig-primary, #16A34A);
    border-radius: 2px;
    transition: width 0.2s linear;
}

.ig-audio-bar-time {
    font-size: 12px;
    color: var(--ig-text-muted, #888);
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.ig-audio-bar-speed {
    padding: 4px 6px;
    border: 1px solid var(--ig-border, #d4d4d4);
    border-radius: 6px;
    background: var(--ig-bg, white);
    font-size: 12px;
    color: var(--ig-text);
    cursor: pointer;
}

.ig-theme-dark .ig-audio-bar {
    background: #1e1e2e;
    border-color: #444;
}

.ig-theme-dark .ig-audio-bar-track {
    background: #444;
}

.ig-theme-dark .ig-audio-bar-time {
    color: #aaa;
}

.ig-theme-dark .ig-audio-bar-speed {
    background: #2a2a3e;
    color: #e0e0e0;
    border-color: #555;
}

.ig-theme-sepia .ig-audio-bar {
    background: #f0e6d2;
    border-color: #d4c5a0;
}

.ig-theme-sepia .ig-audio-bar-track {
    background: #d4c5a0;
}

/* === Upgrade Banner === */
.ig-upgrade-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    margin: 12px auto 0;
    max-width: 800px;
    background: #FEF3C7;
    border: 1px solid #F59E0B;
    border-radius: 8px;
    color: #92400E;
    font-size: 14px;
}

.ig-upgrade-banner-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #92400E;
    padding: 0 4px;
    line-height: 1;
}

.ig-upgrade-banner-close:hover {
    color: #78350F;
}

.ig-theme-dark .ig-upgrade-banner {
    background: #3d2e00;
    border-color: #6b5000;
    color: #ffd54f;
}

.ig-theme-dark .ig-upgrade-banner-close {
    color: #ffd54f;
}

/* === Hamburger Menu === */
.ig-hamburger {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--ig-text);
}

.ig-desktop-only {
    display: flex;
}

.ig-mobile-only {
    display: none;
}

.ig-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.ig-mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100%;
    background: var(--ig-bg);
    border-left: 1px solid var(--ig-border);
    z-index: 1000;
    padding: 0;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
}

.ig-mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ig-border);
    font-weight: 600;
}

.ig-mobile-menu-item {
    display: block;
    width: 100%;
    padding: 14px 20px;
    border: none;
    background: none;
    text-align: left;
    font-size: 15px;
    cursor: pointer;
    color: var(--ig-text);
    border-bottom: 1px solid var(--ig-border);
}

.ig-mobile-menu-item:hover {
    background: var(--ig-bg-secondary);
}

.ig-mobile-menu-item.active {
    color: var(--ig-primary);
    font-weight: 600;
}

/* === Features Grid (Pricing Page) === */
.ig-features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.ig-feature-item {
    text-align: center;
    padding: 24px 16px;
    border: 1px solid var(--ig-border);
    border-radius: 12px;
    background: var(--ig-bg-secondary);
}

.ig-feature-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.ig-feature-item h3 {
    font-size: 15px;
    margin: 8px 0 4px;
}

.ig-feature-item p {
    font-size: 13px;
    color: var(--ig-text-muted);
    margin: 0;
}

/* === Promo Banner === */
.ig-promo-banner {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8C42 100%);
    color: white;
    padding: 14px 20px;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.ig-promo-banner strong {
    font-weight: 700;
}

.ig-promo-code {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    letter-spacing: 1px;
}

.ig-promo-ends {
    opacity: 0.8;
    font-size: 13px;
    margin-left: 8px;
}

/* === Vocabulary Page === */
.ig-vocab-page {
    min-height: 100vh;
}

.ig-vocab-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

/* Multi-status dropdown */
.ig-status-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: var(--ig-bg);
    border: 1px solid var(--ig-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    min-width: 160px;
    margin-top: 4px;
}

.ig-status-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    user-select: none;
}

.ig-status-option:hover {
    background: var(--ig-bg-secondary);
}

.ig-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 2px solid var(--ig-border);
    border-radius: 4px;
    font-size: 12px;
    color: transparent;
    transition: all 0.15s;
    flex-shrink: 0;
}

.ig-check-on {
    background: var(--ig-primary);
    border-color: var(--ig-primary);
    color: white;
}

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

.ig-vocab-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ig-text-muted);
    border-bottom: 2px solid var(--ig-border);
}

.ig-vocab-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--ig-border);
}

.ig-vocab-table tr:hover {
    background: var(--ig-bg-secondary);
}

.ig-pricing-highlight-row {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.06)) !important;
    border-left: 3px solid var(--ig-primary, #10B981);
}

.ig-pricing-highlight-row td {
    font-weight: 500;
}

.ig-theme-dark .ig-pricing-highlight-row {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.08)) !important;
}

.ig-vocab-word {
    font-weight: 600;
}

/* === Stats Page === */
.ig-stats-page {
    min-height: 100vh;
}

.ig-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.ig-stat-card {
    background: white;
    border: 1px solid var(--ig-border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.ig-stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--ig-primary);
    margin-bottom: 4px;
}

.ig-stat-label {
    font-size: 14px;
    color: var(--ig-text-muted);
}

/* === Charts === */
.ig-charts-container {
    margin-top: 32px;
    margin-bottom: 32px;
}

.ig-chart-card {
    background: white;
    border: 1px solid var(--ig-border);
    border-radius: 12px;
    padding: 20px;
    height: 320px;
}

.ig-chart-wide {
    margin-bottom: 20px;
}

.ig-chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .ig-chart-row {
        grid-template-columns: 1fr;
    }
    .ig-chart-card {
        height: 280px;
    }
}

/* === Heatmap === */
.ig-heatmap {
    display: grid;
    grid-template-columns: repeat(52, 1fr);
    gap: 2px;
}

.ig-heatmap-cell {
    aspect-ratio: 1;
    border-radius: 2px;
    background: #ebedf0;
}

.ig-heatmap-cell.level-1 { background: #c6e48b; }
.ig-heatmap-cell.level-2 { background: #7bc96f; }
.ig-heatmap-cell.level-3 { background: #239a3b; }
.ig-heatmap-cell.level-4 { background: #196127; }

/* === Pricing Page === */
.ig-pricing-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.ig-pricing-card {
    background: white;
    border: 2px solid var(--ig-primary);
    border-radius: 16px;
    padding: 40px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.ig-pricing-price {
    font-size: 48px;
    font-weight: 700;
    color: var(--ig-primary);
    margin: 16px 0;
}

.ig-pricing-features {
    list-style: none;
    padding: 0;
    text-align: left;
    margin: 24px 0;
}

.ig-pricing-features li {
    padding: 8px 0;
    font-size: 15px;
}

/* === Empty state === */
.ig-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--ig-text-muted);
}

.ig-empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.ig-empty-state h3 {
    color: var(--ig-text);
    margin-bottom: 8px;
}

/* === Font size control === */
.ig-font-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ig-font-control button {
    background: var(--ig-bg-secondary);
    border: 1px solid var(--ig-border);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 14px;
}

/* === Speed control === */
.ig-speed-select {
    padding: 4px 8px;
    border: 1px solid var(--ig-border);
    border-radius: 6px;
    font-size: 13px;
    background: white;
}

/* === Responsive === */
@media (max-width: 768px) {
    .ig-header {
        padding: 8px 12px;
    }

    .ig-main {
        padding: 16px;
    }

    .ig-content-grid {
        grid-template-columns: 1fr;
    }

    .ig-reader-content {
        padding: 20px 16px 100px;
        font-size: 16px;
        line-height: 2.6;
    }

    .ig-reader-title {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .ig-reader-tokens {
        line-height: 2.6;
    }

    .ig-audio-bar {
        gap: 8px;
        padding: 8px 12px;
    }

    .ig-audio-bar-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .ig-audio-bar-time {
        font-size: 11px;
        min-width: 70px;
    }

    /* YouTube mobile: fit everything in viewport */
    .ig-reader-content:has(.ig-yt-player-wrap) {
        padding: 12px 12px 16px;
        display: flex;
        flex-direction: column;
        min-height: calc(100dvh - 52px); /* subtract header */
        box-sizing: border-box;
    }

    .ig-reader-content:has(.ig-yt-player-wrap) .ig-reader-title {
        font-size: 15px;
        margin-bottom: 8px;
        line-height: 1.2;
    }

    .ig-yt-player-wrap {
        margin: 0 0 8px;
    }

    .ig-yt-player {
        border-radius: 8px;
    }

    /* Stack arrows below sentence on mobile */
    .ig-yt-sentence-nav {
        flex-direction: column;
        gap: 8px;
        margin: 8px 0 0;
        flex: 1;
        min-height: 0;
    }

    .ig-yt-sentence {
        flex: 1;
        padding: 14px 16px;
        font-size: 1.15em;
        line-height: 1.7;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
    }

    .ig-yt-sentence-nav .ig-yt-nav-btn {
        width: 100%;
        border-radius: 8px;
        height: 36px;
        font-size: 16px;
    }

    /* Put arrows in a row at the bottom */
    .ig-yt-sentence-nav {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr auto;
    }

    .ig-yt-sentence {
        grid-column: 1 / -1;
        grid-row: 1;
    }

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

    .ig-vocab-filters {
        flex-direction: column;
    }

    .ig-header-nav {
        display: none;
    }

    .ig-desktop-only {
        display: none !important;
    }

    .ig-mobile-only {
        display: flex !important;
    }

    .ig-features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ig-word-popup {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100vw !important;
        max-width: 100vw !important;
        border-radius: 16px 16px 0 0;
        max-height: 70vh;
        overflow-y: auto;
        box-sizing: border-box;
        margin: 0 !important;
    }
}

@media (max-width: 480px) {
    .ig-features-grid {
        grid-template-columns: 1fr;
    }

    .ig-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
 *  YouTube Player & Word Highlighting
 * ========================================================================= */

.ig-yt-player-wrap {
    margin: 0 0 20px;
}

.ig-yt-player {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}

.ig-yt-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Sentence navigation row */
.ig-yt-sentence-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0;
}

.ig-yt-nav-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 1px solid var(--ig-border, #e0e0e0);
    border-radius: 50%;
    background: var(--ig-bg-secondary, #f8f9fa);
    color: var(--ig-text, #333);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

.ig-yt-nav-btn:hover {
    background: var(--ig-primary, #6366f1);
    border-color: var(--ig-primary, #6366f1);
    color: #fff;
}

/* Current sentence display area */
.ig-yt-sentence {
    flex: 1;
    min-height: 60px;
    padding: 18px 24px;
    background: var(--ig-bg-secondary, #f8f9fa);
    border-radius: 12px;
    font-size: 1.3em;
    line-height: 1.8;
    text-align: center;
    transition: background 0.2s;
}

/* Multi-word selection highlight */
.ig-word-selected {
    outline: 2px solid var(--ig-primary, #6366f1);
    outline-offset: 1px;
    border-radius: 3px;
    background: rgba(99, 102, 241, 0.12) !important;
}
.ig-theme-dark .ig-word-selected {
    background: rgba(129, 140, 248, 0.2) !important;
}
.ig-theme-sepia .ig-word-selected {
    outline-color: #8b7355;
    background: rgba(139, 115, 85, 0.12) !important;
}

/* Currently-spoken word highlight */
.ig-yt-highlight {
    background: rgba(99, 102, 241, 0.25);
    border-radius: 3px;
    outline: 2px solid rgba(99, 102, 241, 0.5);
    outline-offset: 1px;
    transition: background 0.15s, outline 0.15s;
}

/* -- Dark theme overrides -- */
.ig-theme-dark .ig-yt-sentence {
    background: rgba(255, 255, 255, 0.06);
}
.ig-theme-dark .ig-yt-nav-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #e0e0e0;
}
.ig-theme-dark .ig-yt-highlight {
    background: rgba(129, 140, 248, 0.3);
    outline-color: rgba(129, 140, 248, 0.6);
}

/* -- Sepia theme overrides -- */
.ig-theme-sepia .ig-yt-sentence {
    background: rgba(139, 115, 85, 0.08);
}
.ig-theme-sepia .ig-yt-nav-btn {
    background: rgba(139, 115, 85, 0.06);
    border-color: rgba(139, 115, 85, 0.2);
    color: #5d4e37;
}
.ig-theme-sepia .ig-yt-highlight {
    background: rgba(139, 115, 85, 0.2);
    outline-color: rgba(139, 115, 85, 0.4);
}
