/* 
 * Custom Styles
 * Mani Savour Restaurant Management System
 * Theme: Modern Clean Dark (SaaS Aesthetic)
 */

:root {
    /* Color Palette - Modern Dark SaaS */
    --primary-color: #6366f1;
    /* Indigo 500 */
    --primary-hover: #818cf8;
    /* Indigo 400 */
    --primary-soft: rgba(99, 102, 241, 0.15);
    /* Indigo low opacity */

    --secondary-color: #94a3b8;
    /* Slate 400 */
    --success-color: #10b981;
    /* Emerald 500 */
    --danger-color: #ef4444;
    /* Red 500 */
    --warning-color: #f59e0b;
    /* Amber 500 */
    --info-color: #3b82f6;
    /* Blue 500 */

    /* Dark Theme Surfaces */
    --bs-body-bg: #0f172a;
    /* Slate 900 */
    --bs-body-color: #e2e8f0;
    /* Slate 200 */
    --card-bg: #1e293b;
    /* Slate 800 */
    --card-border: #334155;
    /* Slate 700 */
    --heading-color: #f8fafc;
    /* Slate 50 */

    /* Override Bootstrap Primary */
    --bs-primary: #6366f1;
    --bs-primary-rgb: 99, 102, 241;
    --bs-link-color: #818cf8;

    /* Typography */
    --font-main: 'Inter', -apple-system, sans-serif;
    --radius-main: 12px;
}

/* General Styles */
body {
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand {
    font-weight: 600;
    color: var(--heading-color);
    letter-spacing: -0.025em;
}

.container-fluid {
    flex: 1;
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

/* Navbar - Clean Dark */
.navbar {
    background-color: #1e293b !important;
    /* Slate 800 */
    border-bottom: 1px solid var(--card-border);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand i {
    color: var(--primary-color);
}

.nav-link {
    color: #94a3b8 !important;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: #fff !important;
    background-color: var(--primary-soft);
}

/* Cards - Modern Dark */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-main);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
    border-color: #475569;
}

.card-header {
    background-color: transparent !important;
    border-bottom: 1px solid var(--card-border);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: var(--heading-color);
}

.card-footer {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border-top: 1px solid var(--card-border);
}

/* Dashboard Stats - Vibrant Gradients */
.card.bg-primary {
    background: linear-gradient(145deg, #6366f1, #4f46e5) !important;
    border: none;
    color: white !important;
}

.card.bg-success {
    background: linear-gradient(145deg, #10b981, #059669) !important;
    border: none;
    color: white !important;
}

.card.bg-warning {
    background: linear-gradient(145deg, #f59e0b, #d97706) !important;
    border: none;
    color: white !important;
}

.card.bg-info {
    background: linear-gradient(145deg, #3b82f6, #2563eb) !important;
    border: none;
    color: white !important;
}

/* Tables - Clean Dark Rows */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--bs-body-color);
    margin-bottom: 0;
    border-color: var(--card-border);
}

.table thead th {
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--card-border);
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem 1.5rem;
}

.table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

/* Buttons - Modern Pop */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.btn-outline-primary {
    color: #818cf8;
    border-color: #6366f1;
    background-color: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

/* Inputs - sleek & dark */
.form-control,
.form-select {
    background-color: #0f172a;
    /* Darker than card */
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.65rem 1rem;
    color: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    background-color: #0f172a;
    color: #fff;
}

.form-control::placeholder {
    color: #64748b;
}

.input-group-text {
    background-color: var(--card-border);
    border: 1px solid var(--card-border);
    color: #94a3b8;
}

/* Badges */
.badge {
    padding: 0.4em 0.8em;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.025em;
}

.bg-success {
    background-color: rgba(16, 185, 129, 0.2) !important;
    color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.bg-warning {
    background-color: rgba(245, 158, 11, 0.2) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.bg-danger {
    background-color: rgba(239, 68, 68, 0.2) !important;
    color: #f87171 !important;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.bg-secondary {
    background-color: rgba(148, 163, 184, 0.2) !important;
    color: #cbd5e1 !important;
}

/* Login Page */
.login-container {
    background-color: #020617;
    background-image: radial-gradient(circle at top right, #1e1b4b, transparent 40%), radial-gradient(circle at bottom left, #312e81, transparent 40%);
}

.login-card .card {
    background-color: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
}

.login-header {
    background-color: transparent;
    border-bottom: 1px solid var(--card-border);
    padding: 2.5rem 2rem 1rem;
    text-align: center;
}

/* Order Page Improvements */
.category-section h6 {
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--card-border);
    padding-bottom: 0.5rem;
    margin-top: 1.5rem;
}

#categoryFilters .btn {
    border-radius: 9999px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bs-body-bg);
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Utilities Reverts (Forced Dark) */
.bg-white {
    background-color: var(--card-bg) !important;
    color: var(--bs-body-color) !important;
}

.bg-light {
    background-color: #0f172a !important;
    color: var(--bs-body-color) !important;
}

.text-muted {
    color: #94a3b8 !important;
}

/* 
 * ------------------------------------------------------------------
 * BC-87AC Thermal Printer Configuration (80mm) - Strict Black & White
 * ------------------------------------------------------------------
 */
@media print {
    @page {
        size: 80mm auto;
        margin: 0;
    }

    html,
    body {
        width: 80mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        color: #000 !important;
        /* Pure Black */
        font-family: 'Courier New', monospace !important;
        font-size: 12px !important;
        line-height: 1.2 !important;
        height: auto !important;
        min-height: 0 !important;
    }

    /* Force All Colors to Black */
    * {
        color: #000 !important;
        border-color: #000 !important;
        text-shadow: none !important;
        box-shadow: none !important;
    }

    /* Hide screen elements */
    .navbar,
    footer,
    .no-print,
    .btn,
    .d-print-none,
    .card-footer {
        display: none !important;
    }

    /* Reset Container Styles */
    .card,
    .card-body,
    .invoice-container {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }

    /* Header Styles */
    .text-center {
        text-align: center !important;
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        color: #000 !important;
        font-weight: bold !important;
        margin: 2px 0 !important;
    }

    h1.display-6 {
        font-size: 18px !important;
        text-transform: uppercase;
    }

    p {
        margin: 0 0 2px 0 !important;
        font-size: 12px !important;
    }

    .small {
        font-size: 11px !important;
    }

    /* Divider */
    hr {
        border-top: 1px dashed #000 !important;
        opacity: 1 !important;
        margin: 5px 0 !important;
    }

    /* Layout Flattening */
    .row {
        display: block !important;
        margin: 0 !important;
    }

    .col-6,
    .col-lg-8,
    .col-md-6 {
        width: 100% !important;
        padding: 0 !important;
        margin: 2px 0 !important;
        text-align: left !important;
    }

    /* Fix alignment for "Bill Info" vs "Date" */
    /* We want them to just list out vertically or be compact */
    h5 {
        font-size: 12px !important;
        text-decoration: underline;
        margin-top: 5px !important;
    }

    /* Table Styling */
    .table-responsive {
        overflow: visible !important;
    }

    .table {
        width: 100% !important;
        color: #000 !important;
        margin-bottom: 5px !important;
        border-collapse: collapse !important;
    }

    .table th {
        border-bottom: 1px solid #000 !important;
        text-transform: uppercase;
        font-size: 10px !important;
        padding: 2px 0 !important;
    }

    .table td {
        border-bottom: 1px dashed #000 !important;
        font-size: 11px !important;
        padding: 4px 0 !important;
    }

    .table th:nth-child(2),
    .table td:nth-child(2) {
        width: 45%;
    }

    /* Item Name wider */
    .table .text-end {
        text-align: right !important;
    }

    .table .text-center {
        text-align: center !important;
    }

    /* Totals Styling */
    .table-borderless td {
        border: none !important;
        padding: 2px 0 !important;
        text-align: right !important;
    }

    .table-borderless td:first-child {
        font-weight: bold;
    }

    /* Reset Spacing for Compact Print */
    .mb-4,
    .mb-3,
    .my-4,
    .my-3,
    .p-5,
    .p-4,
    .py-5 {
        margin: 2px 0 !important;
        padding: 0 !important;
    }

    /* Footer Compaction */
    .footer-details {
        margin-top: 5px !important;
    }

    .footer-details p {
        margin: 0 !important;
    }

    .footer-details .mt-2 {
        margin-top: 5px !important;
        padding-top: 2px !important;
    }

    /* Allow main containers to break naturally */
    .card,
    .card-body,
    .invoice-container,
    div {
        page-break-inside: auto !important;
        break-inside: auto !important;
    }

    /* Only prevent breaking inside specific atoms */
    tr,
    .footer-details,
    h1,
    h2,
    h5,
    .border-bottom {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    h4 {
        font-size: 14px !important;
        margin: 5px 0 !important;
    }

    /* Badges to Text */
    .badge {
        border: none !important;
        background: transparent !important;
        color: #000 !important;
        padding: 0 !important;
        font-weight: normal !important;
        font-style: italic;
    }

    .badge::before {
        content: "[";
    }

    .badge::after {
        content: "]";
    }

    /* Thank you footer */
    .text-muted {
        color: #000 !important;
        font-style: italic;
    }

    /* Force Black Text on Cards for Reports */
    .card,
    .card-header,
    .card-body {
        border: none !important;
        box-shadow: none !important;
        background-color: #fff !important;
        color: #000 !important;
        padding: 0 !important;
    }

    .bg-primary,
    .bg-info,
    .text-white,
    .text-white-50 {
        background-color: #fff !important;
        color: #000 !important;
    }

    /* Ensure borders are black for tables */
    .table-hover tbody tr:hover {
        background-color: #fff !important;
    }

    /* Make headers bold */
    h6,
    h2,
    h5 {
        color: #000 !important;
    }

    /* Hide card headers that are just purely decorative wrappers in print */
    .card-header {
        border-bottom: 2px solid #000 !important;
        margin-bottom: 5px !important;
        background: none !important;
    }

    /* CRITICAL: Ensure d-print-none actually hides elements, overriding .row{display:block} */
    .d-print-none {
        display: none !important;
    }
}