/**
 * Kiosk2 Stylesheet – Getränke & Snack Automat
 * Speicherort: /var/www/kiosk2/css/kiosk.css
 * Tablet-optimiert (Touch, große Kacheln)
 */

:root {
    --primary:     #0078d7;
    --primary-dk:  #2b5797;
    --accent:      #00b7c3;
    --bg:          #f0f2f5;
    --white:       #ffffff;
    --text:        #222222;
    --text-muted:  #777777;
    --border:      #dde1e7;
    --shadow:      0 2px 12px rgba(0,0,0,0.10);
    --shadow-lg:   0 6px 24px rgba(0,0,0,0.14);
    --green:       #2e7d32;
    --green-light: #e8f5e9;
    --orange:      #f57c00;
    --orange-light:#fff3e0;
    --red:         #c62828;
    --red-light:   #ffebee;
    --radius:      14px;
    --radius-sm:   8px;
}

/* ── Reset & Base ─────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dk); }

/* ── TOP BAR ──────────────────────────────────────────────────── */
.top-bar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dk));
    color: #fff;
    padding: 0 24px;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.top-bar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.top-bar-brand-icon { font-size: 26px; }

.top-bar-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.top-bar-link {
    color: rgba(255,255,255,0.85);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.top-bar-link:hover,
.top-bar-link.active {
    background: rgba(255,255,255,0.18);
    color: #fff;
}

.top-bar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-bar-balance {
    background: rgba(255,255,255,0.2);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
}

.top-bar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    object-fit: cover;
    background: rgba(255,255,255,0.2);
}

.top-bar-avatar-placeholder {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 2px solid rgba(255,255,255,0.4);
}

/* RFID-Status-Indikator */
.rfid-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(0,0,0,0.15);
}

.rfid-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── PROFIL BANNER ──────────────────────────────────────────────*/
.profile-banner {
    background: linear-gradient(90deg, #e65100, #ff9800);
    color: #fff;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* ── PAGE CONTAINER ─────────────────────────────────────────────*/
.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 40px;
    flex: 1;
    width: 100%;
}

.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.page-sub {
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 24px;
}

/* ── ALERTS ─────────────────────────────────────────────────────*/
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}

.alert-info    { background: #e3f2fd; color: #0d47a1; border-left: 4px solid #1565c0; }
.alert-warn    { background: var(--orange-light); color: #e65100; border-left: 4px solid #f57c00; }
.alert-error   { background: var(--red-light); color: var(--red); border-left: 4px solid var(--red); }
.alert-success { background: var(--green-light); color: var(--green); border-left: 4px solid var(--green); }

/* ── PRODUCT GRID (Tablet-optimiert) ────────────────────────────*/
.cat-section { margin-bottom: 36px; }

.cat-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.cat-count {
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.prod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}

/* ── PRODUCT CARD ────────────────────────────────────────────────*/
.prod-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    border: 2px solid transparent;
    min-height: 320px;
}

.prod-card:hover,
.prod-card:focus-within {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    outline: none;
}

.prod-card:active {
    transform: scale(0.98);
}

.prod-card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 72px;
    flex-shrink: 0;
}

.prod-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.prod-card-body {
    padding: 14px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.prod-card-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.3;
}

.prod-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    flex: 1;
    margin-bottom: 12px;
    line-height: 1.4;
}

.prod-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
}

.prod-card-price {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    white-space: nowrap;
}

.prod-card-price-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

.prod-card-buy-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
    min-height: 48px;
    min-width: 80px;
}

.prod-card-buy-btn:hover  { background: var(--primary-dk); }
.prod-card-buy-btn:active { transform: scale(0.97); }
.prod-card-buy-btn:disabled { background: #aaa; cursor: not-allowed; }

.prod-card-age-badge {
    font-size: 11px;
    background: var(--red-light);
    color: var(--red);
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── BUTTONS ─────────────────────────────────────────────────────*/
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background .15s, transform .1s;
    white-space: nowrap;
    min-height: 44px;
}

.btn:active { transform: scale(0.97); }

.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); color: #fff; }

.btn-secondary { background: #e4e8ef; color: var(--text); }
.btn-secondary:hover { background: #d0d5de; color: var(--text); }

.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b71c1c; color: #fff; }

.btn-success   { background: var(--green); color: #fff; }
.btn-success:hover { background: #1b5e20; color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 13px; min-height: 34px; }
.btn-lg { padding: 14px 28px; font-size: 16px; min-height: 52px; }

/* ── MODAL ────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 480px;
    width: 100%;
    overflow: hidden;
    animation: modal-in .2s ease;
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.94) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    flex: 1;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
}

.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
}

.modal-img img { width: 100%; height: 100%; object-fit: cover; }

.modal-body { padding: 20px 24px; }

.modal-product-name  { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.modal-product-desc  { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; line-height: 1.5; }
.modal-product-price { font-size: 28px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
.modal-product-vat   { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }

.modal-balance-info {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    border-top: 1px solid var(--border);
}

.modal-footer .btn { flex: 1; justify-content: center; min-height: 52px; font-size: 16px; }

/* ── CARDS & TABLES ─────────────────────────────────────────────*/
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    font-weight: 700;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #fafbfc;
}

.card-content { padding: 20px; }

.servers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.servers-table th {
    background: #f5f7fa;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

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

.servers-table tr:last-child td { border-bottom: none; }
.servers-table tr:hover td { background: #f9fafb; }

/* ── STATUS BADGES ───────────────────────────────────────────────*/
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.status-active    { background: var(--green-light);  color: var(--green); }
.status-pending   { background: var(--orange-light); color: var(--orange); }
.status-suspended { background: var(--red-light);    color: var(--red); }
.status-dispensed { background: #e8eaf6;             color: #3949ab; }

/* ── STAT CARDS ──────────────────────────────────────────────────*/
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--text); }

/* ── FORMS ───────────────────────────────────────────────────────*/
.form-group  { margin-bottom: 16px; }
.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-label  { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.3px; }
.form-hint   { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    background: var(--white);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
    min-height: 46px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,120,215,0.12);
}

.form-textarea { min-height: 90px; resize: vertical; }

/* Radio-Gruppe */
.radio-group { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex: 1;
    min-width: 180px;
    transition: border-color .15s, background .15s;
}
.radio-option:hover    { border-color: var(--primary); background: #f0f6ff; }
.radio-option.selected { border-color: var(--primary); background: #e8f0fe; }
.radio-option input[type=radio] { margin-top: 2px; accent-color: var(--primary); width: 16px; height: 16px; flex-shrink: 0; }
.radio-option-label    { font-weight: 700; font-size: 14px; }
.radio-option-desc     { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── TABS ─────────────────────────────────────────────────────── */
.tab-nav {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 18px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: color .15s, border-color .15s;
    min-height: 46px;
}

.tab-btn:hover  { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: #f0f6ff; }

.tab-content         { display: none; }
.tab-content.active  { display: block; }

/* ── SPINNER ─────────────────────────────────────────────────────*/
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ─────────────────────────────────────────────────*/
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-sub  { font-size: 14px; margin-bottom: 20px; }

/* ── ADMIN LAYOUT ────────────────────────────────────────────────*/
.admin-layout {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 64px);
}

.admin-sidebar {
    width: 220px;
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 20px 12px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-sidebar-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 6px 12px 12px;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    transition: background .15s, color .15s;
    text-decoration: none;
    min-height: 44px;
}

.admin-nav-item:hover  { background: var(--bg); color: var(--primary); }
.admin-nav-item.active { background: #e8f0fe; color: var(--primary); font-weight: 700; }

.admin-content {
    flex: 1;
    padding: 28px 32px;
    overflow-x: auto;
}

.admin-content h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
}

.sub-desc {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

/* ── IMAGE UPLOAD PREVIEW ────────────────────────────────────────*/
.img-preview-wrap {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s;
    background: var(--bg);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
}

.img-preview-wrap:hover { border-color: var(--primary); }
.img-preview-wrap img   { max-height: 100px; max-width: 100%; border-radius: 6px; }

/* ── RFID SCAN SEITE ─────────────────────────────────────────────*/
.rfid-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #0d2e5e, #0078d7);
    color: #fff;
    text-align: center;
    padding: 40px 24px;
    gap: 32px;
}

.rfid-logo { font-size: 80px; animation: float 3s ease-in-out infinite; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}

.rfid-title { font-size: 32px; font-weight: 800; }
.rfid-sub   { font-size: 18px; opacity: 0.8; max-width: 400px; line-height: 1.5; }

.rfid-scan-ring {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    position: relative;
}

.rfid-scan-ring::before {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.15);
    animation: ring-pulse 2s ease-out infinite;
}

@keyframes ring-pulse {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.4); }
}

.rfid-input-hidden {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

.rfid-divider {
    width: 100%;
    max-width: 320px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
}

.rfid-divider::before,
.rfid-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.2);
}

.rfid-keycloak-btn {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: var(--radius-sm);
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background .2s, border-color .2s;
    min-height: 52px;
}

.rfid-keycloak-btn:hover { background: rgba(255,255,255,0.25); color: #fff; }

/* ── FOOTER ──────────────────────────────────────────────────────*/
.footer {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────*/
@media (max-width: 900px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 10px;
        gap: 4px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .admin-sidebar-title { display: none; }
    .admin-nav-item { padding: 8px 10px; font-size: 13px; min-height: 38px; }
    .admin-content { padding: 16px; }
}

@media (max-width: 680px) {
    .top-bar { padding: 0 14px; height: 56px; }
    .top-bar-brand { font-size: 17px; }
    .top-bar-link { display: none; }
    .page { padding: 16px 14px 32px; }
    .prod-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .prod-card { min-height: 280px; }
    .prod-card-img { height: 140px; font-size: 52px; }
    .prod-card-price { font-size: 18px; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .modal { max-width: 100%; border-radius: var(--radius) var(--radius) 0 0; }
    .modal-overlay { align-items: flex-end; padding: 0; }
}

/* ── TABLET TOUCH OPTIMIERUNGEN ──────────────────────────────────*/
@media (hover: none) {
    .prod-card:hover { transform: none; box-shadow: var(--shadow); border-color: transparent; }
    .prod-card:active { transform: scale(0.97); border-color: var(--primary); }
    .btn:hover { background: initial; }
    .btn-primary:hover   { background: var(--primary); }
    .btn-secondary:hover { background: #e4e8ef; }
}

/* ── Quantity-Selector ───────────────────────────────────────────*/
.qty-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.qty-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--white);
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: background .15s, border-color .15s;
}

.qty-btn:hover  { background: #e8f0fe; border-color: var(--primary); }
.qty-btn:active { transform: scale(0.92); }

.qty-value {
    font-size: 22px;
    font-weight: 800;
    min-width: 36px;
    text-align: center;
}

/* ── Quick amount buttons ────────────────────────────────────────*/
.quick-amount-btn { background: #e4e8ef; }
.quick-amount-btn:hover  { background: #c5cae9; }
.quick-amount-btn.active { background: var(--primary); color: #fff; }

/* ══ USER SECTION & DROPDOWN (Top-Bar) ══════════════════════════ */
.user-section {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.balance-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.28);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s;
}
.balance-chip:hover { background: rgba(255,255,255,0.22); color: #fff; }
.balance-icon { font-size: 14px; }
.balance-amt  { font-weight: 800; }

.user-dropdown { position: relative; }

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    color: #fff;
    transition: background .15s;
}
.user-info:hover { background: rgba(255,255,255,0.13); }

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--primary-dk));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    border: 2px solid rgba(255,255,255,0.45);
    overflow: hidden;
    flex-shrink: 0;
}
.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.user-avatar-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 16px;
    font-weight: 700;
}

.user-details { text-align: left; }
.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.user-email {
    font-size: 11px;
    color: rgba(255,255,255,0.72);
    white-space: nowrap;
}
.admin-badge {
    background: var(--orange);
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: 0 6px 28px rgba(0,0,0,0.18);
    min-width: 215px;
    z-index: 300;
    overflow: hidden;
    animation: dropdown-in .15s ease;
}
.dropdown-menu.open { display: block; }

@keyframes dropdown-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    padding: 12px 18px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    transition: background .12s;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover      { background: #f5f7fa; color: var(--primary); }
.dropdown-logout          { color: var(--red); }
.dropdown-logout:hover    { background: var(--red-light); color: var(--red); }
.dropdown-divider         { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ══ SUB-NAV ════════════════════════════════════════════════════ */
.sub-nav {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 0 20px;
    display: flex;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: sticky;
    top: 64px;
    z-index: 90;
    flex-shrink: 0;
}
.sub-nav::-webkit-scrollbar { display: none; }

.sub-tab {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 13px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: color .15s, border-color .15s, background .15s;
    white-space: nowrap;
    text-decoration: none;
    min-height: 48px;
    flex-shrink: 0;
}
.sub-tab:hover  { color: var(--primary); background: #f5f8ff; }
.sub-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.sub-tab-admin { margin-left: auto; color: var(--orange); }
.sub-tab-admin:hover  { color: var(--orange); background: #fffaf0; }
.sub-tab-admin.active { color: var(--orange); border-bottom-color: var(--orange); }

.nav-badge-warn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--orange); color: #fff;
    font-size: 10px; font-weight: 700;
}

/* ══ ADMIN layout: extra top offset for sub-nav ═════════════════ */
.admin-layout { min-height: calc(100vh - 112px); }

/* ══ MOBILE RESPONSIVE UPDATES ══════════════════════════════════ */
@media (max-width: 680px) {
    /* Sub-nav slightly smaller */
    .sub-nav { top: 56px; padding: 0 12px; }
    .sub-tab  { padding: 11px 12px; font-size: 13px; }

    /* Hide name/email in top-bar, keep only avatar */
    .user-details { display: none; }

    /* Balance chip compact */
    .balance-chip { padding: 6px 10px; font-size: 13px; }

    /* Dropdown full-width on mobile */
    .dropdown-menu { right: -8px; min-width: 190px; }
}
