/* ============================================================
   Milton's Donuts - Custom Styles
   Built on Bootstrap 5.3
   ============================================================ */

/* ── CSS Variables / Theme ────────────────────────────── */
:root {
    --md-primary: #55398B;
    --md-primary-dark: #3E2A68;
    --md-primary-light: #8B74B8;
    --md-secondary: #4E3383;
    --md-accent: #C9985A;
    --md-bg: #f7f5fa;
    --md-sidebar-bg: #2E1F4E;
    --md-sidebar-text: #d8d0e8;
    --md-sidebar-active: #C9985A;
    --md-card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --md-border: #ddd6e8;
    --md-success: #3a8c5c;
    --md-danger: #c0392b;
    --md-warning: #e67e22;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--md-bg);
    color: #333;
}

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--md-sidebar-bg);
    color: var(--md-sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-brand img {
    max-width: 180px;
    height: auto;
    filter: brightness(0) invert(1);
}

.sidebar-section {
    padding: 0.75rem 1rem 0.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: var(--md-sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar-nav li a.active {
    background: rgba(201, 152, 90, 0.2);
    color: #fff;
    border-left-color: var(--md-sidebar-active);
}

.sidebar-nav li a .badge {
    margin-left: auto;
}

.sidebar-nav li a i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
}

/* ── Main Content ─────────────────────────────────────── */
.main-content {
    margin-left: 260px;
    padding: 0;
    min-height: 100vh;
}

.top-bar {
    background: #fff;
    border-bottom: 1px solid var(--md-border);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar .breadcrumb {
    margin: 0;
    background: none;
    padding: 0;
    font-size: 0.9rem;
}

.content-area {
    padding: 1.5rem;
}

/* ── Cards ────────────────────────────────────────────── */
.card {
    border: 1px solid var(--md-border);
    box-shadow: var(--md-card-shadow);
    border-radius: 0.5rem;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--md-border);
    font-weight: 600;
    padding: 0.875rem 1.25rem;
}

.stat-card {
    text-align: center;
    padding: 1.25rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--md-primary);
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Tables ───────────────────────────────────────────── */
.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    font-weight: 600;
    border-bottom-width: 2px;
}

.table td {
    vertical-align: middle;
}

.table-production input[type="number"] {
    width: 80px;
    text-align: center;
}

.table-production .qty-cell {
    font-weight: 600;
    font-size: 1.05rem;
}

.table-production .basket-cell {
    color: #888;
    font-size: 0.85rem;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn-primary {
    background-color: var(--md-primary);
    border-color: var(--md-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--md-primary-dark);
    border-color: var(--md-primary-dark);
}

.btn-outline-primary {
    color: var(--md-primary);
    border-color: var(--md-primary);
}

.btn-outline-primary:hover {
    background-color: var(--md-primary);
    border-color: var(--md-primary);
}

.btn-success {
    background-color: var(--md-success);
    border-color: var(--md-success);
}

.btn-danger {
    background-color: var(--md-danger);
    border-color: var(--md-danger);
}

/* ── Late Order Queue ─────────────────────────────────── */
.late-order-card {
    border-left: 4px solid var(--md-warning);
    margin-bottom: 0.75rem;
}

.late-order-card.accepted {
    border-left-color: var(--md-success);
    opacity: 0.7;
}

.late-order-card.declined {
    border-left-color: #999;
    opacity: 0.5;
}

/* ── Login Page ───────────────────────────────────────── */
.login-container {
    max-width: 400px;
    margin: 80px auto;
    padding: 2rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo img {
    max-width: 280px;
    height: auto;
}

/* ── Tablet Styles ────────────────────────────────────── */
.tablet-body {
    background: var(--md-bg);
}

.tablet-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.tablet-header {
    text-align: center;
    padding: 1rem 0;
    border-bottom: 2px solid var(--md-border);
    margin-bottom: 1.5rem;
}

.pin-input {
    text-align: center;
    font-size: 2rem;
    letter-spacing: 0.5rem;
    max-width: 300px;
    margin: 0 auto;
    padding: 0.75rem;
}

.tablet-item {
    background: #fff;
    border: 1px solid var(--md-border);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tablet-item .item-name {
    flex: 1;
    font-weight: 600;
    font-size: 1.1rem;
}

.tablet-item .item-sent {
    color: #888;
    font-size: 0.9rem;
}

.tablet-item input[type="number"] {
    width: 100px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    padding: 0.5rem;
}

.tablet-item .item-photo {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 0.375rem;
}

/* ── Forecast Comparison ──────────────────────────────── */
.forecast-table th {
    white-space: nowrap;
    font-size: 0.75rem;
}

.forecast-highlight {
    background: rgba(85, 57, 139, 0.08);
    font-weight: 600;
}

/* ── Toast / Notifications ────────────────────────────── */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

/* ── Loading States ───────────────────────────────────── */
.loading-spinner {
    text-align: center;
    padding: 3rem;
    color: #aaa;
}

.skeleton {
    background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Empty States ─────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #999;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* ── Mobile Responsive ────────────────────────────────── */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

/* ── Print Styles ─────────────────────────────────────── */
@media print {
    .sidebar,
    .top-bar,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .content-area {
        padding: 0 !important;
    }

    .card {
        border: none !important;
        box-shadow: none !important;
    }

    body {
        background: #fff;
        font-size: 11pt;
    }

    .table {
        font-size: 10pt;
    }

    .table th,
    .table td {
        padding: 4px 8px;
    }

    .print-header {
        text-align: center;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
        border-bottom: 2px solid #000;
    }

    .print-header img {
        max-width: 200px;
        height: auto;
    }

    .print-header h2,
    .print-header h4 {
        margin: 0;
        font-size: 14pt;
    }

    .print-header p {
        margin: 0.25rem 0 0;
        font-size: 11pt;
    }

    .page-break {
        page-break-before: always;
    }

    @page {
        margin: 0.75in;
    }
}
