/* Music Marketing Amplifier - Design System (UI/UX Pro Max) */

/* ─── Primitive Tokens ────────────────────────────────────────────────────── */
:root {
    /* Gray Scale */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* Primary (Blue) */
    --blue-50: #EFF6FF;
    --blue-100: #DBEAFE;
    --blue-500: #3B82F6;
    --blue-600: #2563EB;
    --blue-700: #1D4ED8;
    --blue-800: #1E40AF;

    /* Status */
    --green-500: #22C55E;
    --green-600: #16A34A;
    --yellow-500: #EAB308;
    --yellow-600: #CA8A04;
    --red-500: #EF4444;
    --red-600: #DC2626;
    --orange-500: #F97316;
    --cyan-500: #06B6D4;

    /* Brand — PitchSonic */
    --brand: #FF4002;
    --brand-hover: #e63a02;
    --brand-light: rgba(255, 64, 2, 0.1);
    --purple: #363363;
    --purple-light: #4a4780;
    --accent: #FF4002;

    /* Spacing (4px base) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-xl: 0 10px 25px rgba(0,0,0,0.1);

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 200ms ease-in-out;
    --transition-slow: 300ms ease-out;
}

/* ─── Semantic Tokens ─────────────────────────────────────────────────────── */
[data-bs-theme="dark"] {
    --color-bg: var(--gray-900);
    --color-bg-card: #363363;
    --color-bg-card-header: rgba(6, 182, 212, 0.05);
    --color-bg-elevated: #3d3a6e;
    --color-fg: #E5E7EB;
    --color-fg-muted: var(--gray-400);
    --color-border: rgba(124, 58, 237, 0.15);
    --color-border-hover: var(--accent);
    --color-primary: var(--blue-500);
    --color-ring: var(--accent);
    --card-shadow: 0 2px 8px rgba(0,0,0,0.3);
    --table-bg: rgba(26, 26, 46, 0.8);
    --table-hover: rgba(30, 30, 54, 0.9);
    --table-header: rgba(6, 182, 212, 0.08);
}

[data-bs-theme="light"] {
    --color-bg: #FFFFFF;
    --color-bg-card: #FFFFFF;
    --color-bg-card-header: var(--gray-50);
    --color-bg-elevated: var(--gray-50);
    --color-fg: var(--gray-900);
    --color-fg-muted: var(--gray-500);
    --color-border: var(--gray-200);
    --color-border-hover: var(--blue-600);
    --color-primary: var(--blue-600);
    --color-ring: var(--blue-500);
    --card-shadow: var(--shadow-md);
    --table-bg: #FFFFFF;
    --table-hover: var(--gray-50);
    --table-header: var(--gray-50);
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-fg);
    line-height: 1.6;
}

[data-bs-theme="dark"] body {
    background-color: #2d2a54;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ─── Light Theme (PlaylistHub style) ─────────────────────────────────────── */

[data-bs-theme="light"] {
    --accent: #FF4002;
    --purple: #FF4002;
}

[data-bs-theme="light"] body {
    background-color: #ffffff;
    color: #363363;
}

[data-bs-theme="light"] .navbar {
    background: #ffffff !important;
    border-bottom: 1px solid #e5e7eb !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-bs-theme="light"] .navbar-brand {
    -webkit-text-fill-color: initial;
    background: none;
    color: #363363;
    font-weight: 700;
}

[data-bs-theme="light"] .nav-link {
    color: #FF4002 !important;
}

[data-bs-theme="light"] .nav-link:hover,
[data-bs-theme="light"] .nav-link.active {
    color: #e63a02 !important;
}

[data-bs-theme="light"] .nav-link i {
    color: #FF4002;
}

[data-bs-theme="light"] .table-dark {
    --bs-table-bg: #ffffff;
    --bs-table-color: #363363;
    --bs-table-border-color: #e5e7eb;
    --bs-table-hover-bg: #f8f9fc;
}

[data-bs-theme="light"] .table-dark thead th {
    background-color: #f8f9fc;
    color: #6b7280;
    border-bottom: 2px solid #FF4002;
    font-weight: 600;
}

[data-bs-theme="light"] .card {
    background-color: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-bs-theme="light"] .card:hover {
    border-color: #FF4002 !important;
    box-shadow: 0 2px 8px rgba(59, 91, 255, 0.1);
}

[data-bs-theme="light"] .card-header {
    background-color: #f8f9fc;
    border-bottom-color: #e5e7eb;
    color: #363363;
}

[data-bs-theme="light"] .stat-card {
    border: 1px solid #e5e7eb !important;
}

[data-bs-theme="light"] .stat-label {
    color: #6b7280;
}

[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select {
    background-color: #ffffff;
    border-color: #d1d5db;
    color: #363363;
}

[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus {
    background-color: #ffffff;
    border-color: #FF4002;
    color: #363363;
    box-shadow: 0 0 0 0.2rem rgba(59, 91, 255, 0.15);
}

[data-bs-theme="light"] .filter-dropdown {
    background-color: #f0f3ff !important;
    color: #FF4002 !important;
    border: 1px solid #FF4002 !important;
}

[data-bs-theme="light"] .filter-dropdown:focus {
    box-shadow: 0 0 0 0.2rem rgba(59, 91, 255, 0.2) !important;
}

[data-bs-theme="light"] .filter-dropdown option {
    background-color: #ffffff;
    color: #363363;
}

[data-bs-theme="light"] .search-box {
    background-color: #f0f3ff !important;
    color: #FF4002 !important;
    border: 1px solid #FF4002 !important;
}

[data-bs-theme="light"] .search-box::placeholder {
    color: #8da0ff;
}

[data-bs-theme="light"] .modal-content {
    background-color: #ffffff !important;
    color: #363363;
    border-color: #e5e7eb;
}

[data-bs-theme="light"] .modal-header,
[data-bs-theme="light"] .modal-footer {
    border-color: #e5e7eb !important;
}

[data-bs-theme="light"] .dropdown-menu-dark {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-bs-theme="light"] .dropdown-menu-dark .dropdown-item {
    color: #363363;
}

[data-bs-theme="light"] .dropdown-menu-dark .dropdown-item:hover {
    background-color: #f0f3ff;
    color: #FF4002;
}

[data-bs-theme="light"] .btn-outline-secondary {
    border-color: #d1d5db;
    color: #4b5563;
}

[data-bs-theme="light"] .btn-outline-secondary:hover {
    background-color: #f0f3ff;
    border-color: #FF4002;
    color: #FF4002;
}

/* Solid buttons → outline on hover */
[data-bs-theme="light"] .btn-primary {
    background-color: #FF4002;
    border-color: #FF4002;
    color: #fff;
}
[data-bs-theme="light"] .btn-primary:hover {
    background-color: transparent;
    border-color: #FF4002;
    color: #FF4002;
}

[data-bs-theme="light"] .btn-success {
    background-color: #10b981;
    border-color: #10b981;
    color: #fff;
}
[data-bs-theme="light"] .btn-success:hover {
    background-color: transparent;
    border-color: #10b981;
    color: #10b981;
}

[data-bs-theme="light"] .btn-danger {
    background-color: #ef4444;
    border-color: #ef4444;
    color: #fff;
}
[data-bs-theme="light"] .btn-danger:hover {
    background-color: transparent;
    border-color: #ef4444;
    color: #ef4444;
}

[data-bs-theme="light"] .btn-warning {
    background-color: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
}
[data-bs-theme="light"] .btn-warning:hover {
    background-color: transparent;
    border-color: #f59e0b;
    color: #f59e0b;
}

[data-bs-theme="light"] .btn-info {
    background-color: #FF4002;
    border-color: #FF4002;
    color: #fff;
}
[data-bs-theme="light"] .btn-info:hover {
    background-color: transparent;
    border-color: #FF4002;
    color: #FF4002;
}

[data-bs-theme="light"] .btn-dark {
    background-color: #374151;
    border-color: #374151;
    color: #fff;
}
[data-bs-theme="light"] .btn-dark:hover {
    background-color: transparent;
    border-color: #374151;
    color: #374151;
}

/* Outline buttons → filled on hover */
[data-bs-theme="light"] .btn-outline-primary {
    border-color: #FF4002;
    color: #FF4002;
}
[data-bs-theme="light"] .btn-outline-primary:hover {
    background-color: #FF4002;
    color: #fff;
}

[data-bs-theme="light"] .btn-outline-success {
    border-color: #10b981;
    color: #10b981;
}
[data-bs-theme="light"] .btn-outline-success:hover {
    background-color: #10b981;
    color: #fff;
}

[data-bs-theme="light"] .btn-outline-danger {
    border-color: #ef4444;
    color: #ef4444;
}
[data-bs-theme="light"] .btn-outline-danger:hover {
    background-color: #ef4444;
    color: #fff;
}

[data-bs-theme="light"] .btn-outline-warning {
    border-color: #f59e0b;
    color: #f59e0b;
}
[data-bs-theme="light"] .btn-outline-warning:hover {
    background-color: #f59e0b;
    color: #fff;
}

[data-bs-theme="light"] .btn-outline-info {
    border-color: #FF4002;
    color: #FF4002;
}
[data-bs-theme="light"] .btn-outline-info:hover {
    background-color: #FF4002;
    color: #fff;
}

[data-bs-theme="light"] .btn-outline-dark {
    border-color: #374151;
    color: #374151;
}
[data-bs-theme="light"] .btn-outline-dark:hover {
    background-color: #374151;
    color: #fff;
}

[data-bs-theme="light"] .btn-outline-light {
    border-color: #d1d5db;
    color: #4b5563;
    background-color: transparent;
}
[data-bs-theme="light"] .btn-outline-light:hover {
    background-color: #FF4002;
    color: #fff;
    border-color: #FF4002;
}

[data-bs-theme="light"] .btn-outline-secondary {
    border-color: #d1d5db;
    color: #4b5563;
}
[data-bs-theme="light"] .btn-outline-secondary:hover {
    background-color: #4b5563;
    border-color: #4b5563;
    color: #fff;
}

/* Light theme: btn-light used in status filters */
[data-bs-theme="light"] .btn-light {
    background-color: #FF4002;
    border-color: #FF4002;
    color: #fff;
}
[data-bs-theme="light"] .btn-outline-light.active,
[data-bs-theme="light"] .btn-light.active {
    background-color: #FF4002 !important;
    border-color: #FF4002 !important;
    color: #fff !important;
}

/* Light theme: table row hover text stays visible */
[data-bs-theme="light"] .table-dark tbody tr:hover td {
    color: #363363 !important;
}

/* Light theme: dropdown text always visible */
[data-bs-theme="light"] .dropdown-menu .dropdown-item {
    color: #363363;
}
[data-bs-theme="light"] .dropdown-menu .dropdown-item:hover {
    background-color: #f0f3ff;
    color: #FF4002;
}

/* Light theme: badge text readable */
[data-bs-theme="light"] .badge.bg-secondary {
    background-color: #6b7280 !important;
    color: #fff !important;
}
[data-bs-theme="light"] .badge.bg-dark {
    background-color: #374151 !important;
    color: #fff !important;
}

[data-bs-theme="light"] .text-muted {
    color: #6b7280 !important;
}

[data-bs-theme="light"] .text-info {
    color: #FF4002 !important;
}

[data-bs-theme="light"] .alert-secondary,
[data-bs-theme="light"] #bulkBar {
    background-color: #f0f3ff;
    border-color: #c7d2fe;
    color: #363363;
}

[data-bs-theme="light"] .breadcrumb-item a {
    color: #FF4002;
}

[data-bs-theme="light"] a.text-info {
    color: #FF4002 !important;
}

[data-bs-theme="light"] ::-webkit-scrollbar-track {
    background: #f8f9fc;
}

[data-bs-theme="light"] ::-webkit-scrollbar-thumb {
    background: #d1d5db;
}

[data-bs-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

[data-bs-theme="light"] pre {
    background-color: #f8f9fc;
    border-color: #e5e7eb;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, #363363 0%, #3d3a6e 100%) !important;
}

.navbar-brand {
    background: linear-gradient(135deg, var(--accent), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.3rem;
}

[data-bs-theme="dark"] .nav-link {
    color: #a78bfa !important;
}

[data-bs-theme="dark"] .nav-link:hover,
[data-bs-theme="dark"] .nav-link.active {
    color: #c4b5fd !important;
}

[data-bs-theme="dark"] .nav-link i {
    color: #7c3aed;
}

[data-bs-theme="dark"] .nav-link:hover i,
[data-bs-theme="dark"] .nav-link.active i {
    color: #a78bfa;
}

/* Stat Cards */
.stat-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border-radius: 0.75rem;
}

[data-bs-theme="dark"] .stat-card {
    border: 1px solid rgba(6, 182, 212, 0.15) !important;
    background: linear-gradient(145deg, #363363 0%, #3d3a6e 100%) !important;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.12);
    border-color: var(--accent) !important;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
}

/* Cards */
.card {
    border-radius: 8px !important;
    overflow: hidden;
    border: 1px solid rgba(124, 58, 237, 0.15);
    transition: border-color 0.2s, box-shadow 0.2s;
}

[data-bs-theme="dark"] .card {
    background: linear-gradient(145deg, #363363 0%, #3d3a6e 100%) !important;
    border-color: rgba(6, 182, 212, 0.12);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.card:hover {
    border-color: var(--accent) !important;
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.15);
}

.card-header {
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .card-header {
    background: rgba(6, 182, 212, 0.05);
}

[data-bs-theme="light"] .card-body {
    background: #eef0f7;
}

[data-bs-theme="light"] .card {
    background-color: #ffffff !important;
    border: 1px solid rgba(59, 91, 255, 0.2) !important;
    box-shadow: 0 1px 4px rgba(59, 91, 255, 0.06);
}

[data-bs-theme="light"] .card:hover {
    border-color: #FF4002 !important;
    box-shadow: 0 4px 16px rgba(59, 91, 255, 0.12);
}

[data-bs-theme="light"] .stat-card {
    border: 1px solid rgba(59, 91, 255, 0.15) !important;
}

[data-bs-theme="light"] .stat-card:hover {
    border-color: #FF4002 !important;
}

[data-bs-theme="dark"] .card-body {
    background: rgba(22, 33, 62, 0.3);
}

/* Tables */
[data-bs-theme="dark"] .table-dark {
    --bs-table-bg: rgba(26, 26, 46, 0.8);
    --bs-table-hover-bg: rgba(30, 30, 54, 0.9);
    border-radius: 0.5rem;
    overflow: hidden;
}

[data-bs-theme="dark"] .table-dark thead th {
    background-color: rgba(6, 182, 212, 0.08);
    border-bottom: 2px solid rgba(6, 182, 212, 0.2);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #a0aec0;
}

[data-bs-theme="dark"] .table-dark td {
    border-color: rgba(255, 255, 255, 0.04);
}

/* Badges */
.bg-purple {
    background-color: var(--purple) !important;
}

.badge {
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Buttons */
.btn-outline-primary:hover,
.btn-outline-info:hover,
.btn-outline-success:hover,
.btn-outline-warning:hover {
    box-shadow: 0 2px 10px rgba(6, 182, 212, 0.2);
}

/* Flash messages */
.flash-messages {
    position: sticky;
    top: 0;
    z-index: 1050;
}

/* Pipeline chart */
#pipelineChart {
    max-height: 250px;
}

/* Form controls dark theme */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: rgba(26, 26, 46, 0.9);
    border-color: rgba(124, 58, 237, 0.15);
    color: #e5e7eb;
    border-radius: 0.5rem;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #3d3a6e;
    border-color: var(--accent);
    color: #e5e7eb;
    box-shadow: 0 0 0 0.25rem rgba(6, 182, 212, 0.15);
}

/* Modal */
.modal-content {
    border-radius: 0.75rem;
}

/* Accordion */
[data-bs-theme="dark"] .accordion-button {
    background-color: rgba(22, 33, 62, 0.5);
    color: #e5e7eb;
}

[data-bs-theme="dark"] .accordion-button.collapsed {
    background-color: rgba(22, 33, 62, 0.3);
    color: #e5e7eb;
}

[data-bs-theme="dark"] .accordion-button::after {
    filter: invert(1);
}

[data-bs-theme="dark"] .accordion-body {
    color: #d1d5db;
}

[data-bs-theme="light"] .accordion-button {
    background-color: #f8f9fc;
    color: #363363;
}

[data-bs-theme="light"] .accordion-button.collapsed {
    background-color: #fff;
    color: #363363;
}

[data-bs-theme="light"] .accordion-body {
    color: #374151;
}

/* Breadcrumb */
.breadcrumb {
    background: none;
    padding: 0;
    margin-bottom: 0.5rem;
}

.breadcrumb-item a {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: #9ca3af;
}

/* List group */
.list-group-item {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #363363;
}

::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

/* Compact buttons */
.btn-sm {
    padding: 0.15rem 0.5rem !important;
    font-size: 0.82rem;
    line-height: 1.4;
}

.admin-btns .btn {
    padding: 0.1rem 0.6rem !important;
    font-size: 0.8rem;
    line-height: 1.5;
    height: 28px;
}

/* Responsive */
@media (max-width: 768px) {
    .stat-number {
        font-size: 1.5rem;
    }

    .btn-group {
        flex-wrap: wrap;
    }

    /* Stack header row on mobile */
    .row.mb-4 > .col,
    .row.mb-4 > .col-auto {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .row.mb-4 > .col-auto {
        margin-top: 0.5rem;
    }

    /* Make filter dropdowns full width on mobile */
    .filter-dropdown,
    .search-box {
        width: 100% !important;
        min-width: unset !important;
    }

    /* Stack filter row */
    .d-flex.gap-3.flex-wrap {
        gap: 0.5rem !important;
    }

    /* Navbar compact */
    .navbar-brand {
        font-size: 1rem;
    }

    .navbar-nav .nav-link {
        padding: 0.4rem 0.5rem;
        font-size: 0.9rem;
    }

    /* Tables scroll horizontally */
    .table-responsive {
        font-size: 0.85rem;
    }

    .table th, .table td {
        padding: 0.4rem 0.5rem;
        white-space: nowrap;
    }

    /* Cards full width */
    .col-md-6, .col-lg-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Container less padding */
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Modals full width on mobile */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    /* Bulk bar compact */
    #bulkBar {
        font-size: 0.85rem;
        padding: 0.5rem !important;
    }
}

/* Dropdown dark */
.dropdown-menu-dark {
    background-color: #363363;
    border-color: #374151;
}

.dropdown-menu-dark .dropdown-item:hover {
    background-color: #3d3a6e;
}

/* Pre/code styling */
pre {
    background-color: #3d3a6e;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #374151;
}
