/* Eagle Traders - Bootstrap 5.3 Custom Theme */
/* Mobile-First Red Theme */

:root {
    --bs-primary: #DC2626;
    --bs-primary-rgb: 220, 38, 38; /* FIXED */
    --primary: #DC2626;
    --primary-dark: #B91C1C;
    --primary-light: #FEE2E2;
    --bs-body-font-family: 'Inter', sans-serif;
}
/* Override Bootstrap Primary */
.bg-primary { background-color: var(--primary) !important; }
.btn-primary { 
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
}
.btn-primary:hover, .btn-primary:focus { 
    background: linear-gradient(135deg, var(--primary-dark) 0%, #991B1B 100%);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}
.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
}
.text-primary { color: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }

/* Body */
body {
    font-family: 'Inter', sans-serif;
    background: #F8FAFC;
    min-height: 100vh;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Offcanvas Sidebar */
.offcanvas {
    width: 280px !important;
}

.offcanvas .nav-link {
    padding: 0.875rem 1.25rem;
    color: #374151;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.offcanvas .nav-link:hover,
.offcanvas .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
}

.offcanvas .nav-link i {
    width: 24px;
}

/* Desktop Sidebar */
.sidebar-desktop {
    position: fixed;
    top: 56px;
    left: 0;
    width: 240px;
    height: calc(100vh - 56px);
    background: white;
    border-right: 1px solid #E5E7EB;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-desktop .nav-link {
    padding: 0.875rem 1.25rem;
    color: #374151;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.sidebar-desktop .nav-link:hover,
.sidebar-desktop .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
}

/* Main Content */
.main-content {
    padding-top: 70px;
}

@media (min-width: 992px) {
    .main-content {
        margin-left: 240px;
    }
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card-header {
    background: white;
    border-bottom: 1px solid #E5E7EB;
    font-weight: 600;
}

/* Stat Cards */
.stat-card {
    border-radius: 12px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.red { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; }
.stat-icon.green { background: linear-gradient(135deg, #10B981 0%, #059669 100%); color: white; }
.stat-icon.blue { background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%); color: white; }
.stat-icon.orange { background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%); color: white; }

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    background: #F9FAFB;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6B7280;
    border-bottom-width: 1px;
}

.table td {
    vertical-align: middle;
}

/* Modal Improvements */
.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 0;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-content {
    border: none;
    border-radius: 12px;
    overflow: hidden;
}

/* Form Controls */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.15);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
    font-size: 1.5rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.fab:hover {
    transform: scale(1.1);
    color: white;
}

/* Bill Items */
.item-row {
    background: #F9FAFB;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

/* Bill Totals */
.bill-totals {
    background: #F9FAFB;
    border-radius: 8px;
    padding: 1rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #E5E7EB;
}

.total-row:last-child {
    border-bottom: none;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--primary);
}

.amount-words {
    font-size: 0.875rem;
    color: #6B7280;
    font-style: italic;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #D1D5DB;
}

/* Bill Document */
.bill-document {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.bill-header {
    text-align: center;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary);
    margin-bottom: 1.5rem;
}

.bill-header h1 {
    color: var(--primary);
}

/* WYSIWYG Editor */
.wysiwyg-container {
    border: 1px solid #DEE2E6;
    border-radius: 8px;
    overflow: hidden;
}

.wysiwyg-toolbar {
    background: #F9FAFB;
    padding: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    border-bottom: 1px solid #DEE2E6;
}

.wysiwyg-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.wysiwyg-btn:hover {
    background: var(--primary);
    color: white;
}

.wysiwyg-editor {
    min-height: 200px;
    padding: 1rem;
    outline: none;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #9CA3AF;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #EF4444 100%);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
    color: white;
}

/* Badges */
.badge-gst {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

/* Responsive Tables */
@media (max-width: 767.98px) {
    .table-responsive-stack tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #E5E7EB;
        border-radius: 8px;
        overflow: hidden;
    }
    
    .table-responsive-stack td {
        display: flex;
        justify-content: space-between;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #E5E7EB;
    }
    
    .table-responsive-stack td:last-child {
        border-bottom: none;
    }
    
    .table-responsive-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6B7280;
    }
    
    .table-responsive-stack thead {
        display: none;
    }
}

/* Print Styles */
@media print {
    .navbar, .sidebar-desktop, .offcanvas, .fab, .no-print {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .bill-document {
        box-shadow: none;
    }
}

/* PWA Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 2000;
    display: none;
}

/* Toast Notifications */
.toast-container {
    z-index: 1100;
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}
