/* ============================================
   MD Group of Enterprises - Billing System
   Dark Theme with Gold Accents
   ============================================ */

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: rgba(20, 20, 20, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --gold: #d4a843;
    --gold-light: #f0d078;
    --gold-dark: #b8922e;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #999999;
    --border-color: rgba(212, 168, 67, 0.2);
    --border-glass: rgba(255, 255, 255, 0.08);
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 3px; }

/* ========== GATEWAY PAGE ========== */
.gateway-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.gateway-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(212, 168, 67, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(212, 168, 67, 0.03) 0%, transparent 50%);
    animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-20px, -20px); }
}

.gateway-header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    z-index: 1;
}

.gateway-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 30px rgba(212, 168, 67, 0.3);
    letter-spacing: 2px;
}

.gateway-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* Glass Cards */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 2rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 168, 67, 0.05), transparent);
    transition: left 0.6s;
}

.glass-card:hover::before {
    left: 100%;
}

.glass-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--gold);
    box-shadow: 0 20px 60px rgba(212, 168, 67, 0.15),
                0 0 30px rgba(212, 168, 67, 0.1);
}

.glass-card .card-icon {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #000;
    margin-bottom: 1.2rem;
    box-shadow: 0 8px 20px rgba(212, 168, 67, 0.3);
}

.glass-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.glass-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.glass-card .lock-icon {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    color: var(--gold);
    font-size: 1.1rem;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.glass-card:hover .lock-icon {
    opacity: 1;
}

/* Login Modal */
.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
}

.modal-header .modal-title {
    color: var(--gold);
    font-weight: 600;
}

.modal-header .btn-close {
    filter: invert(1);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
}

/* Form Controls */
.form-control, .form-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 0.7rem 1rem;
    transition: all 0.3s;
}

.form-control:focus, .form-select:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.15);
    color: var(--text-primary);
}

.form-control:disabled, .form-control[readonly] {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    opacity: 1;
}

/* Fix dropdown option visibility in dark mode */
.form-select option {
    background: #1a1a1a;
    color: #ffffff;
}
[data-theme="light"] .form-select option {
    background: #ffffff;
    color: #333333;
}

.form-control::placeholder {
    color: #888;
}

.form-label {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

/* Buttons */
.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #000;
    border: none;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    border-radius: 10px;
    transition: all 0.3s;
    letter-spacing: 0.5px;
}

.btn-gold:hover {
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 168, 67, 0.3);
}

.btn-outline-gold {
    background: transparent;
    color: var(--gold);
    border: 1px solid var(--gold);
    font-weight: 500;
    padding: 0.5rem 1.2rem;
    border-radius: 10px;
    transition: all 0.3s;
}

.btn-outline-gold:hover {
    background: var(--gold);
    color: #000;
}

/* ========== SIDEBAR ========== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand h4 {
    color: var(--gold);
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 1px;
}

.sidebar-brand small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-section {
    padding: 0.8rem 1.5rem 0.4rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 2px;
    font-weight: 600;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.7rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
}

.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: 0.8rem;
    text-align: center;
    font-size: 0.95rem;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    color: var(--gold);
    background: rgba(212, 168, 67, 0.08);
    border-left-color: var(--gold);
}

/* ========== MAIN CONTENT ========== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 0;
}

/* Top Bar */
.top-bar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar .page-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.top-bar .user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-bar .user-info .user-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.top-bar .user-info .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: 600;
    font-size: 0.9rem;
}

.content-wrapper {
    padding: 1.5rem;
}

/* ========== STAT CARDS ========== */
.stat-card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 1.5rem;
    transition: all 0.3s;
    height: 100%;
}

.stat-card:hover {
    border-color: var(--border-color);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.stat-card .stat-icon.income { background: rgba(40, 167, 69, 0.15); color: var(--success); }
.stat-card .stat-icon.expense { background: rgba(220, 53, 69, 0.15); color: var(--danger); }
.stat-card .stat-icon.profit { background: rgba(212, 168, 67, 0.15); color: var(--gold); }
.stat-card .stat-icon.info { background: rgba(23, 162, 184, 0.15); color: var(--info); }

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.3rem;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card .stat-change {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.stat-card .stat-change.positive { color: var(--success); }
.stat-card .stat-change.negative { color: var(--danger); }

/* ========== DATA TABLE ========== */
.data-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.data-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-glass);
    padding: 1.2rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.data-card .card-header h5 {
    color: var(--gold);
    font-weight: 600;
    font-size: 1rem;
    margin: 0;
}

.data-card .card-body {
    padding: 1.5rem;
}

.table-dark-custom {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
    --bs-table-hover-bg: rgba(212, 168, 67, 0.05);
    color: var(--text-primary);
    width: 100%;
}

.table-dark-custom thead th {
    border-bottom: 1px solid var(--border-color);
    color: var(--gold);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.8rem;
    white-space: nowrap;
}

.table-dark-custom tbody td {
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-glass);
    vertical-align: middle;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.table-dark-custom tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.badge-paid { background: rgba(40, 167, 69, 0.15); color: var(--success); }
.badge-unpaid { background: rgba(220, 53, 69, 0.15); color: var(--danger); }
.badge-partial { background: rgba(255, 193, 7, 0.15); color: var(--warning); }
.badge-pending { background: rgba(255, 193, 7, 0.15); color: var(--warning); }

.badge {
    font-weight: 500;
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    font-size: 0.78rem;
}

/* ========== CHARTS ========== */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ========== RESPONSIVE ========== */
.sidebar-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--gold);
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: inline-block;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 576px) {
    .gateway-header h1 {
        font-size: 1.5rem;
    }
    .stat-card .stat-value {
        font-size: 1.2rem;
    }
    .content-wrapper {
        padding: 1rem;
    }
}

/* ========== INVOICE PRINT ========== */
@media print {
    .sidebar, .top-bar, .no-print, .sidebar-overlay, footer {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
    body {
        background: #fff !important;
        color: #333 !important;
        padding: 0 !important;
    }
    .content-wrapper {
        padding: 0 !important;
    }
    .invoice-container {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        background: #fff !important;
        color: #333 !important;
    }
    .invoice-container * {
        color: #333 !important;
    }
    .invoice-header .company-info h2,
    .invoice-header .invoice-info h3 {
        color: #b8922e !important;
    }
    .invoice-header {
        border-bottom-color: #b8922e !important;
    }
    .invoice-container h6 {
        color: #b8922e !important;
    }
    .invoice-container .text-muted {
        color: #666 !important;
    }
    .table-dark-custom {
        color: #333 !important;
    }
    .table-dark-custom thead th {
        color: #b8922e !important;
        border-bottom-color: #b8922e !important;
        background: #f8f8f8 !important;
    }
    .table-dark-custom tbody td {
        color: #333 !important;
        border-bottom: 1px solid #eee !important;
    }
    .badge {
        border: 1px solid #ccc !important;
    }
}

/* Invoice */
.invoice-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 14px;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
    color: #333;
}

.invoice-container .text-muted {
    color: #666 !important;
}

.invoice-container h6 {
    color: var(--gold) !important;
}

.invoice-container .table-dark-custom {
    color: #333 !important;
}

.invoice-container .table-dark-custom thead th {
    color: var(--gold) !important;
    border-bottom-color: var(--gold) !important;
    background: #f8f8f8 !important;
}

.invoice-container .table-dark-custom tbody td {
    color: #333 !important;
    border-bottom: 1px solid #eee !important;
}

.invoice-container .badge {
    border: 1px solid #ccc;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--gold);
}

.invoice-header .company-info h2 {
    color: var(--gold);
    font-size: 1.4rem;
    font-weight: 700;
}

.invoice-header .company-info p,
.invoice-header .company-info .text-muted {
    color: #666 !important;
}

.invoice-header .invoice-info {
    text-align: right;
}

.invoice-header .invoice-info h3 {
    color: var(--gold);
    font-size: 1.8rem;
    font-weight: 700;
}

.invoice-header .invoice-info p {
    color: #333;
}

/* Action Buttons */
.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.3s;
    font-size: 0.85rem;
    cursor: pointer;
}

.action-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(212, 168, 67, 0.1);
}

.action-btn.delete:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(220, 53, 69, 0.1);
}

/* Pagination */
.pagination .page-item .page-link {
    background: var(--bg-secondary);
    border-color: var(--border-glass);
    color: var(--text-secondary);
}

.pagination .page-item.active .page-link {
    background: var(--gold);
    border-color: var(--gold);
    color: #000;
}

/* Alert customization */
.alert {
    border-radius: 10px;
    border: none;
}

/* Fix Bootstrap .text-muted visibility on dark backgrounds */
.text-muted {
    color: var(--text-muted) !important;
}
