/**
 * QLVT Pro V8.3 — Refactor Cleanup CSS
 * ======================================
 * Replaces all inline styles from index.html with proper CSS classes.
 * Follows BEM-like naming convention for maintainability.
 *
 * @version 1.0.0
 * @date 2026-02-09
 * @author Code Audit V8.3
 */

/* ═══════════════════════════════════════════════════════════════════════════════
   1. DISPATCH VIEW — Header & Action Buttons
   ═══════════════════════════════════════════════════════════════════════════════ */

.dispatch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(135deg, #1e3a8a 0%, #312e81 100%);
    padding: 20px 24px;
    border-radius: 12px 12px 0 0;
}

.dispatch-header__left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dispatch-header__title {
    margin: 0;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

.dispatch-header__month-wrapper {
    position: relative;
}

.dispatch-header__month-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 1;
}

.dispatch-header__month-select {
    width: 180px;
    padding: 10px 12px 10px 38px;
    font-weight: 600;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.95);
    color: #1f2937;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.dispatch-header__month-select:hover,
.dispatch-header__month-select:focus {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.dispatch-header__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ─── Dispatch Action Buttons ─── */
.btn-dispatch {
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-dispatch:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-dispatch--add {
    background: rgba(16, 185, 129, 0.9);
}
.btn-dispatch--add:hover {
    background: rgba(16, 185, 129, 1);
}

.btn-dispatch--save {
    background: rgba(59, 130, 246, 0.9);
}
.btn-dispatch--save:hover {
    background: rgba(59, 130, 246, 1);
}
.btn-dispatch--save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-dispatch--backup {
    background: rgba(139, 92, 246, 0.9);
}
.btn-dispatch--backup:hover {
    background: rgba(139, 92, 246, 1);
}

.btn-dispatch--export {
    background: rgba(107, 114, 128, 0.9);
}
.btn-dispatch--export:hover {
    background: rgba(107, 114, 128, 1);
}

/* ─── Dispatch Month Navigator & List ─── */
.dispatch-month-nav {
    padding: 0 16px;
}

.dispatch-list {
    overflow-x: auto;
    overflow-y: auto;
    width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   2. SKELETON LOADING PLACEHOLDERS
   ═══════════════════════════════════════════════════════════════════════════════ */

.skeleton-content {
    width: 100%;
}

.skeleton-content--sm {
    max-width: 800px;
}

.skeleton-content--md {
    max-width: 1000px;
}

.skeleton-content--lg {
    max-width: 1200px;
}

.skeleton-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.skeleton-box--header {
    height: 48px;
    width: 200px;
    margin-bottom: 24px;
}

.skeleton-box--header-lg {
    height: 56px;
    width: 300px;
    margin-bottom: 24px;
    border-radius: 12px;
}

.skeleton-box--card {
    height: 100px;
    flex: 1;
    border-radius: 12px;
}

.skeleton-box--card-lg {
    height: 120px;
    flex: 1;
    border-radius: 12px;
}

.skeleton-box--card-xl {
    height: 150px;
    border-radius: 12px;
}

.skeleton-box--table {
    height: 300px;
    width: 100%;
    margin-bottom: 16px;
    border-radius: 12px;
}

.skeleton-box--table-lg {
    height: 350px;
    width: 100%;
    border-radius: 12px;
}

.skeleton-box--table-xl {
    height: 400px;
    width: 100%;
    border-radius: 12px;
}

.skeleton-box--table-full {
    height: 450px;
    width: 100%;
    border-radius: 12px;
}

.skeleton-box--map {
    height: calc(100vh - 200px);
    width: 100%;
    border-radius: 12px;
}

.skeleton-box--btn {
    height: 40px;
    width: 120px;
}

.skeleton-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   3. COMING SOON / PLACEHOLDER VIEWS
   ═══════════════════════════════════════════════════════════════════════════════ */

.coming-soon-notice {
    text-align: center;
    margin-top: 16px;
    color: var(--warning, #f59e0b);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   4. IMPORT VIEW — Upload Area & Preview
   ═══════════════════════════════════════════════════════════════════════════════ */

.import-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.import-period-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary, rgba(30, 41, 59, 0.5));
    padding: 10px 16px;
    border-radius: 10px;
}

.import-period-selector__label {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.import-date-warning {
    display: none;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    border-left: 4px solid #ef4444;
    margin-bottom: 16px;
}

.import-date-warning__inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.import-date-warning__icon {
    font-size: 1.5rem;
}

.import-date-warning__title {
    font-weight: 600;
    color: #ef4444;
}

.import-date-warning__text {
    margin: 4px 0 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary, #94a3b8);
}

/* ─── Preview Mode Toggle ─── */
.preview-mode-toggle {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.preview-mode-toggle__label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 16px;
    background: var(--bg-secondary, rgba(30, 41, 59, 0.5));
    border-radius: 8px;
    border: 1px solid var(--border-color, rgba(148, 163, 184, 0.08));
}

.preview-mode-toggle__checkbox {
    width: 18px;
    height: 18px;
    accent-color: #6366f1;
}

.preview-mode-toggle__text {
    font-weight: 600;
}

.preview-mode-toggle__hint {
    font-size: 0.8rem;
    color: var(--text-secondary, #94a3b8);
}

.preview-mode-status {
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 6px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   5. SMS ASSISTANT VIEW
   ═══════════════════════════════════════════════════════════════════════════════ */

.sms-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   6. SETTINGS VIEW
   ═══════════════════════════════════════════════════════════════════════════════ */

.lan-warning-banner {
    display: none;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.lan-warning-banner__inner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.lan-warning-banner__icon {
    font-size: 1.5rem;
}

.lan-warning-banner__content {
    flex: 1;
}

.lan-warning-banner__title {
    font-weight: 600;
    color: #92400e;
    margin-bottom: 6px;
}

.lan-warning-banner__text {
    color: #a16207;
    font-size: 0.9rem;
    line-height: 1.5;
}

.lan-warning-banner__code {
    background: #fef3c7;
    padding: 2px 6px;
    border-radius: 4px;
}

/* ─── Settings Sections ─── */
.settings-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border, rgba(148, 163, 184, 0.08));
}

.settings-section__title {
    margin-bottom: 16px;
}

.settings-section__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.settings-section__info {
    display: grid;
    gap: 8px;
    color: var(--text-secondary, #94a3b8);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   7. DEBT MODULE — Loading State
   ═══════════════════════════════════════════════════════════════════════════════ */

.debt-loading {
    padding: 40px;
    text-align: center;
    color: var(--text-muted, rgba(148, 163, 184, 0.55));
}

.debt-loading__icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.debt-loading__title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.debt-loading__text {
    font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   8. CLOUD SYNC SETTINGS — Loading
   ═══════════════════════════════════════════════════════════════════════════════ */

.cloud-sync-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted, rgba(148, 163, 184, 0.55));
}

.cloud-sync-loading__icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.cloud-sync-loading__text {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   9. AI CHAT WIDGET — Layout Fixes
   ═══════════════════════════════════════════════════════════════════════════════ */

.ai-chat-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   10. RESPONSIVE — Mobile-first overrides
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .dispatch-header {
        flex-direction: column;
        padding: 16px;
        gap: 12px;
    }

    .dispatch-header__left {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        width: 100%;
    }

    .dispatch-header__month-select {
        width: 100%;
    }

    .dispatch-header__actions {
        width: 100%;
        justify-content: stretch;
    }

    .dispatch-header__actions .btn-dispatch {
        flex: 1;
        justify-content: center;
        font-size: 0.85rem;
        padding: 10px 12px;
    }

    .import-header {
        flex-direction: column;
    }

    .import-period-selector {
        width: 100%;
        flex-wrap: wrap;
    }

    .skeleton-row {
        flex-direction: column;
    }

    .skeleton-grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .dispatch-header__actions {
        flex-direction: column;
    }

    .dispatch-header__actions .btn-dispatch {
        width: 100%;
    }
}
