/* admin.css - Cosmic Burger Admin Dashboard Styles */

:root {
    --admin-bg: #0f111a;
    --admin-sidebar-bg: #161925;
    --admin-card-bg: #1c2030;
    --admin-border: #2d334a;
    --admin-text-primary: #ffffff;
    --admin-text-secondary: #94a3b8;
    --admin-accent-blue: #3b82f6;
    --admin-accent-purple: #8b5cf6;
    --admin-accent-green: #10b981;
    --admin-accent-red: #ef4444;
    --admin-accent-orange: #f59e0b;
    --admin-accent-yellow: #eab308;
}

.admin-body {
    background-color: var(--admin-bg);
    color: var(--admin-text-primary);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--admin-sidebar-bg);
    border-right: 1px solid var(--admin-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 2rem 1.5rem;
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--admin-accent-blue), var(--admin-accent-purple));
    border-radius: 8px;
}

.logo-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    color: var(--admin-text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.9375rem;
    font-weight: 500;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--admin-text-primary);
}

.nav-item.active {
    background-color: var(--admin-accent-blue);
    color: white;
}

.nav-item i {
    width: 20px;
    height: 20px;
}

.badge {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-green { background-color: var(--admin-accent-green); color: white; }
.badge-red { background-color: var(--admin-accent-red); color: white; }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

.top-header {
    height: 80px;
    background-color: var(--admin-bg);
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.location-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--admin-card-bg);
    padding: 0.625rem 1.25rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.date-time {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.status-pill {
    background-color: var(--admin-accent-green);
    color: white;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--admin-text-secondary);
    cursor: pointer;
    position: relative;
    padding: 0.5rem;
}

.notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background-color: var(--admin-accent-red);
    border-radius: 50%;
    border: 2px solid var(--admin-bg);
}

.user-profile {
    width: 40px;
    height: 40px;
    background-color: var(--admin-accent-purple);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    cursor: pointer;
}

/* Content Area */
.content-area {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background-color: var(--admin-card-bg);
    border: 1px solid var(--admin-border);
    border-radius: 20px;
    padding: 1.5rem;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-label {
    color: var(--admin-text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
}

.stat-trend {
    font-size: 0.75rem;
    font-weight: 600;
}

.trend-up { color: var(--admin-accent-green); }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-sub {
    font-size: 0.8125rem;
    color: var(--admin-text-secondary);
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-purple { background-color: rgba(139, 92, 246, 0.1); color: var(--admin-accent-purple); }
.icon-red { background-color: rgba(239, 68, 68, 0.1); color: var(--admin-accent-red); }
.icon-orange { background-color: rgba(245, 158, 11, 0.1); color: var(--admin-accent-orange); }
.icon-yellow { background-color: rgba(234, 179, 8, 0.1); color: var(--admin-accent-yellow); }

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
}

.card {
    background-color: var(--admin-card-bg);
    border: 1px solid var(--admin-border);
    border-radius: 20px;
    padding: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-title h3 {
    margin: 0;
    font-size: 1.25rem;
}

.live-indicator {
    background-color: var(--admin-accent-green);
    color: white;
    font-size: 0.625rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.header-filters {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    background-color: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--admin-text-secondary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

.filter-btn.active {
    background-color: var(--admin-accent-blue);
    color: white;
}

/* Orders Grid */
.orders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.order-card {
    background-color: var(--admin-bg);
    border: 1px solid var(--admin-border);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-id {
    font-weight: 700;
    font-size: 1rem;
}

.order-status-tag {
    font-size: 0.625rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
}

.tag-new { background-color: var(--admin-accent-blue); color: white; }
.tag-preparing { background-color: var(--admin-accent-orange); color: white; }
.tag-ready { background-color: var(--admin-accent-green); color: white; }

.order-source {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--admin-text-secondary);
}

.source-icon {
    width: 60px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
}

.order-customer {
    font-weight: 600;
    font-size: 0.9375rem;
}

.order-items {
    font-size: 0.8125rem;
    color: var(--admin-text-secondary);
    line-height: 1.5;
}

.order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--admin-border);
}

.payment-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.paid { color: var(--admin-accent-green); }
.pending { color: var(--admin-accent-yellow); }

.order-time {
    font-size: 0.75rem;
    color: var(--admin-text-secondary);
}

/* Sidebar Cards */
.dashboard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.view-all {
    color: var(--admin-accent-blue);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 600;
}

.suppliers-list, .po-list, .inventory-list, .top-menu-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--admin-border);
}

.list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-name {
    font-weight: 600;
    font-size: 0.9375rem;
}

.item-sub {
    font-size: 0.75rem;
    color: var(--admin-text-secondary);
}

.status-label {
    font-size: 0.625rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
}

.status-active { color: var(--admin-accent-green); }
.status-delayed { color: var(--admin-accent-orange); }

.po-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Bottom Grid */
.dashboard-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 1.5rem;
}

.inventory-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.inventory-icon {
    width: 32px;
    height: 32px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inventory-details {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stock-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stock-value {
    font-weight: 700;
}

.stock-min {
    font-size: 0.75rem;
    color: var(--admin-text-secondary);
}

.stock-status {
    font-size: 0.625rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
}

.status-ok { background-color: rgba(16, 185, 129, 0.1); color: var(--admin-accent-green); }
.status-low { background-color: rgba(245, 158, 11, 0.1); color: var(--admin-accent-orange); }
.status-critical { background-color: rgba(239, 68, 68, 0.1); color: var(--admin-accent-red); }

/* Chart */
.chart-container {
    height: 200px;
    margin-bottom: 1.5rem;
}

.chart-stats {
    display: flex;
    justify-content: space-between;
    padding-top: 1.5rem;
    border-top: 1px solid var(--admin-border);
}

.chart-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chart-stat .label {
    font-size: 0.75rem;
    color: var(--admin-text-secondary);
    font-weight: 600;
}

.chart-stat .value {
    font-weight: 700;
    font-size: 1.125rem;
}

/* Top Menu */
.top-menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-item-img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
}

.menu-item-details {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-item-price {
    font-weight: 700;
    color: var(--admin-accent-green);
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-green { background-color: var(--admin-accent-green); color: white; }
.btn-purple { background-color: var(--admin-accent-purple); color: white; }
.btn-blue { background-color: var(--admin-accent-blue); color: white; }

.btn-purple-outline {
    background-color: rgba(139, 92, 246, 0.1);
    color: var(--admin-accent-purple);
    border: 1px solid rgba(139, 92, 246, 0.2);
    flex: 1;
}

.btn-gray-outline {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--admin-text-secondary);
    border: 1px solid var(--admin-border);
    flex: 1;
}

/* Responsive */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-bottom-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 80px;
    }
    .sidebar .logo-text, .nav-item span, .badge {
        display: none;
    }
    .main-content {
        margin-left: 80px;
    }
    .dashboard-bottom-grid {
        grid-template-columns: 1fr;
    }
}

.page-panel {
    display: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.page-panel.is-active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.stack-card {
    margin-bottom: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
}

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

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.95rem 0.75rem;
    border-bottom: 1px solid var(--admin-border);
    font-size: 0.92rem;
}

.admin-table th {
    color: var(--admin-text-secondary);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.action-cell {
    white-space: nowrap;
}

.empty-cell,
.empty-box {
    color: var(--admin-text-secondary);
    text-align: center;
    padding: 1rem;
}

.text-red {
    color: var(--admin-accent-red);
}

.mini-pill {
    padding: 4px 8px;
    font-size: 0.72rem;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 26, 0.8);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 1.5rem;
    z-index: 300;
    pointer-events: none;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal-overlay.show {
    display: flex;
    pointer-events: auto;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.admin-modal {
    width: 100%;
    max-width: 760px;
    max-height: calc(100vh - 3rem);
    margin: auto 0;
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-border);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-modal .text-display {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--admin-card-bg);
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--admin-border);
}

.admin-modal .entity-form {
    overflow-y: auto;
    padding: 1.25rem 1.5rem 1.5rem;
}

.text-display {
    margin: 0 0 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    color: var(--admin-text-secondary);
    font-size: 0.86rem;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    box-sizing: border-box;
    background: var(--admin-bg);
    color: var(--admin-text-primary);
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
}

.form-group textarea {
    resize: vertical;
}

.modal-actions {
    position: sticky;
    bottom: -1.5rem;
    z-index: 5;
    margin: 1.25rem -1.5rem -1.5rem;
    padding: 1rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    background: var(--admin-card-bg);
    border-top: 1px solid var(--admin-border);
}

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    min-width: 240px;
    max-width: 320px;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    color: #fff;
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.2s ease;
    box-shadow: 0 12px 24px rgba(0,0,0,0.25);
}

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

.toast-success {
    background: rgba(16, 185, 129, 0.95);
}

.toast-error {
    background: rgba(239, 68, 68, 0.95);
}

.quick-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.wide-btn {
    width: 100%;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Products dropdown and product editor updates */
.nav-dropdown {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav-dropdown-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}

.nav-dropdown-toggle .nav-chevron {
    margin-left: auto;
    transition: transform 0.2s ease;
}

.nav-dropdown-toggle.open .nav-chevron {
    transform: rotate(180deg);
}

.nav-submenu {
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    padding-left: 3.25rem;
}

.nav-submenu.open {
    display: flex;
}

.nav-subitem {
    color: var(--admin-text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.nav-subitem:hover,
.nav-subitem.active {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--admin-text-primary);
}

.admin-modal-wide {
    max-width: 980px;
}

.field-note {
    display: block;
    margin-top: 0.35rem;
    color: var(--admin-text-secondary);
    font-size: 0.8rem;
}

.current-image-preview {
    margin-top: 0.75rem;
}

.current-image-preview img {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.tox-tinymce {
    border-radius: 12px !important;
}

.settings-card .form-grid {
    gap: 1rem;
}

.settings-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: flex-start;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.settings-save-status {
    min-height: 1rem;
}


.admin-list-header {
    align-items: flex-start;
    gap: 1rem;
}

.card-subtitle {
    margin: 0.35rem 0 0;
    color: var(--admin-text-secondary);
    font-size: 0.9rem;
}

.admin-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
}

.toolbar-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.toolbar-field label {
    color: var(--admin-text-secondary);
    font-size: 0.82rem;
}

.toolbar-field input,
.toolbar-field select {
    min-height: 42px;
}

.bulk-actions-bar {
    display: none;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 14px;
    background: rgba(59, 130, 246, 0.1);
}

.bulk-actions-bar.is-active {
    display: flex;
}

.check-col {
    width: 48px;
    text-align: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.status-green {
    color: #86efac;
    background: rgba(34, 197, 94, 0.13);
}

.status-gray {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.13);
}

.admin-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    color: var(--admin-text-secondary);
    flex-wrap: wrap;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pagination-buttons button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 900px) {
    .admin-toolbar {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .admin-toolbar {
        grid-template-columns: 1fr;
    }

    .admin-pagination {
        align-items: flex-start;
        flex-direction: column;
    }
}

.admin-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
}


.current-gallery-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.current-gallery-preview img {
    width: 74px;
    height: 74px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--admin-border, rgba(255,255,255,0.12));
}

.current-gallery-preview span {
    color: var(--admin-text-secondary);
    font-size: 13px;
}


/* Xero Settings */
.xero-status-box,
.xero-help-box {
    margin: 18px 0;
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.35);
    display: grid;
    gap: 8px;
}
.xero-help-box h4 { margin: 0 0 6px; }
.xero-help-box p { margin: 0; color: #94a3b8; }
.field-note { display: block; margin-top: 6px; color: #94a3b8; font-size: 12px; }
.full-width { grid-column: 1 / -1; }
