/* ============================================================
   convert.tuxxin.com — Converter CSS
   Tuxxin brand: #d35400 orange / #2c3e50 dark / #ecf0f1 light
   ============================================================ */

:root {
    --tc-orange:       #d35400;
    --tc-orange-hover: #b94600;
    --tc-orange-light: rgba(211, 84, 0, 0.10);
    --tc-dark:         #2c3e50;
    --tc-dark-hover:   #243342;
    --tc-light:        #ecf0f1;
    --tc-light-2:      #f5f6fa;
    --tc-white:        #ffffff;
    --tc-text:         #333333;
    --tc-muted:        #6c757d;
    --tc-border:       #dee2e6;
    --tc-success:      #27ae60;
    --tc-danger:       #e74c3c;
    --tc-warning:      #f39c12;
    --tc-radius:       10px;
    --tc-radius-lg:    16px;
    --tc-shadow:       0 4px 24px rgba(0, 0, 0, 0.08);
    --tc-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.14);
    --font-base:       "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    --transition:      all 0.25s ease;
}

/* ── Alpine.js cloak — hide until Alpine initialises ────────── */
[x-cloak] { display: none !important; }

/* ── Base ────────────────────────────────────────────────────── */

body {
    font-family: var(--font-base);
    color: var(--tc-text);
    background: var(--tc-light-2);
}

/* ── Navbar ──────────────────────────────────────────────────── */

.navbar {
    background: var(--tc-dark) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.navbar-brand img {
    filter: brightness(1.1);
}

.nav-link {
    color: rgba(255, 255, 255, 0.82) !important;
    transition: color 0.2s ease;
    font-size: 0.92rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--tc-orange) !important;
}

/* ── Token Ticker (floating top-right) ───────────────────────── */

.token-ticker {
    position: fixed;
    top: 68px; /* just below navbar */
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(44, 62, 80, 0.96);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    padding: 0.3rem 0.85rem 0.3rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    z-index: 1050;
    box-shadow: 0 2px 14px rgba(0,0,0,0.25);
    transition: background 0.3s ease, border-color 0.3s ease;
    white-space: nowrap;
}

.token-ticker.warn {
    background: rgba(211, 84, 0, 0.95);
    border-color: rgba(255,255,255,0.18);
}

.token-ticker.blocked {
    background: rgba(192, 57, 43, 0.97);
    border-color: rgba(255,255,255,0.18);
}

.token-ticker-bar {
    width: 48px;
    height: 5px;
    background: rgba(255,255,255,0.22);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.token-ticker-bar-fill {
    height: 100%;
    background: rgba(255,255,255,0.85);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.token-ticker-blocked .token-ticker-bar-fill {
    background: #ff8a80;
}

.token-ticker-next {
    color: rgba(255,255,255,0.75);
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 576px) {
    .token-ticker {
        top: auto;
        bottom: 1rem;
        right: 1rem;
        font-size: 0.74rem;
    }
}

/* ── Hero / Intro ────────────────────────────────────────────── */

.converter-hero {
    text-align: center;
    padding: 2.5rem 1rem 1.5rem;
}

.converter-hero h1 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    color: var(--tc-dark);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.converter-hero h1 span {
    color: var(--tc-orange);
}

.converter-hero p {
    color: var(--tc-muted);
    font-size: 1rem;
    max-width: 560px;
    margin: 0 auto;
}

.converter-stat {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--tc-muted);
    opacity: 0.8;
}

.converter-stat strong {
    color: var(--tc-orange);
    font-weight: 700;
}

/* ── Format Selector ─────────────────────────────────────────── */

.format-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin: 1.5rem 0;
}

.format-pill {
    padding: 0.45rem 1.1rem;
    border-radius: 50px;
    border: 2px solid #999999; /* min 3:1 contrast on white for non-text UI */
    background: var(--tc-white);
    color: var(--tc-text);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.format-pill:hover {
    border-color: var(--tc-orange);
    color: var(--tc-orange);
}

.format-pill.active {
    background: var(--tc-orange);
    border-color: var(--tc-orange);
    color: var(--tc-white);
    box-shadow: 0 2px 10px rgba(211, 84, 0, 0.35);
}

/* ── Optimize Toggle ─────────────────────────────────────────── */
.optimize-toggle-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 0 0 1.1rem;
    padding: 0.6rem 1.25rem;
    border-radius: 50px;
    background: var(--tc-light);
    border: 2px solid var(--tc-border);
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
    transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.optimize-toggle-wrap.active {
    background: rgba(211, 84, 0, 0.08);
    border-color: var(--tc-orange);
    box-shadow: 0 0 0 3px rgba(211, 84, 0, 0.15);
}
.optimize-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    user-select: none;
}
.optimize-toggle-text {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--tc-dark);
}

/* Custom toggle switch */
.optimize-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.optimize-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.optimize-switch-track {
    position: absolute;
    inset: 0;
    border-radius: 24px;
    background: #ccc;
    cursor: pointer;
    transition: background 0.22s;
}
.optimize-switch-track::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: transform 0.22s, box-shadow 0.22s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.optimize-switch input:checked + .optimize-switch-track {
    background: var(--tc-orange);
}
.optimize-switch input:checked + .optimize-switch-track::before {
    transform: translateX(20px);
}
.optimize-switch input:focus-visible + .optimize-switch-track {
    outline: 2px solid var(--tc-orange);
    outline-offset: 2px;
}

.optimize-info-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #adb5bd;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: help;
    flex-shrink: 0;
    line-height: 1;
}
.optimize-cost-note {
    font-size: 0.82rem;
    color: var(--tc-orange);
    font-weight: 700;
    white-space: nowrap;
}

/* ── Drop Zone ───────────────────────────────────────────────── */

.drop-zone {
    border: 2.5px dashed var(--tc-border);
    border-radius: var(--tc-radius-lg);
    background: var(--tc-white);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--tc-orange);
    background: var(--tc-orange-light);
    box-shadow: 0 0 0 4px rgba(211, 84, 0, 0.12);
}

.drop-zone-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    display: block;
    opacity: 0.6;
    transition: var(--transition);
}

.drop-zone:hover .drop-zone-icon,
.drop-zone.drag-over .drop-zone-icon {
    opacity: 1;
    transform: scale(1.1);
}

.drop-zone-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--tc-dark);
    margin-bottom: 0.35rem;
}

.drop-zone-sub {
    font-size: 0.85rem;
    color: var(--tc-muted);
}

.drop-zone-sub strong {
    color: var(--tc-orange);
}

.drop-zone-formats {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    justify-content: center;
}

.format-badge {
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    background: var(--tc-light);
    color: var(--tc-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ── File List ───────────────────────────────────────────────── */

.file-grid {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 1rem;
}

.file-card {
    background: var(--tc-white);
    border-radius: var(--tc-radius);
    border-left: 3px solid var(--tc-orange);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 0.45rem 0.75rem 0.45rem 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    position: relative;
    transition: box-shadow 0.2s ease;
    min-height: 44px;
}

.file-card:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.10);
}

.file-card-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--tc-light);
    flex-shrink: 0;
}

.file-card-thumb-placeholder {
    width: 36px;
    height: 36px;
    background: var(--tc-light);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--tc-muted);
    flex-shrink: 0;
}

.file-card-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--tc-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.file-card-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.file-card-size {
    font-size: 0.72rem;
    color: var(--tc-muted);
    white-space: nowrap;
}

.file-card-ext {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: var(--tc-light);
    color: var(--tc-muted);
    white-space: nowrap;
}

.file-card-status {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    flex-shrink: 0;
    min-width: 70px;
    justify-content: flex-end;
}

.file-card-remove {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.07);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--tc-muted);
    transition: var(--transition);
    line-height: 1;
    flex-shrink: 0;
}

.file-card-remove:hover {
    background: var(--tc-danger);
    color: white;
}

/* Upload progress bar (full-width, under the row) */
.card-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--tc-light);
    border-radius: 0 0 var(--tc-radius) var(--tc-radius);
    overflow: hidden;
}

/* Status colours */
.status-uploading { color: var(--tc-warning); }
.status-done      { color: var(--tc-success); }
.status-error     { color: var(--tc-danger); }

.card-progress-bar {
    height: 100%;
    background: var(--tc-orange);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ── Convert Button ──────────────────────────────────────────── */

.convert-btn-wrap {
    margin-top: 2rem;
    text-align: center;
}

.btn-convert {
    background: var(--tc-orange);
    color: var(--tc-white);
    border: none;
    border-radius: 50px;
    padding: 0.9rem 3rem;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 18px rgba(211, 84, 0, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.btn-convert:hover:not(:disabled) {
    background: var(--tc-orange-hover);
    box-shadow: 0 6px 24px rgba(211, 84, 0, 0.55);
    transform: translateY(-1px);
}

.btn-convert:disabled {
    background: var(--tc-muted);
    border-color: var(--tc-muted);
    opacity: 1;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* ── Progress Modal ──────────────────────────────────────────── */

.progress-modal .modal-content {
    border: none;
    border-radius: var(--tc-radius-lg);
    box-shadow: 0 16px 60px rgba(0, 0, 0, 0.2);
}

.progress-modal .modal-header {
    background: var(--tc-dark);
    color: white;
    border-radius: var(--tc-radius-lg) var(--tc-radius-lg) 0 0;
    border-bottom: none;
}

.progress-track {
    height: 12px;
    background: var(--tc-light);
    border-radius: 50px;
    overflow: hidden;
    margin: 1rem 0;
}

#progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--tc-orange), #e67e22);
    border-radius: 50px;
    width: 0%;
    transition: width 0.3s ease;
}

.file-progress-list {
    max-height: 200px;
    overflow-y: auto;
    list-style: none;
    padding: 0;
    margin: 0;
}

.file-progress-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0;
    font-size: 0.87rem;
    border-bottom: 1px solid var(--tc-light);
    color: var(--tc-muted);
}

.file-progress-item.done {
    color: var(--tc-success);
}

.file-progress-item.active {
    color: var(--tc-orange);
    font-weight: 600;
}

.file-progress-item.error {
    color: var(--tc-danger);
}

/* ── Download Section ────────────────────────────────────────── */

.download-section {
    background: var(--tc-white);
    border-radius: var(--tc-radius-lg);
    border-top: 4px solid var(--tc-success);
    box-shadow: var(--tc-shadow);
    padding: 2rem;
    text-align: center;
    margin-top: 2rem;
}

.download-section h3 {
    color: var(--tc-dark);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.btn-download {
    background: var(--tc-success);
    color: var(--tc-white);
    border: none;
    border-radius: 50px;
    padding: 0.85rem 2.5rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(39, 174, 96, 0.4);
}

.btn-download:hover {
    background: #219a52;
    box-shadow: 0 6px 22px rgba(39, 174, 96, 0.55);
    transform: translateY(-1px);
    color: white;
}

.btn-convert-more {
    margin-top: 0.75rem;
    background: none;
    border: 2px solid var(--tc-border);
    border-radius: 50px;
    padding: 0.6rem 1.8rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--tc-muted);
    transition: var(--transition);
}

.btn-convert-more:hover {
    border-color: var(--tc-orange);
    color: var(--tc-orange);
}

/* ── Spinner ─────────────────────────────────────────────────── */

.tc-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(211, 84, 0, 0.25);
    border-top-color: var(--tc-orange);
    border-radius: 50%;
    animation: tc-spin 0.7s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}

.tc-spinner.white {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: white;
}

@keyframes tc-spin {
    to { transform: rotate(360deg); }
}

/* ── Toast Notification ──────────────────────────────────────── */

.tc-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.tc-toast {
    background: var(--tc-dark);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--tc-radius);
    font-size: 0.9rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    max-width: 360px;
    pointer-events: auto;
    border-left: 4px solid var(--tc-orange);
}

.tc-toast.success { border-left-color: var(--tc-success); }
.tc-toast.error   { border-left-color: var(--tc-danger); }
.tc-toast.warning { border-left-color: var(--tc-warning); }

/* ── File count badge ────────────────────────────────────────── */

.file-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--tc-dark);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    margin-top: 0.75rem;
}

/* ── Social share ────────────────────────────────────────────── */

.tc-social-share {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0.5rem;
}

.tc-social-share span {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tc-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.85rem;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.75);
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
}

.tc-share-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
}

.tc-share-btn.copied {
    border-color: var(--tc-success);
    color: #7debb0;
}

/* ── Footer ──────────────────────────────────────────────────── */

footer {
    margin-top: 3rem;
    background: var(--tc-dark) !important;
}

footer a {
    color: rgba(255, 255, 255, 0.65);
    transition: color 0.2s ease;
}

footer a:hover {
    color: var(--tc-orange);
}

/* ── Admin ───────────────────────────────────────────────────── */

.admin-stat-card {
    background: var(--tc-white);
    border-radius: var(--tc-radius);
    border-top: 3px solid var(--tc-orange);
    box-shadow: var(--tc-shadow);
    padding: 1.5rem;
    text-align: center;
}

.admin-stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--tc-dark);
}

.admin-stat-card .stat-label {
    font-size: 0.82rem;
    color: var(--tc-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-top: 0.25rem;
}

.admin-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 80px;
    padding: 0 0.5rem;
}

.admin-bar {
    flex: 1;
    background: var(--tc-orange);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    position: relative;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.admin-bar:hover {
    opacity: 1;
}

.admin-bar-label {
    position: absolute;
    bottom: -1.3rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: var(--tc-muted);
    white-space: nowrap;
}

/* ── Utilities ───────────────────────────────────────────────── */

.text-orange { color: var(--tc-orange) !important; }
.bg-tc-dark  { background: var(--tc-dark) !important; }
.btn-tc-orange {
    background: var(--tc-orange);
    color: white;
    border: none;
}
.btn-tc-orange:hover {
    background: var(--tc-orange-hover);
    color: white;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 576px) {
    .converter-hero {
        padding: 1.5rem 0.5rem 1rem;
    }
    .drop-zone {
        padding: 2rem 1rem;
    }
    .btn-convert {
        width: 100%;
        justify-content: center;
    }
    .file-card-meta {
        display: none;
    }
}

/* ── Focus visible (WCAG 2.4.7 AA) ─────────────────────────── */

:focus-visible {
    outline: 3px solid var(--tc-orange);
    outline-offset: 3px;
}

/* Suppress browser default for mouse users; keep for keyboard */
:focus:not(:focus-visible) {
    outline: none;
}

.format-pill:focus-visible {
    outline: 3px solid var(--tc-orange);
    outline-offset: 3px;
    box-shadow: 0 0 0 5px rgba(211, 84, 0, 0.18);
}

.drop-zone:focus-visible {
    outline: 3px solid var(--tc-orange);
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(211, 84, 0, 0.18);
}

.btn-convert:focus-visible,
.btn-download:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px var(--tc-orange);
}

.file-card-remove:focus-visible,
.tc-share-btn:focus-visible,
.nav-link:focus-visible,
.btn:focus-visible {
    outline: 3px solid var(--tc-orange);
    outline-offset: 3px;
}

/* ── Conversion pairs grid ─────────────────────────────────────────────── */
.conversion-pair-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.conversion-pair {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 50px;
    background: var(--tc-light);
    color: var(--tc-text);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid var(--tc-border);
    white-space: nowrap;
}
