/* === Admin UI === */
:root {
    --admin-primary: #1e293b;
    --admin-accent: #3b82f6;
    --admin-accent-hover: #2563eb;
    --admin-danger: #ef4444;
    --admin-danger-hover: #dc2626;
    --admin-success: #22c55e;
    --admin-warning: #f59e0b;
    --admin-bg: #f1f5f9;
    --admin-card: #fff;
    --admin-border: #e2e8f0;
    --admin-text: #1e293b;
    --admin-muted: #64748b;
}

body.admin-body {
    background: var(--admin-bg);
    min-height: 100vh;
}

/* Login */
.admin-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-login__card {
    background: var(--admin-card);
    border-radius: 12px;
    padding: 40px;
    width: 380px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.admin-login__card h1 {
    font-size: 24px;
    text-align: center;
    margin-bottom: 8px;
    color: var(--admin-text);
}

.admin-login__card p {
    text-align: center;
    color: var(--admin-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.admin-login__error {
    background: #fef2f2;
    color: var(--admin-danger);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.admin-login__card .form-group input {
    padding: 12px 14px;
}

/* Header */
.admin-header {
    background: var(--admin-primary);
    color: #fff;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header__brand {
    font-size: 18px;
    font-weight: 700;
}

.admin-header__brand span {
    color: var(--admin-accent);
}

.admin-header__actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-header__user {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn--primary {
    background: var(--admin-accent);
    color: #fff;
}
.btn--primary:hover:not(:disabled) { background: var(--admin-accent-hover); }

.btn--danger {
    background: var(--admin-danger);
    color: #fff;
}
.btn--danger:hover:not(:disabled) { background: var(--admin-danger-hover); }

.btn--success {
    background: var(--admin-success);
    color: #fff;
}
.btn--success:hover:not(:disabled) { background: #16a34a; }

.btn--warning {
    background: var(--admin-warning);
    color: #fff;
}
.btn--warning:hover:not(:disabled) { background: #d97706; }

.btn--ghost {
    background: transparent;
    color: var(--admin-accent);
    padding: 6px 10px;
}
.btn--ghost:hover:not(:disabled) { background: #eff6ff; }

.btn--sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn--outline {
    background: transparent;
    border: 1px solid var(--admin-border);
    color: var(--admin-text);
}
.btn--outline:hover:not(:disabled) { background: #f8fafc; }

/* Layout */
.admin-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

/* Tabs */
.admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--admin-border);
    margin-bottom: 24px;
}

.admin-tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--admin-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.admin-tab:hover {
    color: var(--admin-text);
}

.admin-tab--active {
    color: var(--admin-accent);
    border-bottom-color: var(--admin-accent);
}

.admin-panel {
    display: none;
}

.admin-panel--active {
    display: block;
}

/* Stats bar */
.admin-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.admin-stat {
    background: var(--admin-card);
    border-radius: 8px;
    padding: 16px 20px;
    flex: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.admin-stat__value {
    font-size: 28px;
    font-weight: 700;
    color: var(--admin-text);
}

.admin-stat__label {
    font-size: 12px;
    color: var(--admin-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Product Table */
.admin-table-wrapper {
    background: var(--admin-card);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
}

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

.admin-table-toolbar h2 {
    font-size: 16px;
    font-weight: 700;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}

.admin-table th {
    text-align: left;
    padding: 10px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--admin-border);
    font-weight: 600;
    color: var(--admin-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--admin-border);
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: #f8fafc;
}

.admin-table__name {
    font-weight: 600;
    color: var(--admin-text);
}

.admin-table__actions {
    display: flex;
    gap: 3px;
    flex-wrap: nowrap;
}

.admin-table__actions .btn {
    white-space: nowrap;
    padding: 4px 8px;
}

/* Status pills */
.status-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill--in-stock {
    background: #dcfce7;
    color: #166534;
}

.status-pill--out-of-stock {
    background: #fee2e2;
    color: #991b1b;
}

.status-pill--on-sale {
    background: #fef3c7;
    color: #92400e;
}

/* Modal */
.admin-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

.admin-modal-backdrop--open {
    display: flex;
}

.admin-modal {
    background: var(--admin-card);
    border-radius: 12px;
    width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

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

.admin-modal__header h3 {
    font-size: 18px;
    font-weight: 700;
}

.admin-modal__close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--admin-muted);
    padding: 4px;
}

.admin-modal__body {
    padding: 24px;
}

.admin-modal__footer {
    padding: 16px 24px;
    border-top: 1px solid var(--admin-border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Events Feed */
.admin-events {
    background: var(--admin-card);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    max-height: 600px;
    overflow-y: auto;
}

.admin-events__header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--admin-card);
    z-index: 1;
}

.admin-events__header h2 {
    font-size: 16px;
    font-weight: 700;
}

.admin-event {
    padding: 12px 20px;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.admin-event:last-child {
    border-bottom: none;
}

.admin-event__icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.admin-event__icon--created { background: #dcfce7; }
.admin-event__icon--updated { background: #dbeafe; }
.admin-event__icon--deleted { background: #fee2e2; }
.admin-event__icon--sale { background: #fef3c7; }
.admin-event__icon--stock { background: #f3e8ff; }
.admin-event__icon--price { background: #ffedd5; }

.admin-event__content {
    flex: 1;
    min-width: 0;
}

.admin-event__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--admin-text);
}

.admin-event__detail {
    font-size: 12px;
    color: var(--admin-muted);
    margin-top: 2px;
}

.admin-event__time {
    font-size: 11px;
    color: var(--admin-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Price history modal */
.price-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.price-history-table th {
    text-align: left;
    padding: 8px 12px;
    background: #f8fafc;
    font-weight: 600;
    color: var(--admin-muted);
    font-size: 11px;
    text-transform: uppercase;
}

.price-history-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--admin-border);
}

/* Toast */
.admin-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    background: var(--admin-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    z-index: 300;
    transform: translateY(100px);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.admin-toast--visible {
    transform: translateY(0);
    opacity: 1;
}

.admin-toast--error {
    background: var(--admin-danger);
}

.admin-toast--success {
    background: var(--admin-success);
}
