:root {
    --primary: #1d5545;
    --primary-hover: #154034;
    --primary-light: #e8f3ef;
    --accent: #c99436;
    --bg-main: #f6f8f7;
    --bg-card: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #3b82f6;
    --danger: #ef4444;
    --radius: 10px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
}

/* HEADER */
.admin-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 1.25rem;
}

.brand-badge {
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 0.35rem 0.55rem;
    border-radius: 6px;
    letter-spacing: 1px;
}

.brand-title i {
    font-style: normal;
    color: var(--accent);
    font-size: 0.9em;
}

.admin-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-tab {
    background: transparent;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.nav-tab:hover {
    background: var(--bg-main);
    color: var(--primary);
}

.nav-tab.active {
    background: var(--primary-light);
    color: var(--primary);
}

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

.admin-user-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-main);
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-storefront {
    text-decoration: none;
    background: #f3f4f6;
    color: #374151;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 0.85rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-storefront:hover {
    background: #e5e7eb;
}

.btn-logout {
    background: transparent;
    border: 1px solid #fca5a5;
    color: #dc2626;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #fee2e2;
}

/* MAIN CONTENT */
.admin-main {
    max-width: 1380px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.admin-view {
    display: none;
}

.admin-view.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.view-header h1 {
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* STATS GRID */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.stat-icon {
    font-size: 2.25rem;
    background: var(--bg-main);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

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

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

.stat-value {
    font-size: 1.6rem;
    color: var(--primary);
    font-weight: 700;
    margin: 0.2rem 0;
}

.stat-hint {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* PANELS & TABLES */
.card, .panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.panel-header h2 {
    font-size: 1.2rem;
    color: var(--text-main);
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

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

.admin-table th {
    background: #f9fafb;
    padding: 0.85rem 1rem;
    font-weight: 600;
    color: #4b5563;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.admin-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background-color: #fafbfc;
}

.text-center {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem !important;
}

/* BADGES */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.status-received {
    background: #fef3c7;
    color: #92400e;
}

.status-processing {
    background: #dbeafe;
    color: #1e40af;
}

.status-shipping {
    background: #f3e8ff;
    color: #6b21a8;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.payment-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.payment-paid {
    background: #d1fae5;
    color: #065f46;
}

.payment-pending {
    background: #fef3c7;
    color: #b45309;
}

/* BUTTONS & FORMS */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid var(--border);
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-refresh {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 0.55rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn-edit {
    background: #e0f2fe;
    color: #0369a1;
}

.btn-delete {
    background: #fee2e2;
    color: #b91c1c;
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.form-select, .form-input, .form-textarea {
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    font-family: inherit;
    background: #fff;
}

.form-select:focus, .form-input:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(29, 85, 69, 0.15);
}

/* DIALOG / MODAL */
.admin-dialog {
    border: none;
    border-radius: var(--radius);
    padding: 0;
    max-width: 650px;
    width: 90%;
    margin: auto;
    box-shadow: var(--shadow-lg);
    background: #fff;
}

.admin-dialog::backdrop {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
}

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

.dialog-header h2 {
    font-size: 1.25rem;
    color: var(--primary);
}

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

.dialog-form {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

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

.form-group span {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4b5563;
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* LOGIN OVERLAY */
.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-overlay.hidden {
    display: none;
}

.login-box {
    background: #fff;
    width: 90%;
    max-width: 440px;
    border-radius: var(--radius);
    padding: 2.25rem;
    box-shadow: var(--shadow-lg);
}

.login-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-brand .brand-badge {
    display: inline-block;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.8rem;
    font-size: 1.1rem;
}

.login-brand h2 {
    font-size: 1.5rem;
    color: var(--primary);
}

.login-brand p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.login-hint {
    font-size: 0.8rem;
    background: #fef3c7;
    color: #92400e;
    padding: 0.6rem 0.85rem;
    border-radius: 6px;
    margin: 1rem 0;
}

.login-error {
    color: #b91c1c;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.btn-block {
    width: 100%;
}

.login-back {
    text-align: center;
    margin-top: 1.25rem;
}

.login-back a {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-decoration: none;
}

.login-back a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* TOAST */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 9999;
}

.toast {
    background: #1f2937;
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.25s ease;
}

.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .admin-header {
        flex-direction: column;
        align-items: stretch;
    }
    .admin-nav {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.5rem;
    }
    .header-right {
        justify-content: space-between;
    }
}

