/* ============================================
   PASTA & CO — BACKOFFICE THEME
   Light, warm, artisanal design
   ============================================ */

:root {
    /* Backgrounds */
    --bo-bg: #f5f0e8;
    --bo-surface: #ffffff;
    --bo-surface-hover: #fdf8f0;
    --bo-border: #e0d6c8;
    --bo-border-light: #ebe3d6;

    /* Accent — Golden */
    --bo-accent: #c8940a;
    --bo-accent-bright: #daa520;
    --bo-accent-glow: rgba(200, 148, 10, 0.10);
    --bo-accent-gradient: linear-gradient(135deg, #daa520, #c8940a);

    /* Text */
    --bo-text: #2d2a26;
    --bo-text-muted: #8c7e6a;

    /* Sidebar — Dark Wood */
    --bo-sidebar-bg: #2a2118;
    --bo-sidebar-hover: #3a3028;
    --bo-sidebar-border: #3e332a;
    --bo-sidebar-text: #c4b8a8;
    --bo-sidebar-text-active: #daa520;

    /* Semantic */
    --bo-success: #2d9f5e;
    --bo-warning: #d4a017;
    --bo-danger: #c24a3a;
    --bo-info: #4a85b5;

    /* Layout */
    --sidebar-width: 260px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(45, 33, 24, 0.06);
    --shadow-md: 0 4px 12px rgba(45, 33, 24, 0.08);
    --shadow-lg: 0 8px 24px rgba(45, 33, 24, 0.10);
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background: var(--bo-bg);
    color: var(--bo-text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========== SIDEBAR ========== */
.bo-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bo-sidebar-bg);
    background-image: linear-gradient(180deg, rgba(58, 48, 40, 0.3) 0%, transparent 100%);
    border-right: 1px solid var(--bo-sidebar-border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
}

.bo-sidebar .brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--bo-sidebar-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bo-sidebar .brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--bo-accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(200, 148, 10, 0.35);
}

.bo-sidebar .brand-text {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
    color: #f0e8d8;
}

.bo-sidebar .brand-text small {
    display: block;
    font-weight: 400;
    font-size: 0.7rem;
    color: var(--bo-sidebar-text);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.bo-sidebar nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.bo-sidebar .nav-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #7a6e5e;
    padding: 0.75rem 0.75rem 0.5rem;
}

.bo-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    color: var(--bo-sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.bo-sidebar .nav-link:hover {
    background: var(--bo-sidebar-hover);
    color: #f0e8d8;
}

.bo-sidebar .nav-link.active {
    background: rgba(218, 165, 32, 0.12);
    color: var(--bo-sidebar-text-active);
}

.bo-sidebar .nav-link i {
    font-size: 1.15rem;
    width: 1.5rem;
    text-align: center;
}

/* ========== MAIN CONTENT ========== */
.bo-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(.4,0,.2,1);
}

.bo-topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    padding: 1rem 2rem;
    background: rgba(245, 240, 232, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--bo-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bo-topbar h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
    color: var(--bo-text);
}

.bo-content {
    padding: 2rem;
}

/* ========== STAT CARDS ========== */
.stat-card {
    background: var(--bo-surface);
    border: 1px solid var(--bo-border-light);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 16px 16px 0 0;
}

.stat-card.accent::before { background: var(--bo-accent-gradient); }
.stat-card.success::before { background: linear-gradient(90deg, var(--bo-success), #3cb371); }
.stat-card.info::before { background: linear-gradient(90deg, var(--bo-info), #5a9fd4); }
.stat-card.danger::before { background: linear-gradient(90deg, var(--bo-danger), #d45a4a); }

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

.stat-card.accent .stat-icon { background: var(--bo-accent-glow); color: var(--bo-accent); }
.stat-card.success .stat-icon { background: rgba(45, 159, 94, 0.10); color: var(--bo-success); }
.stat-card.info .stat-icon { background: rgba(74, 133, 181, 0.10); color: var(--bo-info); }
.stat-card.danger .stat-icon { background: rgba(194, 74, 58, 0.10); color: var(--bo-danger); }

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--bo-text);
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--bo-text-muted);
    font-weight: 500;
}

/* ========== TABLE ========== */
.bo-table-wrapper {
    background: var(--bo-surface);
    border: 1px solid var(--bo-border-light);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.bo-table-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--bo-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.bo-table-header h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: var(--bo-text);
}

.bo-table-header .bo-search {
    position: relative;
}

.bo-table-header .bo-search input {
    background: var(--bo-bg);
    border: 1px solid var(--bo-border);
    border-radius: 10px;
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;
    color: var(--bo-text);
    font-size: 0.85rem;
    width: 280px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bo-table-header .bo-search input::placeholder {
    color: var(--bo-text-muted);
}

.bo-table-header .bo-search input:focus {
    outline: none;
    border-color: var(--bo-accent);
    box-shadow: 0 0 0 3px var(--bo-accent-glow);
}

.bo-table-header .bo-search i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bo-text-muted);
    font-size: 0.9rem;
}

.bo-table {
    width: 100%;
    border-collapse: collapse;
}

.bo-table thead th {
    padding: 0.85rem 1.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bo-text-muted);
    background: #faf6ef;
    border-bottom: 1px solid var(--bo-border);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.bo-table thead th:hover {
    color: var(--bo-accent);
}

.bo-table thead th.sorted-asc::after {
    content: ' ▲';
    font-size: 0.6rem;
    color: var(--bo-accent);
}

.bo-table thead th.sorted-desc::after {
    content: ' ▼';
    font-size: 0.6rem;
    color: var(--bo-accent);
}

.bo-table tbody tr {
    border-bottom: 1px solid var(--bo-border-light);
    transition: background 0.15s ease;
}

.bo-table tbody tr:last-child {
    border-bottom: none;
}

.bo-table tbody tr:hover {
    background: var(--bo-surface-hover);
}

.bo-table tbody td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    vertical-align: middle;
    white-space: nowrap;
    color: var(--bo-text);
}

.bo-table .order-id {
    font-weight: 700;
    color: var(--bo-accent);
    font-size: 0.85rem;
}

.bo-table .client-name {
    font-weight: 600;
    color: var(--bo-text);
}

.bo-table .client-email {
    font-size: 0.78rem;
    color: var(--bo-text-muted);
}

/* ========== STATUS BADGES ========== */
.bo-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.bo-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.bo-badge.paid { background: rgba(45, 159, 94, 0.10); color: var(--bo-success); }
.bo-badge.paid::before { background: var(--bo-success); }

.bo-badge.pending { background: rgba(212, 160, 23, 0.10); color: var(--bo-warning); }
.bo-badge.pending::before { background: var(--bo-warning); }

.bo-badge.cancelled { background: rgba(194, 74, 58, 0.10); color: var(--bo-danger); }
.bo-badge.cancelled::before { background: var(--bo-danger); }

.bo-badge.processing { background: rgba(74, 133, 181, 0.10); color: var(--bo-info); }
.bo-badge.processing::before { background: var(--bo-info); }

/* ========== AMOUNT ========== */
.amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--bo-text);
}

/* ========== ACTION BUTTONS ========== */
.bo-action-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--bo-border);
    background: transparent;
    color: var(--bo-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.bo-action-btn:hover {
    background: var(--bo-accent-glow);
    color: var(--bo-accent);
    border-color: var(--bo-accent-bright);
}

/* ========== LOADING SKELETON ========== */
.skeleton {
    background: linear-gradient(90deg, var(--bo-border-light) 25%, var(--bo-border) 50%, var(--bo-border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
    height: 18px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-row td {
    padding: 1rem 1.5rem;
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state i {
    font-size: 3rem;
    color: var(--bo-text-muted);
    margin-bottom: 1rem;
}

.empty-state p {
    color: var(--bo-text-muted);
    font-size: 0.9rem;
}

/* ========== MODAL ========== */
.modal-content {
    background: var(--bo-surface);
    border: 1px solid var(--bo-border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

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

.modal-header .modal-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--bo-text);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--bo-border);
    padding: 1rem 1.5rem;
}

/* ========== DETAIL ROWS ========== */
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--bo-border-light);
    font-size: 0.875rem;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .label {
    color: var(--bo-text-muted);
    font-weight: 500;
}

.detail-row .value {
    font-weight: 600;
    color: var(--bo-text);
}

.detail-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--bo-accent);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--bo-border-light);
}

.detail-section-title:first-child {
    margin-top: 0;
}

/* ========== PAGINATION ========== */
.bo-pagination {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--bo-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bo-pagination .info {
    font-size: 0.8rem;
    color: var(--bo-text-muted);
}

.bo-pagination .page-btns {
    display: flex;
    gap: 0.35rem;
}

.bo-pagination .page-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--bo-border);
    background: transparent;
    color: var(--bo-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
}

.bo-pagination .page-btn:hover {
    background: var(--bo-surface-hover);
    color: var(--bo-text);
    border-color: var(--bo-accent-bright);
}

.bo-pagination .page-btn.active {
    background: var(--bo-accent-gradient);
    color: #fff;
    border-color: var(--bo-accent);
    box-shadow: 0 2px 6px rgba(200, 148, 10, 0.3);
}

.bo-pagination .page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ========== TOAST ========== */
.bo-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bo-surface);
    border: 1px solid var(--bo-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    transform: translateY(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(.4,0,.2,1);
    color: var(--bo-text);
}

.bo-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.bo-toast.error {
    border-color: var(--bo-danger);
}

.bo-toast.error i {
    color: var(--bo-danger);
}

/* ========== FORM ELEMENTS (selects, inputs) ========== */
.form-select {
    background-color: var(--bo-surface) !important;
    border-color: var(--bo-border) !important;
    color: var(--bo-text) !important;
}

.form-select:focus {
    border-color: var(--bo-accent) !important;
    box-shadow: 0 0 0 3px var(--bo-accent-glow) !important;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 992px) {
    .bo-sidebar {
        transform: translateX(-100%);
    }
    .bo-sidebar.open {
        transform: translateX(0);
    }
    .bo-main {
        margin-left: 0;
    }
    .bo-table-header .bo-search input {
        width: 200px;
    }
}

@media (max-width: 576px) {
    .bo-content {
        padding: 1rem;
    }
    .bo-table-header .bo-search input {
        width: 160px;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}

.fade-in-up:nth-child(1) { animation-delay: 0s; }
.fade-in-up:nth-child(2) { animation-delay: 0.08s; }
.fade-in-up:nth-child(3) { animation-delay: 0.16s; }
.fade-in-up:nth-child(4) { animation-delay: 0.24s; }

/* ========== REFRESH BUTTON ========== */
.btn-refresh {
    background: transparent;
    border: 1px solid var(--bo-border);
    color: var(--bo-text-muted);
    border-radius: 10px;
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-refresh:hover {
    background: var(--bo-accent-glow);
    color: var(--bo-accent);
    border-color: var(--bo-accent-bright);
}

.btn-refresh.spinning i {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--bo-border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--bo-text-muted); }

/* ========== UTILITY OVERRIDES ========== */
.text-warning { color: var(--bo-accent) !important; }
.text-muted { color: var(--bo-text-muted) !important; }
.border-bottom { border-color: var(--bo-border) !important; }
.border-top { border-color: var(--bo-border) !important; }
.btn-outline-warning {
    color: var(--bo-accent) !important;
    border-color: var(--bo-accent) !important;
}
.btn-outline-warning:hover {
    background: var(--bo-accent) !important;
    color: #fff !important;
}
.btn-sm.btn-outline-warning {
    font-weight: 600;
    font-size: 0.8rem;
}
code {
    color: var(--bo-text) !important;
}
