﻿/* ============================================
   ALVI - Admin  v2
   Clean sidebar, dashboard, users, kitchen
   ============================================ */

/* ── Admin layout ── */
.admin-page {
    animation: fadeIn .3s var(--ease);
    display: grid; grid-template-columns: 220px 1fr;
    gap: var(--space-6); min-height: 70vh;
}
.admin-page > h1 {
    grid-column: 1 / -1;
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    letter-spacing: -0.02em;
    margin-bottom: 0;
}

/* ── Sidebar ── */
.admin-sidebar {
    position: sticky; top: calc(var(--header-height) + 24px);
    align-self: start;
}
.admin-sidebar-nav {
    background: var(--white); border: 1px solid var(--gray-100);
    border-radius: var(--radius-xl); padding: var(--space-2);
    display: flex; flex-direction: column; gap: 2px;
}
.admin-nav-item {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-2-5, 10px) var(--space-3); border-radius: var(--radius-lg);
    font-size: var(--text-sm); font-weight: 600; cursor: pointer;
    color: var(--gray-500); transition: all .15s var(--ease);
    position: relative; border: none; background: none;
    text-align: left; width: 100%;
}
.admin-nav-item:hover { color: var(--gray-700); background: var(--gray-50); }
.admin-nav-item.active {
    background: var(--gray-900); color: var(--white);
}
.admin-nav-item .nav-icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.admin-nav-item .nav-badge {
    margin-left: auto;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: var(--radius-full); font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand); color: var(--white); line-height: 1;
}

/* ── Admin content ── */
.admin-content { min-width: 0; }
.admin-content h2 {
    font-family: var(--font-display); font-size: var(--text-2xl);
    margin-bottom: var(--space-5); letter-spacing: -0.01em;
}

/* ── Legacy admin tabs ── */
.admin-tabs {
    display: flex; flex-wrap: wrap; gap: var(--space-2);
    margin-bottom: var(--space-6); padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--gray-100);
}
.admin-tab {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-4); border-radius: var(--radius-lg);
    font-size: var(--text-sm); font-weight: 600; cursor: pointer;
    background: none; border: none;
    color: var(--gray-500); transition: all .15s var(--ease);
}
.admin-tab:hover { color: var(--gray-700); background: var(--gray-50); }
.admin-tab.active { background: var(--gray-900); color: var(--white); }
.admin-tab .tab-icon { font-size: 16px; }

/* ═══════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════ */
.dashboard-stats {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-4); margin-bottom: var(--space-6);
}
.stat-card {
    background: var(--white); border: 1px solid var(--gray-100);
    border-radius: var(--radius-xl); padding: var(--space-5);
    display: flex; align-items: center; gap: var(--space-4);
    transition: all .2s var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-1px); }
.stat-icon {
    width: 44px; height: 44px; border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.stat-icon.primary { background: rgba(201,168,76,.08); color: var(--gold-dark); }
.stat-icon.success { background: rgba(16,185,129,.08); color: #10b981; }
.stat-icon.warning { background: rgba(245,158,11,.08); color: #f59e0b; }
.stat-icon.danger { background: rgba(220,38,38,.06); color: var(--danger); }
.stat-info { flex: 1; min-width: 0; }
.stat-value {
    font-family: var(--font-display); font-size: var(--text-2xl);
    font-weight: 800; color: var(--gray-900); line-height: 1.2;
}
.stat-label { font-size: var(--text-xs); color: var(--gray-400); font-weight: 500; margin-top: 2px; }

/* ── Pending banner ── */
.pending-banner {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--gold-50); border: 1px solid rgba(201,168,76,.2);
    border-radius: var(--radius-xl);
    font-size: var(--text-sm); font-weight: 600;
    color: var(--gray-700); cursor: pointer;
    margin-bottom: var(--space-5); transition: all .2s var(--ease);
}
.pending-banner:hover { box-shadow: var(--shadow-card); }
.pending-count { color: var(--gold-dark); font-weight: 800; }

/* ── Table wrapper ── */
.admin-table-wrapper {
    background: var(--white); border: 1px solid var(--gray-100);
    border-radius: var(--radius-xl); overflow: hidden;
}
.admin-table-wrapper .table-wrapper { border: none; border-radius: 0; }
.admin-table-wrapper table { margin: 0; }
.admin-table-filters {
    display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end;
}
.admin-table-filters .form-group { margin-bottom: 0; flex: 1; min-width: 150px; }

/* ═══════════════════════════════════════
   USER CARDS
   ═══════════════════════════════════════ */
.user-card {
    display: flex; align-items: center; gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--gray-100);
    transition: background .15s var(--ease);
}
.user-card:last-child { border-bottom: none; }
.user-card:hover { background: var(--gray-50); }
.user-avatar-lg {
    width: 40px; height: 40px; border-radius: var(--radius-full);
    background: var(--gray-900); color: var(--gold);
    font-weight: 800; font-size: var(--text-xs);
    display: flex; align-items: center; justify-content: center;
    text-transform: uppercase; flex-shrink: 0;
}
.user-card-info { flex: 1; min-width: 0; }
.user-card-name { font-weight: 700; color: var(--gray-900); font-size: var(--text-sm); }
.user-card-email { font-size: var(--text-xs); color: var(--gray-400); margin-top: 1px; }
.user-card-meta {
    font-size: var(--text-xs); color: var(--gray-400); margin-top: var(--space-1);
    display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
}
.user-card-actions { display: flex; gap: var(--space-2); flex-shrink: 0; }

/* ═══════════════════════════════════════
   KITCHEN
   ═══════════════════════════════════════ */
.kitchen-page { animation: fadeIn .3s var(--ease); }
.kitchen-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-5);
}
.kitchen-header h1 {
    font-family: var(--font-display); margin: 0;
    font-size: var(--text-3xl); letter-spacing: -0.02em;
}
.kitchen-date-nav {
    display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
}
.kitchen-date {
    font-weight: 700; color: var(--gray-900); font-size: var(--text-base);
    padding: 0 var(--space-3); min-width: 150px; text-align: center;
}

/* ── Kitchen orders ── */
.kitchen-orders {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-4);
}
.kitchen-order-card {
    background: var(--white); border: 1px solid var(--gray-100);
    border-radius: var(--radius-xl); overflow: hidden;
    transition: all .2s var(--ease);
    border-top: 3px solid var(--gray-200);
}
.kitchen-order-card:hover { box-shadow: var(--shadow-card-hover); }
.kitchen-order-card.status-nova { border-top-color: var(--gold); }
.kitchen-order-card.status-prijata { border-top-color: #3b82f6; }
.kitchen-order-card.status-pripravuje_sa { border-top-color: #f59e0b; }
.kitchen-order-card.status-pripravena { border-top-color: #8b5cf6; }
.kitchen-order-card.status-vydana { border-top-color: #10b981; }
.kitchen-order-card.status-zrusena { border-top-color: var(--danger); }

.kitchen-order-card .kitchen-card-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-2); flex-wrap: wrap;
    padding: var(--space-3) var(--space-4);
    background: var(--gray-900); color: var(--gold);
}
.kitchen-order-number { font-weight: 800; font-size: var(--text-sm); }
.kitchen-order-time { font-size: var(--text-xs); color: rgba(255,255,255,.4); }
.kitchen-order-customer {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm); color: var(--gray-600);
    border-bottom: 1px solid var(--gray-100);
}
.kitchen-order-type { margin-left: var(--space-2); }
.kitchen-card-items { padding: var(--space-3) var(--space-4); }
.kitchen-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: var(--space-2) 0; border-bottom: 1px solid var(--gray-50);
    font-size: var(--text-sm); color: var(--gray-600);
}
.kitchen-item:last-child { border-bottom: none; }
.kitchen-item-qty {
    background: var(--gray-100); padding: 2px 7px; border-radius: var(--radius);
    font-weight: 800; font-size: var(--text-xs); color: var(--gray-900);
    margin-right: var(--space-2);
}
.kitchen-card-footer {
    padding: var(--space-3) var(--space-4); border-top: 1px solid var(--gray-100);
    display: flex; gap: var(--space-2); flex-wrap: wrap;
}
.kitchen-card-footer .btn { flex: 1; font-size: var(--text-xs); min-width: 0; }

/* ── Kitchen summary ── */
.kitchen-summary { animation: fadeIn .3s var(--ease); }
.kitchen-summary h3 { font-family: var(--font-display); margin-bottom: var(--space-5); }
.summary-items { display: flex; flex-direction: column; gap: var(--space-2); }
.summary-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-3) var(--space-4); background: var(--white);
    border: 1px solid var(--gray-100); border-radius: var(--radius-lg);
    font-size: var(--text-sm);
}
.summary-item-name { font-weight: 600; color: var(--gray-800); }
.summary-item-count {
    font-weight: 800; color: var(--gray-900);
    background: var(--gold-50); padding: 2px 10px; border-radius: var(--radius);
}

/* ═══════════════════════════════════════
   SETTINGS
   ═══════════════════════════════════════ */
.settings-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-5);
}
.settings-section {
    background: var(--white); border: 1px solid var(--gray-100);
    border-radius: var(--radius-xl); padding: var(--space-6);
}
.settings-section h3, .settings-section h4 {
    font-family: var(--font-display); font-size: var(--text-lg);
    margin-bottom: var(--space-4); color: var(--gray-900);
    padding-bottom: var(--space-3); border-bottom: 1px solid var(--gray-100);
}
.setting-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) 0; border-bottom: 1px solid var(--gray-50);
}
.setting-row:last-child { border-bottom: none; }
.setting-row label {
    font-weight: 600; font-size: var(--text-sm); color: var(--gray-700);
    white-space: nowrap; flex-shrink: 0;
}
.setting-row .form-input { max-width: 200px; text-align: right; }

/* ── Toggle ── */
.toggle {
    position: relative; display: inline-block;
    width: 44px; height: 24px; cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider,
.toggle::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--gray-200); border-radius: var(--radius-full);
    transition: background .2s var(--ease);
}
.toggle-slider::before,
.toggle::before {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,.15);
    transition: transform .2s var(--ease);
    z-index: 1;
}
.toggle input:checked + .toggle-slider,
.toggle.active::after { background: var(--gray-900); }
.toggle input:checked + .toggle-slider::before,
.toggle.active::before { transform: translateX(20px); }

/* ── User helpers ── */
.user-status-active { color: var(--success); font-weight: 700; }
.user-status-pending { color: var(--warning); font-weight: 700; }
.user-status-inactive { color: var(--gray-400); font-weight: 700; }
.user-role-badge {
    display: inline-flex; padding: 2px 8px; border-radius: var(--radius);
    font-size: var(--text-xs); font-weight: 700;
}
.user-role-badge.admin { background: rgba(201,168,76,.08); color: var(--gold-dark); }
.user-role-badge.kuchar { background: rgba(139,92,246,.08); color: #8b5cf6; }
.user-role-badge.zakaznik { background: rgba(59,130,246,.08); color: #3b82f6; }

/* ── Closed days ── */
.closed-days-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.closed-day-chip {
    display: inline-flex; align-items: center; gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--danger-bg); color: var(--danger);
    border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 700;
}
.remove-day {
    cursor: pointer; font-size: 14px; font-weight: 800;
    line-height: 1; opacity: .6; transition: opacity .15s;
}
.remove-day:hover { opacity: 1; }

/* ── Reports ── */
.report-filters {
    display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end;
}
.report-filters .form-group { margin-bottom: 0; }

/* ── Field config ── */
.field-config-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-3);
}
.field-config-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: var(--gray-50); border-radius: var(--radius-lg);
    border: 1px solid var(--gray-100);
}
.field-config-item .field-name { font-weight: 600; font-size: var(--text-sm); color: var(--gray-700); }
.field-config-item .field-desc { font-size: var(--text-xs); color: var(--gray-400); }

/* ── Theme Picker ── */
.theme-picker {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-4);
}
.theme-option {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: var(--space-3);
    cursor: pointer;
    transition: all .25s var(--ease);
    position: relative;
    background: var(--white);
}
.theme-option:hover {
    border-color: var(--brand);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.theme-option.active {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(212,175,55,.2), 0 8px 24px rgba(0,0,0,.1);
}
.theme-preview {
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: 120px;
    margin-bottom: var(--space-3);
    display: flex; flex-direction: column;
}
.theme-preview .tp-header { height: 20px; }
.theme-preview .tp-hero { height: 30px; }
.theme-preview .tp-cards {
    flex: 1; display: flex; gap: 4px;
    padding: 6px;
}
.theme-preview .tp-card {
    flex: 1; border-radius: 4px;
}
/* Elegant preview */
.theme-preview-elegant .tp-header { background: #1F2937; }
.theme-preview-elegant .tp-hero { background: linear-gradient(135deg, #111827, #1F2937); }
.theme-preview-elegant .tp-cards { background: #F9FAFB; }
.theme-preview-elegant .tp-card { background: #fff; border: 1px solid #E5E7EB; }
/* Modern preview */
.theme-preview-modern .tp-header { background: #fff; border-bottom: 1px solid #E5E7EB; }
.theme-preview-modern .tp-hero { background: linear-gradient(135deg, #16A34A, #22C55E); }
.theme-preview-modern .tp-cards { background: #F0FDF4; }
.theme-preview-modern .tp-card { background: #fff; border: 1px solid #DCFCE7; }
/* Cards preview */
.theme-preview-cards .tp-header { background: #1E1B18; }
.theme-preview-cards .tp-hero { background: linear-gradient(135deg, #292524, #44403C); }
.theme-preview-cards .tp-cards { background: #FBF7F0; }
.theme-preview-cards .tp-card { background: #fff; border: 1px solid #E8DFD0; }

.theme-info {
    display: flex; flex-direction: column; gap: 2px;
}
.theme-info strong {
    font-size: var(--text-sm); color: var(--gray-900);
}
.theme-info span {
    font-size: var(--text-xs); color: var(--gray-500);
}
.theme-badge {
    position: absolute; top: var(--space-2); right: var(--space-2);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 10px; font-weight: 700;
    background: var(--brand); color: var(--white);
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .admin-page { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; }
    .admin-sidebar-nav {
        flex-direction: row; overflow-x: auto; gap: 2px; padding: var(--space-2);
    }
    .admin-nav-item {
        white-space: nowrap; font-size: var(--text-xs);
        padding: var(--space-2) var(--space-3);
    }
    .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .dashboard-stats { grid-template-columns: 1fr 1fr; }
    .stat-card { padding: var(--space-3); }
    .stat-icon { width: 38px; height: 38px; font-size: 18px; }
    .kitchen-orders { grid-template-columns: 1fr; }
    .kitchen-header { flex-direction: column; align-items: flex-start; }
    .kitchen-date-nav { width: 100%; justify-content: space-between; }
    .admin-table-filters { flex-direction: column; }
    .admin-table-filters .form-group { width: 100%; }
}
