/* ABELA CRM Theme — Light mode with black sidebar + Rubik font */

/* ── CRM Accent Button System ── */
:root {
    --crm-accent-dark: #c9304a;   /* darker shade for hover/active */
}

.btn-accent {
    background-color: var(--crm-accent);
    color: #fff !important;
    border: none;
    font-weight: 600;
    transition: background-color 0.2s, box-shadow 0.2s;
}
.btn-accent:hover, .btn-accent:focus {
    background-color: var(--crm-accent-dark);
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(201, 48, 74, 0.3);
}
.btn-accent:active {
    background-color: #b52a42;
    color: #fff !important;
}

.btn-outline-accent {
    color: var(--crm-accent);
    border: 2px solid var(--crm-accent);
    background: transparent;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-outline-accent:hover, .btn-outline-accent:focus {
    background-color: var(--crm-accent);
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(201, 48, 74, 0.2);
}

body {
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    color: #1a1a1a;
    background: #f8f9fa;
}

/* Sidebar */
#sidebar {
    background: #000 !important;
}

#sidebar .nav-link.active {
    background-color: var(--crm-accent) !important;
    border-radius: 8px;
}

#sidebar .nav-link {
    border-radius: 8px;
    margin-bottom: 2px;
    font-weight: 400;
}

#sidebar .nav-link:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Stat cards */
.stat-card {
    border: none;
    border-radius: 12px;
    background: #fff;
    border-left: 4px solid var(--crm-accent);
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a1a;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Tables — light theme */
.table, .table-dark {
    --bs-table-bg: transparent;
    --bs-table-color: #1a1a1a;
    color: #1a1a1a;
}

.table th, .table-dark th {
    color: var(--crm-accent);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e9ecef;
}

.table td, .table-dark td {
    border-bottom-color: #f0f0f0;
    vertical-align: middle;
    color: #333;
}

.table a {
    color: #1a1a1a;
    font-weight: 500;
}

.table a:hover {
    color: var(--crm-accent);
}

/* Stage badges — Booking */
.badge-tbc { background-color: #6c757d; }
.badge-negotiating { background-color: #ffc107; color: #000; }
.badge-contract_sent { background-color: #fd7e14; }
.badge-contract_signed { background-color: #20c997; }
.badge-advance_paid { background-color: #0dcaf0; color: #000; }
.badge-confirmed { background-color: #198754; }
/* Stage badges — Production */
.badge-show_announced { background-color: #6f42c1; }
.badge-advance_pack_sent { background-color: #0d6efd; }
.badge-rider_received { background-color: #6610f2; }
.badge-second_payment { background-color: #d63384; }
.badge-production_complete { background-color: #087990; }
/* Stage badges — Settlement */
.badge-show_day { background-color: #198754; }
.badge-overage_calculated { background-color: #ffc107; color: #000; }
.badge-overage_accepted { background-color: #20c997; }
.badge-final_payment_agency { background-color: #0dcaf0; color: #000; }
.badge-payment_to_artist { background-color: #0d6efd; }
.badge-commission_calculated { background-color: #198754; }
/* Stage badges — Terminal */
.badge-lost { background-color: #dc3545; }
.badge-cancelled { background-color: #dc3545; }
/* Legacy (kept for old data) */
.badge-lead { background-color: #6c757d; }
.badge-contacted { background-color: #0d6efd; }
.badge-completed { background-color: #198754; }

/* Contact type badges */
.badge-venue { background-color: #6f42c1; }
.badge-promoter { background-color: #d63384; }
.badge-manager { background-color: #0d6efd; }
.badge-client { background-color: #0d6efd; }

/* Search bar — light theme */
.search-input {
    background: #fff;
    border: 1px solid #dee2e6;
    color: #1a1a1a;
    border-radius: 8px;
}

.search-input:focus {
    background: #fff;
    border-color: var(--crm-accent);
    color: #1a1a1a;
    box-shadow: 0 0 0 0.2rem rgba(214, 51, 80, 0.15);
}

.search-input::placeholder {
    color: #adb5bd;
}

/* Login page — keep dark */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    border-radius: 16px;
    background: #111;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.login-card .form-control {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
}

.login-card .form-control:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--crm-accent);
    color: #fff;
}

.login-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Money formatting */
.money {
    font-family: 'Rubik', monospace;
    font-weight: 600;
}

.money-positive { color: #198754; }
.money-negative { color: #dc3545; }

/* Override dark-theme text classes in main content */
main .text-white {
    color: #1a1a1a !important;
}

main .text-muted {
    color: #6c757d !important;
}

main .border-secondary {
    border-color: #e9ecef !important;
}

/* Flash alerts */
.alert-info {
    background-color: #e8f4fd;
    border-color: #b6d7ea;
    color: #0c5460;
}

/* Dropdown in sidebar — keep dark */
.dropdown-menu-dark {
    background: #111;
}

/* Pagination */
.page-link {
    background: #fff;
    border-color: #dee2e6;
    color: #1a1a1a;
}

.page-link:hover {
    background: #f0f0f0;
    color: var(--crm-accent);
}

.page-item.active .page-link {
    background: var(--crm-accent);
    border-color: var(--crm-accent);
}

/* Filter pills */
.nav-pills .nav-link {
    color: #6c757d;
    font-weight: 500;
    border-radius: 8px;
}

.nav-pills .nav-link.active {
    background-color: var(--crm-accent);
    color: #fff;
}

/* Modal overrides for light theme */
.modal-content {
    background: #fff !important;
    color: #1a1a1a;
}

.modal-content .bg-dark {
    background: #fff !important;
}

.modal-header {
    border-bottom-color: #e9ecef;
}

.modal-footer {
    border-top-color: #e9ecef;
}

.modal-title {
    color: #1a1a1a !important;
}

.modal-content .form-label {
    color: #6c757d;
}

.modal-content .btn-close-white {
    filter: none;
}

/* Form selects */
.form-select.search-input {
    background-color: #fff;
    border: 1px solid #dee2e6;
    color: #1a1a1a;
}

/* Clickable stat cards */
a.stat-card-link {
    text-decoration: none;
    display: block;
}

a.stat-card-link:hover .stat-card {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Opacity for inactive rows */
.opacity-50 {
    opacity: 0.5;
}

/* Badge overrides for light */
.badge.bg-secondary {
    background-color: #e9ecef !important;
    color: #6c757d;
}

.badge.bg-info {
    background-color: #e8f4fd !important;
    color: #0c5460;
}

/* ── Filter chips & active filter highlights ──────────── */

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    background: #f0f0f0;
    border: 1px solid #ddd;
    color: #333;
    white-space: nowrap;
}

.filter-chip .chip-remove {
    cursor: pointer;
    opacity: 0.5;
    font-size: 0.85em;
    margin-left: 2px;
}

.filter-chip .chip-remove:hover {
    opacity: 1;
    color: #dc3545;
}

.filter-active {
    border-color: var(--crm-accent) !important;
    color: var(--crm-accent) !important;
}

/* ── Mobile / Responsive (< 768px) ────────────────────── */

/* Mobile top bar */
#mobileTopBar {
    background: #000;
    position: sticky;
    top: 0;
    z-index: 1040;
}

/* Sidebar: hidden off-screen on mobile, slides in */
@media (max-width: 767.98px) {
    #sidebar {
        position: fixed !important;
        top: 0;
        left: -260px;
        z-index: 1050;
        height: 100vh !important;
        min-height: 100vh;
        overflow-y: auto;
        transition: left 0.25s ease;
    }
    #sidebar.mobile-open {
        left: 0;
    }
    /* Overlay behind sidebar */
    #sidebarOverlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1045;
    }
    #sidebarOverlay.active {
        display: block;
    }
    /* Main content takes full width */
    main {
        width: 100% !important;
        padding: 0.75rem !important;
    }
    /* Stat cards */
    .stat-card .stat-value {
        font-size: 1.3rem;
    }
    .stat-card .stat-label {
        font-size: 0.7rem;
    }
    /* Smaller page titles */
    h4 {
        font-size: 1.15rem;
    }
    h6 {
        font-size: 0.9rem;
    }
    /* Make tables scroll horizontally */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    /* Compact table text */
    .table td, .table th {
        font-size: 0.78rem;
        padding: 0.3rem 0.4rem;
    }
    /* Stack filter bars vertically */
    .d-flex.gap-2, .d-flex.gap-3 {
        flex-wrap: wrap;
    }
    /* Mobile filter panel: hidden by default, shown with .show */
    #filterPanel {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem 0;
    }
    #filterPanel.show {
        display: flex !important;
    }
    /* Filter row compact dropdowns */
    .row.g-2 > .col-auto {
        flex: 0 0 auto;
    }
    .row.g-2 .dropdown .btn {
        font-size: 0.78rem;
        padding: 0.3rem 0.5rem;
    }
    /* Nav pills (stage tabs) scroll */
    .nav-pills .nav-link {
        font-size: 0.78rem;
        padding: 0.35rem 0.6rem;
        white-space: nowrap;
    }
    /* Modal fullscreen on mobile */
    .modal-dialog.modal-lg {
        margin: 0;
        max-width: 100%;
    }
    .modal-dialog.modal-lg .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }
    /* Regular modals — near fullscreen */
    .modal-dialog:not(.modal-lg) {
        margin: 0.5rem;
    }
    /* Cards reduce padding */
    .card.p-4 { padding: 0.75rem !important; }
    .card.p-3 { padding: 0.6rem !important; }
    /* FullCalendar mobile tweaks */
    .fc .fc-toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }
    .fc .fc-toolbar-title {
        font-size: 1rem;
    }
    .fc .fc-button {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
    .fc .fc-daygrid-day-number {
        font-size: 0.75rem;
    }
    .fc .fc-event-title {
        font-size: 0.65rem !important;
    }
    /* Deal detail: stack columns better */
    .col-md-4 .card {
        margin-bottom: 0.5rem !important;
    }
    /* Pagination smaller */
    .pagination .page-link {
        font-size: 0.78rem;
        padding: 0.25rem 0.5rem;
    }
    /* Talent grid: 2 per row on mobile */
    .col-md-4.col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    /* Notes form row compact */
    #note-input {
        font-size: 0.85rem;
    }
}

/* Stat cards: 2-col on small screens */
@media (max-width: 575.98px) {
    .row.g-3 > [class*="col-md-3"] {
        flex: 0 0 50%;
        max-width: 50%;
    }
    /* Talent grid: full width on very small screens */
    .col-md-4.col-lg-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}
