/* ==============================================
   TAURI CONCIERGE - DESIGN SYSTEM
   Dark Theme + Gold Accents (#CFAA66)
   ============================================== */

:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1c1c1c;
    --bg-card: #161616;
    --bg-input: #1e1e1e;
    --border-color: rgba(255,255,255,0.08);
    --border-hover: rgba(207,170,102,0.3);
    --gold: #CFAA66;
    --gold-light: #e0c88a;
    --gold-dark: #b8943a;
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --text-muted: #666;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #f0ad4e;
    --info: #5bc0de;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
}

/* FORCE DARK MODE on entire app */
html { background: var(--bg-primary) !important; }
body { background: var(--bg-primary) !important; color: var(--text-primary) !important; }

/* Sidebar overrides */
.sidebar, .sidebar > div, .sidebar .bg-white, nav.sidebar {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}
.sidebar a, .sidebar span, .sidebar .text-black {
    color: var(--text-secondary) !important;
}
.sidebar a:hover, .sidebar a:hover span, .sidebar a.active span {
    color: var(--gold) !important;
}
.sidebar h2, .sidebar .text-black\/40 {
    color: var(--text-muted) !important;
}
.sidebar .main-logo img { filter: brightness(1.1); }

/* Topbar overrides */
.main-content > div:first-child,
div[class*="border-b"][class*="py-"] {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}
.main-content .fw-medium,
.main-content button[type="button"],
.profile button {
    color: var(--text-primary) !important;
}
.profile ul {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
}
.profile ul li a, .profile ul li h4, .profile ul li .text-black\/40 {
    color: var(--text-secondary) !important;
}
.profile ul li a:hover { color: var(--gold) !important; }
.profile ul li.h-px { background: var(--border-color) !important; }

/* Content area */
.main-content .h-\[calc\(100vh-73px\)\] {
    background: var(--bg-primary) !important;
}

/* Admin access banner - keep as is */

/* GLOBAL RESETS FOR CONTENT AREA */
.tc-page { color: var(--text-primary); font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; }
.tc-page a { color: var(--gold); text-decoration: none; }
.tc-page a:hover { color: var(--gold-light); }

/* Reset any tailwind white backgrounds inside tc-page */
.tc-page .bg-white,
.tc-page .dark\:bg-white\/5,
.tc-page .bg-lightwhite,
.tc-page .bg-lightblue-100,
.tc-page [class*="bg-light"] {
    background: var(--bg-card) !important;
}
.tc-page .text-black,
.tc-page [class*="text-black"] {
    color: var(--text-primary) !important;
}
.tc-page .border-black\/10,
.tc-page [class*="border-black"] {
    border-color: var(--border-color) !important;
}

/* CARDS */
.tc-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}
.tc-card:hover { border-color: var(--border-hover); }
.tc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}
.tc-card-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin: 0; }
.tc-card-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* STAT CARDS (dashboard) */
.tc-stat {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    transition: border-color 0.2s, transform 0.2s;
}
.tc-stat:hover { border-color: var(--gold); transform: translateY(-2px); }
.tc-stat-label { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.tc-stat-value { font-size: 26px; font-weight: 700; color: var(--text-primary); }
.tc-stat-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.tc-stat-gold .tc-stat-value { color: var(--gold); }

/* PAGE HEADER */
.tc-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.tc-page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); margin: 0; }

/* BUTTONS */
.tc-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
}
.tc-btn:hover { text-decoration: none; }
.tc-btn-gold { background: var(--gold); color: #000; }
.tc-btn-gold:hover { background: var(--gold-dark); color: #000; }
.tc-btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.tc-btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.tc-btn-danger { background: var(--danger); color: #fff; }
.tc-btn-danger:hover { background: #c82333; color: #fff; }
.tc-btn-success { background: var(--success); color: #fff; }
.tc-btn-success:hover { background: #218838; color: #fff; }
.tc-btn-sm { padding: 5px 12px; font-size: 12px; }
.tc-btn-lg { padding: 12px 28px; font-size: 15px; }

/* BADGES / STATUS */
.tc-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.tc-badge-warning { background: rgba(240,173,78,0.15); color: var(--warning); border: 1px solid rgba(240,173,78,0.3); }
.tc-badge-info { background: rgba(91,192,222,0.15); color: var(--info); border: 1px solid rgba(91,192,222,0.3); }
.tc-badge-success { background: rgba(40,167,69,0.15); color: var(--success); border: 1px solid rgba(40,167,69,0.3); }
.tc-badge-danger { background: rgba(220,53,69,0.15); color: var(--danger); border: 1px solid rgba(220,53,69,0.3); }
.tc-badge-muted { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid rgba(255,255,255,0.1); }
.tc-badge-gold { background: rgba(207,170,102,0.15); color: var(--gold); border: 1px solid rgba(207,170,102,0.3); }

/* TABLES */
.tc-table { width: 100%; border-collapse: collapse; }
.tc-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    font-weight: 600;
}
.tc-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-primary);
    vertical-align: middle;
}
.tc-table tbody tr { transition: background 0.15s; }
.tc-table tbody tr:hover { background: rgba(207,170,102,0.04); }
.tc-table .tc-text-success { color: var(--success); }
.tc-table .tc-text-danger { color: var(--danger); }
.tc-table .tc-text-gold { color: var(--gold); }

/* FORMS */
.tc-input, .tc-select, .tc-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}
.tc-input:focus, .tc-select:focus, .tc-textarea:focus { border-color: var(--gold); }
.tc-input::placeholder { color: var(--text-muted); }
.tc-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.3px; }
.tc-form-group { margin-bottom: 16px; }
.tc-file-input {
    background: var(--bg-input);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    width: 100%;
    cursor: pointer;
    transition: border-color 0.2s;
}
.tc-file-input:hover { border-color: var(--gold); }

/* ALERTS */
.tc-alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}
.tc-alert-success { background: rgba(40,167,69,0.1); border: 1px solid rgba(40,167,69,0.3); color: var(--success); }
.tc-alert-danger { background: rgba(220,53,69,0.1); border: 1px solid rgba(220,53,69,0.3); color: var(--danger); }
.tc-alert-warning { background: rgba(240,173,78,0.1); border: 1px solid rgba(240,173,78,0.3); color: var(--warning); }
.tc-alert-info { background: rgba(91,192,222,0.1); border: 1px solid rgba(91,192,222,0.3); color: var(--info); }

/* GRID */
.tc-grid { display: grid; gap: 16px; }
.tc-grid-2 { grid-template-columns: repeat(2, 1fr); }
.tc-grid-3 { grid-template-columns: repeat(3, 1fr); }
.tc-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) {
    .tc-grid-2, .tc-grid-3, .tc-grid-4 { grid-template-columns: 1fr; }
}

/* DIVIDERS */
.tc-divider { height: 1px; background: var(--border-color); margin: 20px 0; }

/* EMPTY STATE */
.tc-empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.tc-empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.3; }
.tc-empty-text { font-size: 14px; }

/* SECTION TITLE */
.tc-section-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
}

/* AMOUNT DISPLAY */
.tc-amount { font-family: 'Inter', monospace; }
.tc-amount-lg { font-size: 28px; font-weight: 700; }
.tc-amount-positive { color: var(--success); }
.tc-amount-positive::before { content: '+'; }
.tc-amount-negative { color: var(--danger); }
.tc-amount-negative::before { content: '-'; }

/* SIDEBAR NAV LINKS */
.tc-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--text-secondary) !important;
    text-decoration: none !important;
    font-size: 13px;
    transition: all 0.15s;
    border-left: 2px solid transparent;
}
.tc-nav-link:hover {
    color: var(--gold) !important;
    background: rgba(207,170,102,0.06);
    border-left-color: var(--gold);
}

/* SIDEBAR MENU HOVER (generic) */
.tc-sidebar a:hover { color: var(--gold) !important; }

/* SHOW/HIDE HELPERS */
.tc-show-mobile { display: none; }
.tc-hide-mobile { display: block; }
.tc-hamburger { display: none !important; }

/* =============================================
   MOBILE RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
    /* Sidebar hidden on mobile/tablet */
    .tc-sidebar { transform: translateX(-100%); }
    .tc-sidebar.open { transform: translateX(0); }
    .tc-main { margin-left: 0 !important; }
    .tc-hamburger { display: block !important; }
}

@media (max-width: 768px) {
    /* Show/hide */
    .tc-show-mobile { display: block !important; }
    .tc-hide-mobile { display: none !important; }

    /* Content padding */
    .tc-page { padding: 14px !important; }

    /* Page header stacks on mobile */
    .tc-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .tc-page-title { font-size: 18px; }

    /* Cards less padding */
    .tc-card { padding: 14px; }
    .tc-card-header { flex-direction: column; align-items: flex-start; gap: 8px; }

    /* Stat cards smaller */
    .tc-stat { padding: 14px 16px; }
    .tc-stat-value { font-size: 20px; }

    /* Tables become cards on mobile */
    .tc-table-mobile thead { display: none; }
    .tc-table-mobile,
    .tc-table-mobile tbody,
    .tc-table-mobile tr,
    .tc-table-mobile td {
        display: block;
        width: 100%;
    }
    .tc-table-mobile tr {
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        padding: 12px;
        margin-bottom: 10px;
    }
    .tc-table-mobile td {
        padding: 4px 0;
        border: none;
        font-size: 13px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .tc-table-mobile td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.3px;
        margin-right: 8px;
        flex-shrink: 0;
    }

    /* Regular table scroll on mobile */
    .tc-table:not(.tc-table-mobile) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Buttons full width on mobile */
    .tc-btn-lg { width: 100%; justify-content: center; }

    /* Forms */
    .tc-form-group { margin-bottom: 12px; }

    /* Amounts smaller */
    .tc-amount-lg { font-size: 22px; }

    /* Ticket chat adjustments */
    .msg-bubble { max-width: 90% !important; }
    .chat-area { height: calc(100vh - 320px) !important; padding: 12px !important; }
    .input-area { flex-wrap: wrap; gap: 6px !important; padding: 10px !important; }
    .input-area input[type="text"] { min-width: 0; }
    .input-area input[type="file"] { max-width: 100% !important; width: 100%; order: 3; }

    /* Ticket list - hide long columns */
    .tc-table td[style*="white-space: nowrap"] { white-space: normal !important; }
}

@media (max-width: 480px) {
    .tc-stat-value { font-size: 18px; }
    .tc-page-title { font-size: 16px; }
    .tc-card { padding: 12px; }
    .tc-btn { padding: 6px 12px; font-size: 12px; }
    .tc-btn-sm { padding: 4px 8px; font-size: 11px; }
    .tc-badge { font-size: 10px; padding: 2px 8px; }
}

/* =============================================
   MATERIAL DASHBOARD / BOOTSTRAP OVERRIDES
   Forces dark theme over any conflicting CSS
   ============================================= */

/* Global body reset */
body, html { background: var(--bg-primary) !important; color: var(--text-primary) !important; }

/* Kill Material Dashboard backgrounds */
.main-panel, .wrapper, .content, .container, .container-fluid,
.card, .card-body, .card-header, .card-footer,
.panel, .panel-body, .well, section.card,
.table-responsive, .tab-content, .tab-pane {
    background: transparent !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    box-shadow: none !important;
}

/* Sidebar - kill Material Dashboard sidebar */
.sidebar[data-color], .sidebar[data-background-color],
.sidebar .sidebar-wrapper, .sidebar .nav,
.sidebar .logo, .sidebar-background {
    background: var(--bg-secondary) !important;
    box-shadow: none !important;
}

/* Navbar - kill Material Dashboard navbar */
.navbar, .navbar-transparent, .navbar-expand-lg {
    background: var(--bg-secondary) !important;
    box-shadow: none !important;
}

/* Forms */
.tc-page .form-control,
.form-control {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
}
.tc-page .form-control:focus,
.form-control:focus {
    border-color: var(--gold) !important;
    box-shadow: 0 0 0 2px rgba(207,170,102,0.15) !important;
}

/* Tables */
.tc-page .table,
.table { color: var(--text-primary) !important; background: transparent !important; }
.tc-page .table thead th,
.table thead th { color: var(--text-muted) !important; border-color: var(--border-color) !important; background: transparent !important; }
.tc-page .table td,
.table td, .table th { border-color: var(--border-color) !important; color: var(--text-primary) !important; }
.table-striped tbody tr:nth-of-type(odd) { background: rgba(255,255,255,0.02) !important; }
.table-hover tbody tr:hover { background: rgba(207,170,102,0.04) !important; }

/* Material Dashboard card overrides */
.card .card-header-icon, .card-icon { background: var(--gold) !important; }
.card-stats .card-header.card-header-icon { float: none !important; }
.card [class*="card-header-"] { box-shadow: none !important; }
.card .card-category { color: var(--text-secondary) !important; }
.card .card-title, .card-title { color: var(--text-primary) !important; }

/* Buttons - ensure tc-btn always wins */
.tc-btn { position: relative; z-index: 1; }
.tc-btn-gold { background: var(--gold) !important; color: #000 !important; }
.tc-btn-gold:hover { background: var(--gold-dark) !important; color: #000 !important; }

/* Alerts */
.alert-success, .tc-page .alert-success { background: rgba(40,167,69,0.1) !important; border-color: rgba(40,167,69,0.3) !important; color: var(--success) !important; }
.alert-danger, .tc-page .alert-danger { background: rgba(220,53,69,0.1) !important; border-color: rgba(220,53,69,0.3) !important; color: var(--danger) !important; }
.alert-warning, .tc-page .alert-warning { background: rgba(240,173,78,0.1) !important; border-color: rgba(240,173,78,0.3) !important; color: var(--warning) !important; }
.alert-info, .tc-page .alert-info { background: rgba(91,192,222,0.1) !important; border-color: rgba(91,192,222,0.3) !important; color: var(--info) !important; }

/* Links */
a { color: var(--gold); }
a:hover { color: var(--gold-light); }

/* Page title */
.page-title, h3.page-title { color: var(--text-primary) !important; }
.page-title small { color: var(--text-muted) !important; }

/* Breadcrumb */
.breadcrumb { background: transparent !important; }
.breadcrumb li, .breadcrumb a { color: var(--text-muted) !important; }

/* Modals */
.modal-content { background: var(--bg-secondary) !important; color: var(--text-primary) !important; border: 1px solid var(--border-color) !important; }
.modal-header { border-color: var(--border-color) !important; }
.modal-footer { border-color: var(--border-color) !important; }
.modal-title { color: var(--gold) !important; }
.close { color: var(--text-primary) !important; opacity: 0.7 !important; text-shadow: none !important; }

/* DataTables */
.dataTables_wrapper { color: var(--text-primary) !important; }
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate { color: var(--text-secondary) !important; }
.dataTables_wrapper .dataTables_filter input { background: var(--bg-input) !important; border-color: var(--border-color) !important; color: var(--text-primary) !important; }
.page-item .page-link { background: var(--bg-card) !important; border-color: var(--border-color) !important; color: var(--text-primary) !important; }
.page-item.active .page-link { background: var(--gold) !important; border-color: var(--gold) !important; color: #000 !important; }

/* Misc Material overrides */
.bmd-form-group { padding-top: 0 !important; }
.form-group label { color: var(--text-secondary) !important; }
.nav-pills .nav-link { color: var(--text-secondary) !important; }
.nav-pills .nav-link.active { background: var(--gold) !important; color: #000 !important; }
.btn-info { background: var(--gold) !important; border-color: var(--gold) !important; color: #000 !important; }
.btn-success { background: var(--success) !important; border-color: var(--success) !important; }
.btn-danger { background: var(--danger) !important; border-color: var(--danger) !important; }
.btn-primary { background: var(--gold) !important; border-color: var(--gold) !important; color: #000 !important; }
select, select.form-control { background: var(--bg-input) !important; color: var(--text-primary) !important; }
textarea, textarea.form-control { background: var(--bg-input) !important; color: var(--text-primary) !important; }
input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="date"] {
    background: var(--bg-input) !important; color: var(--text-primary) !important; border-color: var(--border-color) !important;
}
::placeholder { color: var(--text-muted) !important; }
