/* Packysk – QR Scan Aplikace | UTF-8 */

:root {
    --primary:     #4f46e5;
    --primary-d:   #4338ca;
    --success:     #059669;
    --danger:      #dc2626;
    --warning:     #d97706;
    --info:        #0284c7;
    --bg:          #f1f5f9;
    --card-bg:     #ffffff;
    --border:      #e2e8f0;
    --text:        #1e293b;
    --text-muted:  #64748b;
    --radius:      8px;
    --shadow:      0 1px 3px rgba(0,0,0,.12);
}

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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

/* ── Navbar ─────────────────────────────── */
.navbar {
    background: var(--primary);
    color: white;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 56px;
    box-shadow: 0 2px 4px rgba(0,0,0,.15);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-brand {
    font-weight: 700;
    font-size: 18px;
    color: white;
    text-decoration: none;
    margin-right: 16px;
}
.navbar-nav { display: flex; gap: 4px; flex: 1; }
.navbar-nav a {
    color: rgba(255,255,255,.85);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: background .15s;
}
.navbar-nav a:hover,
.navbar-nav a.active { background: rgba(255,255,255,.15); color: white; }
.navbar-end { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; }
.navbar-end a { color: rgba(255,255,255,.85); text-decoration: none; }
.navbar-end a:hover { color: white; }

/* ── Layout ─────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
    flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 700; }
.page-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 2px; }

/* ── Cards ───────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #f8fafc;
}
.card-header h2, .card-header h3 { font-size: 16px; font-weight: 600; }
.card-body { padding: 20px; }

/* ── Stats Grid ─────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.danger  .stat-value { color: var(--danger); }
.stat-card.warning .stat-value { color: var(--warning); }

/* ── Progress bar ────────────────────────── */
.progress { background: #e2e8f0; border-radius: 999px; height: 8px; overflow: hidden; margin: 8px 0; }
.progress-bar { height: 100%; border-radius: 999px; background: var(--primary); transition: width .3s; }
.progress-bar.success { background: var(--success); }

/* ── Table ───────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead { background: #f8fafc; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
th { font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ── Forms ───────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: white;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
textarea.form-control { resize: vertical; min-height: 120px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-control.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.1); }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Buttons ──────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
    height: 34px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    white-space: nowrap;
    vertical-align: middle;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}
.btn-sm { padding: 0 10px; height: 28px; font-size: 13px; }
.btn-xs { padding: 0 8px;  height: 24px; font-size: 12px; }
.btn-primary   { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-d); }
.btn-success   { background: var(--success); color: white; }
.btn-success:hover { background: #047857; }
.btn-danger    { background: var(--danger); color: white; }
.btn-danger:hover  { background: #b91c1c; }
.btn-warning   { background: var(--warning); color: white; }
.btn-outline   { background: white; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: #f8fafc; }
.btn-full { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Badges ───────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-created   { background: #dbeafe; color: #1d4ed8; }
.badge-scanned   { background: #dcfce7; color: #15803d; }
.badge-cancelled { background: #fee2e2; color: #b91c1c; }
.badge-blocked   { background: #fef3c7; color: #92400e; }
.badge-secondary { background: #f1f5f9; color: #475569; }
.badge-active    { background: #dcfce7; color: #15803d; }
.badge-planned   { background: #dbeafe; color: #1d4ed8; }
.badge-ended     { background: #f1f5f9; color: #475569; }

/* ── Alerts ───────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid;
    font-size: 14px;
    margin-bottom: 16px;
}
.alert-success { background: #ecfdf5; border-color: #6ee7b7; color: #065f46; }
.alert-danger  { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.alert-info    { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }

/* ── Modal ────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.modal {
    background: white;
    border-radius: 10px;
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body  { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── Tabs ──────────────────────────────────── */
.tabs { border-bottom: 2px solid var(--border); display: flex; gap: 0; margin-bottom: 20px; }
.tab-btn {
    padding: 10px 18px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .15s;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Search box ──────────────────────────── */
.search-box { position: relative; }
.search-box input { padding-left: 36px; }
.search-box::before {
    content: '🔍';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    pointer-events: none;
}

/* ── Login page ──────────────────────────── */
body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}
.login-box {
    background: white;
    border-radius: 12px;
    padding: 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 24px; font-weight: 800; color: var(--primary); margin: 8px 0 4px; }
.login-logo p  { color: var(--text-muted); font-size: 14px; }

/* ── Scan page ───────────────────────────── */
body.scan-page { background: #0f172a; color: white; }
.scan-navbar {
    background: #1e293b;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #334155;
}
.scan-navbar .brand { font-size: 18px; font-weight: 700; color: #e2e8f0; }
.scan-container { max-width: 600px; margin: 0 auto; padding: 20px; }
.scan-project-selector {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
}
.scan-project-selector h2 { font-size: 18px; margin-bottom: 16px; }
.scan-reader-box {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
}
.scan-reader-box h3 { font-size: 16px; margin-bottom: 12px; }
#reader { width: 100%; border-radius: 8px; overflow: hidden; }
.scan-result {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 32px;
    cursor: pointer;
    user-select: none;
}
.scan-result.show { display: flex; }
.scan-result.ok    { background: #064e3b; }
.scan-result.error { background: #450a0a; }
.scan-result.warn  { background: #451a03; }
.scan-result h4 { font-size: 28px; font-weight: 700; margin-bottom: 16px; color: #fff; }
.scan-result p  { font-size: 18px; opacity: .9; color: #fff; margin-bottom: 32px; }
.scan-result-hint { font-size: 14px; opacity: .5; color: #fff; margin-top: 24px; }
.scan-search-box {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 20px;
}
.scan-search-box h3 { font-size: 16px; margin-bottom: 12px; }
.scan-form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #475569;
    border-radius: 6px;
    background: #0f172a;
    color: white;
    font-size: 14px;
    font-family: inherit;
}
.scan-form-control:focus { outline: none; border-color: #818cf8; }
.scan-user-list { margin-top: 12px; }
.scan-user-item {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.scan-user-info { font-size: 14px; }
.scan-user-info strong { display: block; }
.scan-user-info span  { color: #94a3b8; font-size: 13px; }
.scan-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.scan-btn-success { background: var(--success); color: white; }
.scan-btn-warning { background: var(--warning); color: white; }

/* ── QR code display ──────────────────────── */
.qr-img { width: 160px; height: 160px; border: 4px solid white; border-radius: 8px; }
.qr-cell img { width: 80px; height: 80px; }

/* ── Utilities ───────────────────────────── */
.text-muted { color: var(--text-muted); font-size: 13px; }
.link-plain { color: inherit; text-decoration: none; }
.link-plain:hover { color: var(--primary); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state p { font-size: 15px; }

/* Alpine.js cloak */
[x-cloak] { display: none !important; }

@media (max-width: 640px) {
    .form-row, .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .navbar-nav { display: none; }
}
