/* ==========================================================================
   REGOS POS - MODERN ADMIN PANEL STYLESHEET
   Dark sleek professional theme matching POS terminal aesthetics
   ========================================================================== */

:root {
    --bg-main: #0b1120;
    --bg-sidebar: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #24344d;
    --bg-input: #0f172a;
    --border-color: #334155;
    --border-light: rgba(51, 65, 85, 0.5);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: rgba(37, 99, 235, 0.15);
    --cyan: #38bdf8;
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    --purple: #a855f7;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ==========================================================================
   LAYOUT: SIDEBAR + MAIN CONTENT
   ========================================================================== */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    height: var(--topbar-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    background: #0f172a;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.15rem;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #f8fafc;
}

.brand-subtitle {
    font-size: 0.72rem;
    color: var(--cyan);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-heading {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 12px 12px 6px 12px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.15s ease;
}

.menu-item i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    color: var(--text-dim);
    transition: color 0.15s ease;
}

.menu-item:hover {
    background: var(--bg-card);
    color: #f8fafc;
}

.menu-item:hover i {
    color: var(--cyan);
}

.menu-item.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.25) 0%, rgba(37, 99, 235, 0.08) 100%);
    color: #ffffff;
    border-left: 3px solid var(--primary);
}

.menu-item.active i {
    color: var(--cyan);
}

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid var(--border-color);
    background: #0b1120;
}

.btn-pos-terminal-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    transition: transform 0.1s, box-shadow 0.15s;
}

.btn-pos-terminal-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5);
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.admin-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0; /* Prevents overflow in flexbox */
}

/* Topbar */
.admin-topbar {
    height: var(--topbar-height);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 6px;
}

.page-title-box h1 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #f8fafc;
    line-height: 1.2;
}

.page-title-box p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-badge {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 30px;
}

.user-avatar {
    width: 30px;
    height: 30px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    color: white;
}

/* Page Body */
.admin-content {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ==========================================================================
   METRIC / STATS CARDS
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, border-color 0.15s;
}

.stat-card:hover {
    border-color: #475569;
    transform: translateY(-2px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
}

.stat-card.stat-success::before { background: var(--success); }
.stat-card.stat-warning::before { background: var(--warning); }
.stat-card.stat-cyan::before { background: var(--cyan); }
.stat-card.stat-purple::before { background: var(--purple); }

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 900;
    color: #f8fafc;
    letter-spacing: -0.5px;
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 600;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: var(--primary-light);
    color: var(--primary);
}

.stat-card.stat-success .stat-icon {
    background: var(--success-light);
    color: var(--success);
}

.stat-card.stat-warning .stat-icon {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-card.stat-cyan .stat-icon {
    background: rgba(56, 189, 248, 0.15);
    color: var(--cyan);
}

.stat-card.stat-purple .stat-icon {
    background: rgba(168, 85, 247, 0.15);
    color: var(--purple);
}

/* ==========================================================================
   CHARTS & GRAPHS GRID
   ========================================================================== */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i {
    color: var(--cyan);
}

.card-body {
    padding: 20px;
    flex: 1;
}

/* ==========================================================================
   TABLES & LISTS
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.admin-table thead {
    background: #0f172a;
}

.admin-table th {
    padding: 12px 16px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.admin-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-light);
    color: #e2e8f0;
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: rgba(30, 41, 59, 0.7);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: rgba(56, 189, 248, 0.15); color: var(--cyan); }
.badge-secondary { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

/* ==========================================================================
   BUTTONS & FORMS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-secondary {
    background: #0f172a;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #1e293b;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.78rem;
    border-radius: 6px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
}

/* Form inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
}

.form-control {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 0.92rem;
    color: #ffffff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* ==========================================================================
   MODAL DIALOGS
   ========================================================================== */
.admin-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.admin-modal-overlay.active {
    display: flex;
}

.admin-modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlide 0.15s ease-out;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(-16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.admin-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0f172a;
}

.admin-modal-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--cyan);
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
}

.admin-modal-close:hover {
    color: var(--danger);
}

.admin-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.admin-modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    background: #0f172a;
}

/* ==========================================================================
   ALERTS & TOASTS
   ========================================================================== */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--success);
    color: #34d399;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger);
    color: #f87171;
}

/* Pagination */
.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
}

.pagination-wrapper .pagination {
    display: flex;
    gap: 4px;
    list-style: none;
}

.pagination-wrapper .page-item .page-link {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
}

.pagination-wrapper .page-item.active .page-link {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLETS & PHONES)
   ========================================================================== */
@media (max-width: 992px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
    }

    .admin-main {
        margin-left: 0;
    }

    .btn-sidebar-toggle {
        display: block;
    }

    .admin-content {
        padding: 14px;
        gap: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 1.3rem;
    }
}

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