/* ============================================
   MexConverter - Main Stylesheet
   Copyright MexTech Limited | mextechltd.name.ng
   ============================================ */

:root {
    --bg-pure: #000000;
    --bg-surface: #0a0a0a;
    --bg-card: #0f0f0f;
    --bg-elevated: #161616;
    --bg-hover: #1c1c1c;
    --bg-active: #222222;

    --accent: #4a7c2f;
    --accent-light: #5c9939;
    --accent-dark: #3a6124;
    --accent-glow: rgba(74, 124, 47, 0.18);
    --accent-glow-strong: rgba(74, 124, 47, 0.32);

    --text-primary: #f0f0f0;
    --text-secondary: #999999;
    --text-muted: #555555;
    --text-accent: #6eba4a;

    --border: #1e1e1e;
    --border-accent: rgba(74, 124, 47, 0.4);
    --border-focus: rgba(74, 124, 47, 0.7);

    --danger: #c0392b;
    --danger-light: #e74c3c;
    --warning: #d68910;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-card: 0 4px 24px rgba(0,0,0,0.6);
    --shadow-elevated: 0 8px 40px rgba(0,0,0,0.7);
    --shadow-accent: 0 4px 20px rgba(74,124,47,0.25);

    --transition: 0.2s ease;

    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
}

/* ============================================
   HARD RESET — kill every browser default
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
    outline: none;                    /* kill default focus ring everywhere */
    -webkit-tap-highlight-color: transparent; /* kill mobile tap flash */
    -webkit-appearance: none;        /* kill all OS-chrome on inputs/buttons */
    appearance: none;
}

/* Custom text selection colour — no browser blue */
::selection {
    background: var(--accent-glow-strong);
    color: var(--text-accent);
}
::-moz-selection {
    background: var(--accent-glow-strong);
    color: var(--text-accent);
}

/* Custom scrollbar — no OS default */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }
* { scrollbar-width: thin; scrollbar-color: #2a2a2a var(--bg-surface); }

/* Kill browser tooltip — we use our own */
[title] { pointer-events: auto; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
    /* Prevent iOS from auto-zooming inputs */
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-pure);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    position: relative;
}

/* Links — kill browser blue + underline defaults */
a {
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

/* Buttons — kill all browser chrome */
button {
    font-family: var(--font-main);
    cursor: pointer;
    background: none;
    line-height: 1;
    -webkit-user-select: none;
    user-select: none;
}

/* Kill browser focus-visible blue ring on buttons/links */
button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

/* Inputs — kill all browser defaults */
input, textarea {
    font-family: var(--font-main);
    background: none;
    color: var(--text-primary);
    /* Kill browser validation styling */
    box-shadow: none;
}

/* Kill red/orange browser validation border */
input:invalid { box-shadow: none; outline: none; }
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-primary);
    -webkit-box-shadow: 0 0 0 1000px var(--bg-elevated) inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* Kill hidden file input's native OS dialog trigger styling */
input[type="file"] {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

/* ============================================
   CUSTOM TOOLTIP SYSTEM
   (replaces all [title] browser tooltips)
   ============================================ */
.tooltip-wrap {
    position: relative;
    display: inline-flex;
}

.tooltip-wrap .tooltip-text {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 9000;
    box-shadow: var(--shadow-elevated);
}

.tooltip-wrap:hover .tooltip-text {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---- Background grid ---- */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(74,124,47,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74,124,47,0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* ---- Layout ---- */
.container {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

/* ---- Header ---- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 780px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: var(--shadow-accent);
    flex-shrink: 0;
}

.logo-icon svg { width: 20px; height: 20px; }

.logo-name {
    display: block;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    line-height: 1.1;
}

.logo-tagline {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.quota-badge {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: var(--accent-glow);
    border: 1px solid var(--border-accent);
    padding: 7px 14px 8px;
    border-radius: var(--radius-sm);
    min-width: 148px;
    transition: border-color var(--transition), background var(--transition);
}

.quota-badge.quota-exhausted {
    background: rgba(192, 57, 43, 0.14);
    border-color: rgba(192, 57, 43, 0.5);
}

.quota-badge.quota-unknown {
    opacity: 0.5;
}

.quota-badge-inner {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-accent);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.quota-badge.quota-exhausted .quota-badge-inner {
    color: #e74c3c;
}

.quota-badge-inner svg { width: 12px; height: 12px; flex-shrink: 0; }

.quota-label { flex: 1; }

.quota-divider {
    width: 1px;
    height: 10px;
    background: var(--border-accent);
    flex-shrink: 0;
}

.quota-used {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 14px;
    text-align: right;
}

.quota-sep {
    color: var(--text-muted);
    font-size: 10px;
}

.quota-total {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 14px;
}

.quota-bar-wrap {
    width: 100%;
    height: 3px;
    background: var(--bg-elevated);
    border-radius: 100px;
    overflow: hidden;
}

.quota-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-light);
    border-radius: 100px;
    transition: width 0.5s ease, background 0.3s ease;
}

.quota-bar.quota-bar-warn { background: var(--warning); }
.quota-bar.quota-bar-full { background: var(--danger-light); }

/* ---- Main ---- */
.app-main {
    padding: 48px 0 80px;
    position: relative;
    z-index: 1;
}

/* ---- Hero ---- */
.hero-section {
    text-align: center;
    margin-bottom: 40px;
}

.hero-title {
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1.15;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.hero-title .accent {
    background: linear-gradient(135deg, #6eba4a, #4a7c2f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 460px;
    margin: 0 auto;
    line-height: 1.65;
}

/* ---- Card ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

/* ---- Tab Bar ---- */
.tab-bar {
    display: flex;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 6px;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    background: transparent;
    color: var(--text-secondary);
}

.tab-btn svg { width: 15px; height: 15px; }

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

.tab-btn.active {
    background: var(--accent-glow);
    border: 1px solid var(--border-accent);
    color: var(--text-accent);
}

/* ---- Tab Content ---- */
.tab-content { display: none; padding: 28px; }
.tab-content.active { display: block; }

/* ---- Drop Zone ---- */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-glow);
    box-shadow: inset 0 0 0 1px var(--border-accent);
}

.drop-zone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    gap: 10px;
    text-align: center;
    pointer-events: none; /* Let clicks fall through to drop-zone */
}

/* Re-enable pointer events on the browse button only */
.drop-zone-inner .btn { pointer-events: all; }

.drop-icon {
    width: 64px;
    height: 64px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-accent);
    margin-bottom: 8px;
    transition: all var(--transition);
}

.drop-icon svg { width: 28px; height: 28px; }

.drop-zone:hover .drop-icon,
.drop-zone.drag-over .drop-icon {
    background: var(--accent-glow);
    border-color: var(--border-accent);
    transform: translateY(-2px);
}

.drop-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.drop-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.drop-limit {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ---- URL Upload ---- */
.url-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
}

.url-icon-wrap {
    width: 60px;
    height: 60px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-accent);
}

.url-icon-wrap svg { width: 26px; height: 26px; }

.url-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.url-sub {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 380px;
}

.url-input-group {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 580px;
}

.url-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.url-input-wrap svg {
    position: absolute;
    left: 14px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.url-input-wrap input {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px 12px 42px;
    font-size: 13px;
    font-family: var(--font-mono);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
    /* Kill autofill/autocomplete chrome */
    -webkit-appearance: none;
    appearance: none;
}

.url-input-wrap input::placeholder {
    color: var(--text-muted);
    font-family: var(--font-main);
}

/* Custom focus ring — no browser blue */
.url-input-wrap input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Kill browser red invalid outline */
.url-input-wrap input:invalid {
    border-color: var(--border);
    box-shadow: none;
}

.url-hints {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.url-hints span {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-muted);
}

.url-hints svg { width: 12px; height: 12px; color: var(--accent); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    letter-spacing: 0.2px;
    text-decoration: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
}

.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    color: #fff;
    box-shadow: 0 2px 12px rgba(74,124,47,0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #69c440, #5c9939);
    box-shadow: 0 4px 20px rgba(74,124,47,0.45);
    transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

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

.btn-outline:hover {
    border-color: var(--border-accent);
    color: var(--text-accent);
    background: var(--accent-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover { background: var(--danger-light); }

.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
.btn-icon svg { width: 16px; height: 16px; }

.btn-loading { pointer-events: none; opacity: 0.7; }

/* ---- Queue Section ---- */
.queue-section, .results-section { margin-top: 32px; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.section-title svg { width: 16px; height: 16px; color: var(--text-accent); }

.queue-count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 3px 10px;
    border-radius: 100px;
    border: 1px solid var(--border);
}

/* ---- File Queue Item ---- */
.file-queue { display: flex; flex-direction: column; gap: 10px; }

.queue-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color var(--transition);
    animation: slideIn 0.25s ease;
}

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

.queue-file-icon {
    width: 44px;
    height: 44px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-accent);
    flex-shrink: 0;
}

.queue-file-icon svg { width: 20px; height: 20px; }

.queue-item-meta { flex: 1; min-width: 0; }

.queue-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

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

.queue-item-status {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 8px;
    min-width: 130px;
}

.progress-bar-wrap {
    width: 100%;
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 100px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 100px;
    transition: width 0.4s ease;
    width: 0%;
}

.status-text {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    align-self: flex-end;
}

.status-text.active { color: var(--text-accent); }
.status-text.done   { color: #5cb85c; }
.status-text.error  { color: var(--danger-light); }

/* ---- Results ---- */
.results-list { display: flex; flex-direction: column; gap: 10px; }

.result-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    animation: slideIn 0.25s ease;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.result-item:hover {
    border-color: var(--border-accent);
    box-shadow: 0 0 0 1px var(--accent-glow);
}

.result-item-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, rgba(74,124,47,0.2), rgba(74,124,47,0.08));
    border: 1px solid var(--border-accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-accent);
    flex-shrink: 0;
}

.result-item-icon svg { width: 20px; height: 20px; }

.result-item-meta { flex: 1; min-width: 0; }

.result-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.result-item-info { font-size: 11px; color: var(--text-muted); }
.result-item-info span { color: var(--accent); font-weight: 500; }

.result-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-copy {
    color: var(--text-muted);
    padding: 3px;
    border-radius: 4px;
    transition: color var(--transition), background var(--transition);
    display: flex;
    flex-shrink: 0;
}

.btn-copy:hover { color: var(--text-accent); background: var(--accent-glow); }
.btn-copy.copied { color: #5cb85c; }
.btn-copy svg { width: 14px; height: 14px; }

/* ---- Expiry Tag ---- */
.expiry-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 100px;
    margin-top: 4px;
}

.expiry-tag svg { width: 10px; height: 10px; }

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    min-width: 240px;
    max-width: 360px;
    box-shadow: var(--shadow-elevated);
    animation: toastIn 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    pointer-events: all;
}

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

.toast.fadeout { animation: toastOut 0.3s ease forwards; }

@keyframes toastOut {
    to { opacity: 0; transform: translateX(20px); }
}

.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast-success { border-left: 3px solid #5cb85c; }
.toast-success svg { color: #5cb85c; }
.toast-error { border-left: 3px solid var(--danger-light); }
.toast-error svg { color: var(--danger-light); }
.toast-info { border-left: 3px solid var(--accent); }
.toast-info svg { color: var(--accent); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-warning svg { color: var(--warning); }

/* ---- Spinner ---- */
.spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
    display: inline-block;
}

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

/* ============================================
   CUSTOM MODAL — zero browser chrome
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px;
    /* Hidden by default via CSS class, not inline style */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.is-open {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-elevated);
    transform: scale(0.94) translateY(8px);
    transition: transform 0.25s ease;
}

.modal-overlay.is-open .modal-card {
    transform: scale(1) translateY(0);
}

.modal-icon {
    width: 56px;
    height: 56px;
    background: rgba(192, 57, 43, 0.12);
    border: 1px solid rgba(192,57,43,0.3);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--danger-light);
    margin: 0 auto 20px;
}

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

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

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

.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-actions .btn { min-width: 100px; }

/* ---- Footer ---- */
.app-footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border);
    padding: 24px 20px;
}

.footer-inner {
    max-width: 780px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-inner p { font-size: 12px; color: var(--text-muted); }

.footer-inner a {
    color: var(--text-accent);
    font-weight: 500;
}

.footer-inner a:hover { text-decoration: underline; }
.footer-note { font-size: 11px !important; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .app-main { padding: 28px 0 60px; }
    .hero-section { margin-bottom: 24px; }
    .tab-content { padding: 20px 16px; }
    .drop-zone-inner { padding: 36px 16px; }
    .url-input-group { flex-direction: column; }
    .url-input-wrap input { font-size: 16px; } /* 16px prevents iOS zoom */
    .result-item { flex-wrap: wrap; }
    .result-actions { width: 100%; justify-content: flex-start; }
    .download-link-area { max-width: none; flex: 1; }
    .toast-container { bottom: 16px; right: 12px; left: 12px; }
    .toast { min-width: unset; }
    .queue-item-status { min-width: 90px; }
}

@media (max-width: 400px) {
    .quota-label, .quota-divider, .quota-sep, .quota-total { display: none; }
    .quota-badge { min-width: 60px; }
    .tab-btn span { display: none; }
    .tab-btn { padding: 10px; }
    .result-actions { flex-wrap: wrap; }
}

/* ============================================
   SIDEBAR
   ============================================ */

/* Prevent body scroll when sidebar open */
body.sidebar-open { overflow: hidden; }

/* Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
}
.sidebar-overlay.is-open { opacity: 1; pointer-events: all; }

/* Sidebar panel */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 280px;
    max-width: 82vw;
    z-index: 300;
    background: #0a0a0a;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 4px 0 40px rgba(0,0,0,0.7);
    overflow: hidden;
}
.sidebar.is-open { transform: translateX(0); }

/* Sidebar header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo .logo-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.sidebar-logo .logo-icon svg { width: 17px; height: 17px; }
.sidebar-logo .logo-name    { display: block; font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar-logo .logo-tagline { display: block; font-size: 10px; color: var(--text-muted); font-weight: 400; }

.sidebar-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}
.sidebar-close:hover { background: var(--bg-elevated); color: var(--text-primary); }
.sidebar-close svg { width: 17px; height: 17px; }

/* Sidebar nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 8px 8px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.sidebar-item:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.sidebar-item.active {
    background: var(--accent-glow);
    color: var(--text-accent);
    border: 1px solid var(--border-accent);
}

.sidebar-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all var(--transition);
}
.sidebar-item.active .sidebar-item-icon {
    background: var(--accent-glow);
    border-color: var(--border-accent);
    color: var(--text-accent);
}
.sidebar-item-icon svg { width: 15px; height: 15px; }

/* Audiomack icon colours */
.sidebar-am { border-color: rgba(255,130,0,0.3) !important; }
.sidebar-item:hover .sidebar-am,
.sidebar-item.active .sidebar-am {
    background: rgba(255,130,0,0.15) !important;
    border-color: rgba(255,130,0,0.4) !important;
    color: #ff8200 !important;
}

/* Spotify icon colours */
.sidebar-sp { border-color: rgba(30,215,96,0.3) !important; }
.sidebar-item:hover .sidebar-sp,
.sidebar-item.active .sidebar-sp {
    background: rgba(30,215,96,0.12) !important;
    border-color: rgba(30,215,96,0.4) !important;
    color: #1ed760 !important;
}

.sidebar-item-label { flex: 1; }

.sidebar-item-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-active);
    color: var(--text-muted);
    letter-spacing: 0.5px;
}
.sidebar-item.active .sidebar-item-badge {
    background: var(--accent-glow);
    color: var(--text-accent);
}
.sidebar-badge-am { background: rgba(255,130,0,0.12) !important; color: #ff8200 !important; }
.sidebar-badge-sp { background: rgba(30,215,96,0.10) !important; color: #1ed760 !important; }

/* Sidebar quota widget */
.sidebar-quota {
    margin: 12px 0 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-quota-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}
.sidebar-quota-row svg { width: 13px; height: 13px; color: var(--text-accent); flex-shrink: 0; }
.sidebar-quota-row span:first-of-type { flex: 1; }
.sidebar-quota-nums { font-family: var(--font-mono); font-size: 11px; color: var(--text-primary); font-weight: 700; }

.sidebar-quota-bar-wrap {
    height: 3px;
    background: var(--bg-active);
    border-radius: 100px;
    overflow: hidden;
}
.sidebar-quota-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-light);
    border-radius: 100px;
    transition: width 0.5s ease, background 0.3s ease;
}
.sidebar-quota-bar.quota-bar-warn { background: var(--warning); }
.sidebar-quota-bar.quota-bar-full { background: var(--danger-light); }

.sidebar-quota-note { font-size: 10px; color: var(--text-muted); }

/* Sidebar footer */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-footer p { font-size: 10px; color: var(--text-muted); line-height: 1.6; }
.sidebar-footer a { color: var(--text-accent); }
.sidebar-footer a:hover { text-decoration: underline; }

/* ============================================
   HAMBURGER BUTTON
   ============================================ */
.hamburger {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}
.hamburger:hover { background: var(--bg-elevated); color: var(--text-primary); }
.hamburger svg { width: 20px; height: 20px; }

/* Header left group */
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================================
   PAGE SYSTEM
   ============================================ */
.page { display: none; }
.page.active { display: block; }

/* ============================================
   PLATFORM PAGES (Audiomack / Spotify)
   ============================================ */

/* Hero platform icon */
.platform-hero-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}
.platform-hero-icon svg { width: 32px; height: 32px; }

.platform-hero-am {
    background: rgba(255,130,0,0.15);
    border: 1px solid rgba(255,130,0,0.3);
    color: #ff8200;
}
.platform-hero-sp {
    background: rgba(30,215,96,0.12);
    border: 1px solid rgba(30,215,96,0.3);
    color: #1ed760;
}

/* Accent colours per platform */
.accent-am {
    background: linear-gradient(135deg, #ff8200, #ff5500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.accent-sp {
    background: linear-gradient(135deg, #1ed760, #17a84a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Platform input section */
.platform-input-section {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
}

.platform-input-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    max-width: 600px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.platform-input-wrap:focus-within {
    box-shadow: 0 0 0 2px var(--border-accent);
}

.platform-input-wrap svg {
    width: 18px;
    height: 18px;
    margin-left: 14px;
    flex-shrink: 0;
    color: var(--text-muted);
}

.platform-input-wrap input {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    padding: 13px 14px 13px 10px;
    font-size: 13px;
    font-family: var(--font-mono);
    color: var(--text-primary);
}
.platform-input-wrap input::placeholder { color: var(--text-muted); font-family: var(--font-main); }
.platform-input-wrap input:focus { border-color: var(--border-focus); outline: none; box-shadow: none; }

.platform-input-wrap .btn {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    flex-shrink: 0;
    height: 100%;
    padding: 13px 20px;
}

/* Platform focus rings */
.platform-input-am:focus-within { box-shadow: 0 0 0 2px rgba(255,130,0,0.35); }
.platform-input-sp:focus-within { box-shadow: 0 0 0 2px rgba(30,215,96,0.25); }

/* Platform buttons */
.btn-am {
    background: linear-gradient(135deg, #ff8200, #e06000);
    color: #fff;
    box-shadow: 0 2px 12px rgba(255,130,0,0.3);
}
.btn-am:hover {
    background: linear-gradient(135deg, #ff9500, #ff7000);
    box-shadow: 0 4px 20px rgba(255,130,0,0.45);
    transform: translateY(-1px);
}
.btn-am:active { transform: translateY(0); }

.btn-sp {
    background: linear-gradient(135deg, #1ed760, #17a84a);
    color: #000;
    font-weight: 700;
    box-shadow: 0 2px 12px rgba(30,215,96,0.25);
}
.btn-sp:hover {
    background: linear-gradient(135deg, #25e868, #1dc455);
    box-shadow: 0 4px 20px rgba(30,215,96,0.4);
    transform: translateY(-1px);
}
.btn-sp:active { transform: translateY(0); }

/* Platform hints */
.platform-hints {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}
.platform-hints span {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-muted);
}
.platform-hints svg { width: 12px; height: 12px; color: var(--accent); }

/* ============================================
   RESPONSIVE UPDATES
   ============================================ */
@media (max-width: 600px) {
    .platform-input-section { padding: 20px 16px; }
    .platform-input-wrap { flex-direction: column; border-radius: var(--radius-sm); overflow: visible; }
    .platform-input-wrap svg { display: none; }
    .platform-input-wrap input {
        border-radius: var(--radius-sm) !important;
        border-right: 1px solid var(--border) !important;
        font-size: 16px; /* prevent iOS zoom */
        width: 100%;
    }
    .platform-input-wrap .btn {
        border-radius: var(--radius-sm) !important;
        width: 100%;
        justify-content: center;
    }
    .sidebar { width: 270px; }
}

@media (max-width: 400px) {
    .quota-label, .quota-divider, .quota-sep, .quota-total { display: none; }
    .quota-badge { min-width: 60px; }
    .tab-btn span { display: none; }
    .tab-btn { padding: 10px; }
    .result-actions { flex-wrap: wrap; }
}

/* ============================================
   Download progress row (inside result cards)
   ============================================ */
.dl-progress-row {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    width: 100%;
    grid-column: 1 / -1;
}
.dl-progress-bar-wrap {
    flex: 1;
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 100px;
    overflow: hidden;
}
.dl-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 100px;
    width: 0%;
    transition: width 0.25s ease;
}
.dl-progress-info {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 160px;
    text-align: right;
}

/* result-item: make it a grid so dl-progress-row spans full width */
.result-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 0 14px;
    flex-wrap: wrap;
}
.result-item-icon { grid-column: 1; grid-row: 1; }
.result-item-meta { grid-column: 2; grid-row: 1; }
.result-actions   { grid-column: 3; grid-row: 1; }
.dl-progress-row  { grid-column: 1 / -1; grid-row: 2; }

/* Progress bar colours */
.prog-error { background: var(--danger) !important; }
.prog-done  { background: var(--accent-light) !important; }

/* btn downloading state */
.btn.downloading { opacity: 0.85; pointer-events: none; }

/* Sidebar user card */
.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 12px 8px;
    padding: 11px 13px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.sidebar-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-uname  { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-uemail { display: block; font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Sidebar link item (anchor) */
.sidebar-item-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px; font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
    margin-bottom: 2px;
}
.sidebar-item-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-item-link .sidebar-item-icon { display: flex; align-items: center; }
.sidebar-item-link svg { width: 17px; height: 17px; }

/* Sidebar logout button */
.sidebar-logout {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px; font-weight: 500;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}
.sidebar-logout:hover { background: rgba(192,57,43,0.1); color: #e74c3c; }
.sidebar-logout svg { width: 17px; height: 17px; }

/* ── Real brand logos (Audiomack / Spotify) ─────────────────────── */

/* Hero icon: fill the 72px container */
.platform-hero-icon svg {
    width: 48px;
    height: 48px;
}

/* Sidebar logo icons: override generic 15px sizing */
.sidebar-logo-icon svg {
    width: 20px !important;
    height: 20px !important;
}
/* Remove the coloured border treatment on sidebar when it's a real logo */
.sidebar-logo-icon {
    background: transparent !important;
    border-color: transparent !important;
    padding: 0 !important;
}

/* Input prefix logo wrapper */
.platform-input-logo {
    display: flex;
    align-items: center;
    margin-left: 14px;
    flex-shrink: 0;
}
.platform-input-logo svg {
    width: 22px;
    height: 22px;
}

/* Hide the real logo on mobile (matches existing svg { display:none } rule) */
@media (max-width: 600px) {
    .platform-input-logo { display: none; }
}

/* ── Logo click to reload ───────────────────────────────────────── */
a.sidebar-logo,
a.logo {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: inherit;
}
a.sidebar-logo:hover .logo-icon,
a.logo:hover .logo-icon {
    opacity: 0.85;
    transform: scale(0.96);
    transition: opacity 0.15s, transform 0.15s;
}

/* ════════════════════════════════════════════════════════════════
   HEADER AVATAR
   ════════════════════════════════════════════════════════════════ */
.header-avatar {
    display: flex;
    align-items: center;
    text-decoration: none;
    margin-left: 10px;
    flex-shrink: 0;
}

.avatar-circle {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .03em;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 0 0 2px rgba(255,255,255,.06);
}

.avatar-circle:hover {
    transform: scale(1.08);
    box-shadow: 0 0 0 2px rgba(92,153,57,.5);
}

/* ════════════════════════════════════════════════════════════════
   BOTTOM NAV
   ════════════════════════════════════════════════════════════════ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 110;
    display: flex;
    align-items: stretch;
    background: rgba(10,12,10,0.92);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-top: 1px solid rgba(255,255,255,.06);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(62px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: #4a5e42;
    font-family: inherit;
    text-decoration: none;
    padding: 8px 4px 6px;
    transition: color .18s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 32px;
    height: 2px;
    border-radius: 0 0 3px 3px;
    background: #5c9939;
    transition: transform .22s cubic-bezier(.34,1.56,.64,1);
}

.bottom-nav-item.active {
    color: #7ec854;
}

.bottom-nav-item.active::before {
    transform: translateX(-50%) scaleX(1);
}

.bnav-icon-wrap {
    position: relative;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    transition: background .18s, transform .18s;
}

.bottom-nav-item.active .bnav-icon-wrap {
    background: rgba(92,153,57,.15);
    transform: translateY(-2px);
}

.bottom-nav-item:active .bnav-icon-wrap {
    transform: scale(.88);
}

.bnav-icon {
    width: 20px;
    height: 20px;
    transition: transform .18s;
}

.bnav-svg {
    width: 20px;
    height: 20px;
}

.bnav-label {
    font-size: .6rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    transition: color .18s;
    line-height: 1;
}

/* Avatar in bottom nav */
.bnav-avatar {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .58rem;
    font-weight: 700;
    color: #fff;
    transition: transform .18s, box-shadow .18s;
    box-shadow: 0 0 0 1.5px rgba(255,255,255,.1);
}

.bottom-nav-item.active .bnav-avatar,
.bottom-nav-item:hover .bnav-avatar {
    box-shadow: 0 0 0 2px rgba(92,153,57,.5);
}

/* Push page content up so bottom nav doesn't overlap */
.app-main {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
}

.app-footer {
    margin-bottom: calc(62px + env(safe-area-inset-bottom, 0px));
}

/* Desktop — hide bottom nav on wide screens */
@media (min-width: 768px) {
    .bottom-nav { display: none; }
    .app-main   { padding-bottom: 80px !important; }
    .app-footer { margin-bottom: 0; }
}

/* Audiomack active colour */
#bnav-audiomack.active { color: #FF8200; }
#bnav-audiomack.active .bnav-icon-wrap { background: rgba(255,130,0,.12); }
#bnav-audiomack.active::before { background: #FF8200; }

/* Spotify active colour */
#bnav-spotify.active { color: #1ED760; }
#bnav-spotify.active .bnav-icon-wrap { background: rgba(30,215,96,.1); }
#bnav-spotify.active::before { background: #1ED760; }
