:root {
    --bg-dark: #0b1120;
    --card-bg: rgba(30, 41, 59, 0.85);
    --border-color: rgba(255, 255, 255, 0.18);
    --accent-blue: #38bdf8;
    --accent-purple: #c084fc;
    --accent-gold: #fbbf24;
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.text-muted, small.text-muted, span.text-muted {
    color: #cbd5e1 !important;
    opacity: 0.9;
}

/* Glassmorphism Card */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* Header */
.app-header {
    background: rgba(11, 17, 32, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.app-logo {
    font-size: 1.6rem;
}

.app-title {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.credit-badge {
    background: rgba(251, 191, 36, 0.18);
    border: 1px solid rgba(251, 191, 36, 0.5);
    color: #fde047;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Auth Page */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    font-size: 3rem;
    margin-bottom: 8px;
}

.auth-title {
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: #e2e8f0;
}

.signup-bonus-badge {
    background: rgba(56, 189, 248, 0.2);
    border: 1px solid rgba(56, 189, 248, 0.5);
    color: #7dd3fc;
    padding: 10px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed rgba(56, 189, 248, 0.6);
    border-radius: 14px;
    padding: 24px;
    text-align: center;
    background: rgba(56, 189, 248, 0.08);
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-zone:hover {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.16);
}

.upload-zone .fw-bold {
    color: #ffffff !important;
    font-size: 0.95rem;
    letter-spacing: 0.2px;
}

.upload-zone small {
    color: #93c5fd !important;
    font-size: 0.82rem;
    font-weight: 500;
}

.upload-icon {
    font-size: 2.2rem;
    margin-bottom: 6px;
}

/* Duration Radio Buttons High Contrast */
.btn-outline-primary {
    color: #38bdf8 !important;
    border-color: rgba(56, 189, 248, 0.45) !important;
    background: rgba(56, 189, 248, 0.06);
    font-weight: 600;
}

.btn-outline-primary:hover {
    background: rgba(56, 189, 248, 0.2) !important;
    color: #ffffff !important;
    border-color: #38bdf8 !important;
}

.btn-check:checked + .btn-outline-primary {
    background: linear-gradient(135deg, #0284c7, #2563eb) !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.45);
}

.btn-outline-danger {
    color: #fca5a5 !important;
    border-color: rgba(239, 68, 68, 0.45) !important;
    background: rgba(239, 68, 68, 0.1);
    font-weight: 600;
}

.btn-outline-danger:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
}

.btn-outline-light {
    color: #f8fafc !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    background: rgba(255, 255, 255, 0.08);
    font-weight: 500;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
}

.btn-outline-warning {
    color: #fde047 !important;
    border-color: rgba(234, 179, 8, 0.45) !important;
    background: rgba(234, 179, 8, 0.1);
    font-weight: 600;
}

.btn-outline-warning:hover {
    background: #eab308 !important;
    color: #0f172a !important;
    font-weight: 700;
}

/* Source Files List */
.source-files-list {
    max-height: 180px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.7);
    border-radius: 10px;
    padding: 8px;
    border: 1px solid var(--border-color);
}

.source-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(30, 41, 59, 0.95);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: #f8fafc;
}

/* Gradient Buttons */
.btn-gradient-primary {
    background: linear-gradient(135deg, #0284c7, #9333ea);
    color: #ffffff !important;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(147, 51, 234, 0.4);
    transition: all 0.2s ease;
}

.btn-gradient-primary:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

/* Form Controls */
.form-control, .form-select {
    background: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    color: #ffffff !important;
    border-radius: 10px;
}

.form-control::placeholder {
    color: #94a3b8 !important;
    opacity: 0.85;
}

.form-control:focus, .form-select:focus {
    background: #0f172a !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 0.25rem rgba(56, 189, 248, 0.35) !important;
}

.form-select option {
    background: #0f172a !important;
    color: #ffffff !important;
}

.form-label, .form-check-label {
    color: #f8fafc !important;
}

/* Subtitle Mode Buttons */
.mode-btn-active {
    background: linear-gradient(135deg, #0284c7, #38bdf8) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    border: none !important;
}

.mode-btn-inactive {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Bottom Mobile Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(11, 17, 32, 0.95);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.75rem;
    width: 25%;
    height: 100%;
    transition: all 0.2s ease;
}

.bottom-nav .nav-item .nav-icon {
    font-size: 1.3rem;
    margin-bottom: 2px;
}

.bottom-nav .nav-item.active, .bottom-nav .nav-item:hover {
    color: #38bdf8;
    font-weight: 700;
}

/* Job & Credit Item Cards */
.job-item-card, .credit-item-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
}

.card-header-custom {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.card-header-custom h5 {
    margin: 0;
    font-weight: 700;
    color: #f8fafc;
}
    font-size: 1.1rem;
}

/* ═══════════════════════════════════════
   UNIVERSAL COLOR PICKER & QUICK DOTS
═══════════════════════════════════════ */
.color-picker-composite {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 4px 8px;
}
.color-input-picker {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 32px;
    height: 32px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    padding: 0;
    flex-shrink: 0;
}
.color-input-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}
.color-input-picker::-webkit-color-swatch {
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
}
.color-hex-input {
    width: 105px !important;
    background: #0f172a !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    font-weight: 600;
    font-size: 0.8rem !important;
    padding: 4px 6px !important;
    text-align: center;
    border-radius: 6px !important;
    flex-shrink: 0;
}
.cfg-quick-palette {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    padding: 2px 0;
    flex-grow: 1;
}
.color-quick-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    user-select: none;
}
.color-quick-dot:hover {
    transform: scale(1.25);
    border-color: #fff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}
.color-quick-dot.transparent-dot {
    background: repeating-linear-gradient(45deg, #475569 0, #475569 2px, #1e293b 2px, #1e293b 4px);
    color: #ef4444;
    font-weight: bold;
}

/* ═══════════════════════════════════════
   POSITION GRID (9:16 layout)
═══════════════════════════════════════ */
.pos-frame {
    width: 52px;
    min-height: 92px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 4px;
}
.pos-btn {
    width: 13px;
    height: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    cursor: pointer;
    font-size: 0;
    transition: background 0.15s;
}
.pos-btn:hover { background: rgba(245,166,35,0.5); }
.pos-btn.active { background: #f5a623; }

/* ═══════════════════════════════════════
   SOUND GRID
═══════════════════════════════════════ */
.sound-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px;
    max-height: 160px;
    overflow-y: auto;
    padding: 2px;
}
.sound-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: all 0.18s;
    word-break: break-all;
}
.sound-btn:hover { background: rgba(245,166,35,0.12); border-color: rgba(245,166,35,0.35); color: #f5a623; }
.sound-btn.active { background: rgba(245,166,35,0.18); border-color: rgba(245,166,35,0.6); color: #f5a623; font-weight: 600; }
.sound-btn-none {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.18s;
    width: 100%;
    margin-bottom: 6px;
}
.sound-btn-none.active { background: rgba(100,100,100,0.2); border-color: rgba(255,255,255,0.3); color: #fff; font-weight: 600; }

/* ═══════════════════════════════════════
   QUEUE PANEL
═══════════════════════════════════════ */
.queue-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(50,230,255,0.2);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
}
.queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 6px;
    font-size: 0.82rem;
    gap: 8px;
}
.queue-item-info { flex: 1; min-width: 0; }
.queue-item-name { font-weight: 600; color: #38bdf8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item-meta { font-size: 0.75rem; color: #cbd5e1; margin-top: 2px; }
.queue-remove-btn {
    background: rgba(220,53,69,0.18);
    color: #fca5a5;
    border: 1px solid rgba(220,53,69,0.4);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}
.queue-remove-btn:hover { background: rgba(220,53,69,0.35); }

/* ═══════════════════════════════════════
   SECTION COLLAPSER
═══════════════════════════════════════ */
.cfg-section-toggle {
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    padding-bottom: 10px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cfg-section-toggle:hover { color: var(--accent-blue); }
.cfg-collapse-icon { transition: transform 0.2s ease; display: inline-block; font-size: 0.8rem; }
.cfg-collapse-icon.collapsed { transform: rotate(-90deg); }

/* ═══════════════════════════════════════
   CAPTION STYLE CARD
═══════════════════════════════════════ */
.caption-style-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 14px;
}
.cfg-label {
    font-size: 0.78rem;
    color: #e2e8f0;
    margin-bottom: 4px;
    display: block;
    font-weight: 600;
}

/* Modal Contrast */
.modal-content {
    background: #1e293b !important;
    color: #f8fafc !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 16px !important;
}

/* ═══════════════════════════════════════
   RANGE SLIDER UTILITY
═══════════════════════════════════════ */
.cfg-range-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cfg-range-wrap input[type=range] { flex: 1; accent-color: var(--accent-gold); }
.cfg-range-val {
    font-size: 0.75rem;
    color: var(--accent-gold);
    min-width: 38px;
    text-align: right;
    font-weight: 600;
}

/* ═══════════════════════════════════════
   ACTION BUTTONS ROW
═══════════════════════════════════════ */
.render-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}
@media (max-width: 480px) {
    .render-action-row { grid-template-columns: 1fr; }
}
.btn-render-now {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    color: #fff;
    font-weight: 700;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 1rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(255,75,43,0.35);
    transition: all 0.25s ease;
    cursor: pointer;
    width: 100%;
}
.btn-render-now:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255,75,43,0.5); }
.btn-add-queue {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #fff;
    font-weight: 700;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 1rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(56,239,125,0.35);
    transition: all 0.25s ease;
    cursor: pointer;
    width: 100%;
}
.btn-add-queue:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(56,239,125,0.5); }

/* ═══════════════════════════════════════
   MOBILE RESPONSIVE
═══════════════════════════════════════ */
#topNavTabs .nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 0.92rem;
    transition: all 0.2s ease;
}
#topNavTabs .nav-tab-icon {
    font-size: 1.1rem;
    line-height: 1;
}

@media (max-width: 575px) {
    .glass-card { padding: 14px; border-radius: 12px; }
    .app-header .container { padding: 0 12px; }
    .main-content { padding-top: 10px; }
    .caption-style-card { padding: 10px; }
    .sound-grid { grid-template-columns: repeat(2, 1fr); }
    .cfg-swatch { width: 22px; height: 22px; }

    /* Top Navigation Tabs on Mobile */
    #topNavTabs {
        padding: 5px !important;
        margin-bottom: 12px !important;
    }
    #topNavTabs .nav-link {
        padding: 8px 4px !important;
        min-height: 42px;
    }
    #topNavTabs .nav-tab-icon {
        font-size: 1.35rem;
    }
    #topNavTabs .nav-tab-text {
        display: none !important; /* Ẩn chữ trên điện thoại, chỉ để icon to rõ */
    }
}

/* ═══════════════════════════════════════
   TABLES & LISTS REFINEMENT
═══════════════════════════════════════ */
.table-responsive {
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.table-dark {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.06);
    --bs-table-border-color: rgba(255, 255, 255, 0.08);
}
.table-dark th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.6);
    padding: 10px 12px;
}
.table-dark td {
    font-size: 0.85rem;
    padding: 10px 12px;
}
.btn-xs {
    padding: 3px 8px;
    font-size: 0.72rem;
    border-radius: 6px;
    line-height: 1.3;
}

