/* ═══════════════════════════════════════════════
   JSON 转 Excel — 双主题设计系统（亮/暗）
   ═══════════════════════════════════════════════ */

/* ── Light Theme (Default) ── */
:root {
    --bg-primary: #f0f2f7;
    --bg-secondary: #e8ebf2;
    --bg-card: rgba(255, 255, 255, 0.88);
    --bg-card-solid: #ffffff;
    --bg-input: #f5f7fb;
    --bg-hover: rgba(0, 0, 0, 0.03);

    --text-primary: #1e1e3a;
    --text-secondary: #555577;
    --text-muted: #8c8ca8;
    --text-bright: #0a0a1a;

    --accent-cyan: #0099cc;
    --accent-purple: #6920d0;
    --accent-gradient: linear-gradient(135deg, #00b4d8 0%, #7b2ff7 100%);
    --accent-gradient-h: linear-gradient(90deg, #00b4d8 0%, #7b2ff7 100%);

    --success: #0f9d58;
    --success-bg: rgba(15, 157, 88, 0.08);
    --warning: #e68a00;
    --error: #d93025;
    --error-bg: rgba(217, 48, 37, 0.06);

    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.13);
    --border-accent: rgba(0, 153, 204, 0.3);

    --radius: 12px;
    --radius-lg: 16px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 24px rgba(0, 153, 204, 0.12);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;

    /* Theme-specific tokens */
    --drop-border: rgba(0, 0, 0, 0.14);
    --drop-hover-border: rgba(0, 153, 204, 0.4);
    --toggle-track: rgba(0, 0, 0, 0.1);
    --slider-track: rgba(0, 0, 0, 0.08);
    --progress-track: rgba(0, 0, 0, 0.06);
    --table-header-bg: rgba(235, 240, 252, 1);
    --table-stripe-bg: rgba(0, 0, 0, 0.018);
    --table-hover-bg: rgba(0, 153, 204, 0.05);
    --scrollbar-track: rgba(0, 0, 0, 0.02);
    --scrollbar-thumb: rgba(0, 0, 0, 0.1);
    --scrollbar-thumb-hover: rgba(0, 0, 0, 0.18);
    --toast-error-bg: rgba(255, 240, 240, 0.97);
    --toast-error-border: rgba(217, 48, 37, 0.25);
    --toast-success-bg: rgba(235, 255, 245, 0.97);
    --toast-success-border: rgba(15, 157, 88, 0.25);
    --spinner-ring: rgba(0, 0, 0, 0.12);
    --spinner-arc: var(--accent-cyan);
    --logo-glow: rgba(0, 153, 204, 0.3);
    --bg-grad-1: rgba(0, 180, 216, 0.05);
    --bg-grad-2: rgba(123, 47, 247, 0.04);
    --bg-grad-3: rgba(0, 180, 216, 0.02);
    --grid-line: rgba(0, 0, 0, 0.025);
    --tab-active-color: #ffffff;
    --depth-badge-bg: rgba(0, 153, 204, 0.1);
    --format-active-bg: rgba(0, 153, 204, 0.06);
    --format-active-shadow: rgba(0, 153, 204, 0.1);
    --file-info-border: rgba(15, 157, 88, 0.2);
}

/* ── Dark Theme ── */
[data-theme="dark"] {
    --bg-primary: #0a0a1a;
    --bg-secondary: #0f0f23;
    --bg-card: rgba(18, 18, 42, 0.75);
    --bg-card-solid: #12122a;
    --bg-input: rgba(15, 15, 35, 0.9);
    --bg-hover: rgba(30, 30, 65, 0.6);

    --text-primary: #e4e4f0;
    --text-secondary: #9090b0;
    --text-muted: #5a5a80;
    --text-bright: #ffffff;

    --accent-cyan: #00d2ff;
    --accent-purple: #7b2ff7;
    --accent-gradient: linear-gradient(135deg, #00d2ff 0%, #7b2ff7 100%);
    --accent-gradient-h: linear-gradient(90deg, #00d2ff 0%, #7b2ff7 100%);

    --success: #00e676;
    --success-bg: rgba(0, 230, 118, 0.08);
    --warning: #ffab40;
    --error: #ff5252;
    --error-bg: rgba(255, 82, 82, 0.08);

    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(0, 210, 255, 0.25);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(0, 210, 255, 0.15);

    --drop-border: rgba(255, 255, 255, 0.1);
    --drop-hover-border: rgba(0, 210, 255, 0.3);
    --toggle-track: rgba(255, 255, 255, 0.08);
    --slider-track: rgba(255, 255, 255, 0.06);
    --progress-track: rgba(255, 255, 255, 0.06);
    --table-header-bg: rgba(43, 58, 103, 0.5);
    --table-stripe-bg: rgba(255, 255, 255, 0.015);
    --table-hover-bg: rgba(0, 210, 255, 0.03);
    --scrollbar-track: rgba(255, 255, 255, 0.02);
    --scrollbar-thumb: rgba(255, 255, 255, 0.1);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.15);
    --toast-error-bg: rgba(30, 10, 10, 0.95);
    --toast-error-border: rgba(255, 82, 82, 0.3);
    --toast-success-bg: rgba(10, 30, 15, 0.95);
    --toast-success-border: rgba(0, 230, 118, 0.3);
    --spinner-ring: rgba(255, 255, 255, 0.2);
    --spinner-arc: white;
    --logo-glow: rgba(0, 210, 255, 0.5);
    --bg-grad-1: rgba(0, 210, 255, 0.06);
    --bg-grad-2: rgba(123, 47, 247, 0.06);
    --bg-grad-3: rgba(0, 210, 255, 0.03);
    --grid-line: rgba(255, 255, 255, 0.015);
    --tab-active-color: #ffffff;
    --depth-badge-bg: rgba(0, 210, 255, 0.1);
    --format-active-bg: rgba(0, 210, 255, 0.06);
    --format-active-shadow: rgba(0, 210, 255, 0.08);
    --file-info-border: rgba(0, 230, 118, 0.15);
}

/* ── Reset & Base ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.4s ease, color 0.4s ease;
}

/* ── Background Decorations ── */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 800px 600px at 20% 10%, var(--bg-grad-1) 0%, transparent 60%),
        radial-gradient(ellipse 600px 500px at 80% 80%, var(--bg-grad-2) 0%, transparent 60%),
        radial-gradient(ellipse 400px 300px at 50% 50%, var(--bg-grad-3) 0%, transparent 60%);
    transition: background 0.4s ease;
}

.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* ── Container ── */
.container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

/* ── Header ── */
header {
    text-align: center;
    margin-bottom: 48px;
    position: relative;
}

.header-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 12px;
}

.logo-icon {
    font-size: 40px;
    filter: drop-shadow(0 0 12px var(--logo-glow));
    animation: float 3s ease-in-out infinite;
}

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

h1 {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-bright);
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 400;
    margin-top: 4px;
}

/* ── Feature Highlights ── */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 28px;
    text-align: left;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.feature-item:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.feature-icon {
    font-size: 22px;
    flex-shrink: 0;
    line-height: 1.2;
}

.feature-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 2px;
}

.feature-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ── Header Controls ── */
.header-top {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 16px;
}

.lang-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    min-width: 52px;
}

.lang-toggle:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ── Theme Toggle ── */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.theme-toggle-icon {
    font-size: 16px;
    line-height: 1;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle:hover .theme-toggle-icon {
    transform: rotate(30deg);
}

/* ── Section ── */
.section {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 20px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.section:hover {
    border-color: var(--border-hover);
}

.section-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Tab Switcher ── */
.tab-switcher {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.tab {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    background: var(--accent-gradient);
    color: var(--tab-active-color);
    box-shadow: 0 2px 12px rgba(0, 153, 204, 0.25);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* ── Drop Zone ── */
.drop-zone {
    border: 2px dashed var(--drop-border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.drop-zone:hover::before {
    opacity: 0.03;
}

.drop-zone.drag-over {
    border-color: var(--accent-cyan);
    border-style: solid;
    transform: scale(1.01);
}

.drop-zone.drag-over::before {
    opacity: 0.06;
}

.drop-zone-content {
    position: relative;
    z-index: 1;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.8;
}

.drop-zone p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 6px;
}

.file-label {
    color: var(--accent-cyan);
    cursor: pointer;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: var(--transition-fast);
}

.file-label:hover {
    color: var(--accent-purple);
}

.hint {
    color: var(--text-muted) !important;
    font-size: 12px !important;
}

/* ── File Info Bar ── */
.file-info {
    margin-top: 16px;
    padding: 14px 18px;
    background: var(--success-bg);
    border: 1px solid var(--file-info-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

.file-info-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

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

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

.file-info-size {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.file-info-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.file-info-remove:hover {
    color: var(--error);
    background: var(--error-bg);
}

/* ── Textarea (Paste) ── */
#json-input {
    width: 100%;
    min-height: 200px;
    max-height: 400px;
    padding: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    transition: var(--transition);
}

#json-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 153, 204, 0.1);
}

#json-input::placeholder {
    color: var(--text-muted);
}

.paste-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    min-height: 28px;
}

.paste-status {
    font-size: 12px;
    min-height: 18px;
    transition: var(--transition-fast);
}

.paste-status.valid {
    color: var(--success);
}

.paste-status.invalid {
    color: var(--error);
}

.btn-clear {
    padding: 4px 12px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.btn-clear:hover {
    color: var(--error);
    border-color: var(--error);
    background: var(--error-bg);
}

/* ── Settings ── */
.setting-group {
    margin-bottom: 24px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Format Cards */
.format-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.format-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 18px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.format-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.format-card.active {
    border-color: var(--accent-cyan);
    background: var(--format-active-bg);
    box-shadow: 0 0 20px var(--format-active-shadow);
}

.format-icon {
    font-size: 28px;
}

.format-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-bright);
}

.format-desc {
    font-size: 11px;
    color: var(--text-muted);
}

/* Toggle Grid */
.toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.toggle-item:hover {
    border-color: var(--border-hover);
}

.toggle-item input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--toggle-track);
    border-radius: 10px;
    flex-shrink: 0;
    transition: var(--transition);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-item input:checked + .toggle-switch {
    background: var(--accent-gradient);
}

.toggle-item input:checked + .toggle-switch::after {
    left: 19px;
    background: white;
}

.toggle-text {
    font-size: 13px;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.toggle-item input:checked ~ .toggle-text {
    color: var(--text-primary);
}

/* Slider (Depth Control) */
.slider-wrapper {
    position: relative;
}

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--slider-track);
    border-radius: 3px;
    outline: none;
    transition: var(--transition);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-gradient);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 153, 204, 0.3);
    transition: var(--transition);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 16px rgba(0, 153, 204, 0.5);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-cyan);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

#depth-value {
    display: inline-block;
    min-width: 32px;
    padding: 2px 8px;
    background: var(--depth-badge-bg);
    border-radius: 4px;
    color: var(--accent-cyan);
    font-weight: 600;
    font-size: 12px;
    text-align: center;
}

/* ── Action Bar ── */
.action-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

.btn-preview {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-preview:hover:not(:disabled) {
    border-color: var(--accent-cyan);
    background: var(--format-active-bg);
    box-shadow: var(--shadow-glow);
}

.btn-convert {
    flex: 2;
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 20px rgba(0, 153, 204, 0.2);
}

.btn-convert:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 28px rgba(0, 153, 204, 0.35);
}

.btn-convert:active:not(:disabled) {
    transform: translateY(0);
}

/* ── Progress ── */
.progress-section {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

.progress-bar {
    height: 6px;
    background: var(--progress-track);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient-h);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill.indeterminate {
    width: 30% !important;
    animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

.progress-text {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

/* ── Preview Table ── */
.sheet-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.sheet-tab {
    padding: 6px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.sheet-tab:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.sheet-tab.active {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: var(--format-active-bg);
}

.sheet-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* Custom Scrollbar */
.table-wrapper::-webkit-scrollbar {
    height: 6px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}

.preview-table th {
    padding: 10px 16px;
    background: var(--table-header-bg);
    color: var(--text-bright);
    font-weight: 600;
    font-size: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}

.preview-table td {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-table tr:hover td {
    background: var(--table-hover-bg);
    color: var(--text-primary);
}

.preview-table tr:nth-child(even) td {
    background: var(--table-stripe-bg);
}

.preview-table tr:nth-child(even):hover td {
    background: var(--table-hover-bg);
}

/* ── Download Section ── */
.download-card {
    text-align: center;
    padding: 20px 0;
}

.download-icon {
    font-size: 48px;
    margin-bottom: 12px;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.download-card h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--success);
    margin-bottom: 8px;
}

.download-card > p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.download-meta {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.download-meta-item {
    font-size: 13px;
    color: var(--text-muted);
}

.download-meta-item span {
    color: var(--text-primary);
    font-weight: 500;
}

.btn-download {
    background: var(--accent-gradient);
    color: white;
    padding: 16px 48px;
    font-size: 16px;
    box-shadow: 0 4px 20px rgba(0, 153, 204, 0.2);
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 153, 204, 0.35);
}

.download-expiry {
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.countdown {
    color: var(--warning);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    min-width: 280px;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.error {
    border-color: var(--toast-error-border);
    background: var(--toast-error-bg);
}

.toast.success {
    border-color: var(--toast-success-border);
    background: var(--toast-success-bg);
}

.toast.warning {
    border-color: #ff9800;
    background: var(--bg-card);
}

.toast-exit {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ── Modal ── */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: slideInUp 0.3s ease;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.modal h3 {
    color: var(--text-bright);
    font-size: 20px;
    margin-bottom: 12px;
}

.modal p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.6;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ── Footer ── */
footer {
    text-align: center;
    padding: 32px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.footer-links {
    margin-top: 8px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-fast);
}

.footer-links a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.footer-links .separator {
    margin: 0 8px;
    color: var(--border);
}

/* ── SEO Content Section ── */
.seo-content {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.8;
}

.seo-content h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.seo-content h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    margin-top: 20px;
}

.seo-content p {
    margin-bottom: 12px;
}

.seo-content ul {
    margin: 8px 0 12px 20px;
    padding: 0;
}

.seo-content li {
    margin-bottom: 4px;
}

.seo-content strong {
    color: var(--text-secondary);
    font-weight: 600;
}

.seo-content code {
    background: var(--bg-input);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .container {
        padding: 24px 16px 40px;
    }

    h1 {
        font-size: 26px;
    }

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

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

    .section {
        padding: 20px 16px;
    }

    .format-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .format-card {
        padding: 14px 8px;
    }

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

    .action-bar {
        flex-direction: column;
    }

    .btn-preview,
    .btn-convert {
        flex: none;
    }

    .drop-zone {
        padding: 32px 16px;
    }

    .toast-container {
        left: 16px;
        right: 16px;
    }

    .toast {
        min-width: auto;
    }
}

/* ── Loading Spinner ── */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--spinner-ring);
    border-top-color: var(--spinner-arc);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ── XLSX Options Animation ── */
.xlsx-options {
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    max-height: 500px;
    opacity: 1;
}

.xlsx-options.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0 !important;
    padding: 0;
}
