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

:root {
    --primary: #0891B2;
    --primary-dark: #0E7490;
    --primary-light: #ECFEFF;
    --primary-glow: rgba(8,145,178,0.15);
    --secondary: #22D3EE;
    --success: #22C55E;
    --success-bg: #F0FDF4;
    --warning: #F59E0B;
    --warning-bg: #FFFBEB;
    --danger: #EF4444;
    --danger-bg: #FEF2F2;
    --text: #164E63;
    --text-light: #64748B;
    --text-muted: #94A3B8;
    --bg: #F0FDFA;
    --card: #FFFFFF;
    --border: #E0F2FE;
    --border-focus: #0891B2;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow-sm: 0 2px 8px rgba(8,145,178,0.06);
    --shadow-md: 0 4px 24px rgba(8,145,178,0.08);
    --shadow-lg: 0 12px 40px rgba(8,145,178,0.12);
    --transition: 0.2s ease;
}

body {
    font-family: 'Noto Sans Hebrew', 'Segoe UI', Tahoma, Arial, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    color: var(--text);
    line-height: 1.5;
}

html[dir="ltr"] body { direction: ltr; }

/* ──────────────── Top Bar ──────────────── */
.top-bar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 12px rgba(8,145,178,0.2);
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h1 { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; }

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

.top-bar a, .lang-btn {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
}

.top-bar a:hover, .lang-btn:hover {
    background: rgba(255,255,255,0.15);
}

.lang-btn {
    border: 1px solid rgba(255,255,255,0.3);
    background: none;
    font-weight: 600;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all var(--transition);
}

.back-link:hover { background: rgba(255,255,255,0.1); color: white; }

/* ──────────────── Container ──────────────── */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 16px;
}

.container-narrow {
    max-width: 900px;
}

/* ──────────────── Cards ──────────────── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-clickable {
    cursor: pointer;
}

.card-clickable:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* ──────────────── Buttons ──────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 14px rgba(8,145,178,0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(8,145,178,0.4);
}

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16A34A; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; }

.btn-outline {
    background: white;
    color: var(--text);
    border: 1.5px solid var(--border);
}

.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.btn-ghost {
    background: none;
    border: none;
    color: var(--text-light);
    padding: 6px 10px;
}

.btn-ghost:hover { color: var(--text); background: rgba(0,0,0,0.04); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: 8px; }

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

/* ──────────────── Forms ──────────────── */
.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 13px;
    color: var(--text);
}

.form-group .required::after {
    content: ' *';
    color: var(--danger);
}

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

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

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

/* ──────────────── Badges ──────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--primary-light); color: var(--primary); }
.badge-muted { background: #F1F5F9; color: var(--text-light); }

/* ──────────────── Tables ──────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: right;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    background: #FAFEFF;
}

html[dir="ltr"] .data-table th { text-align: left; }

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #F1F5F9;
    vertical-align: middle;
}

.data-table tr:hover { background: #F8FDFF; }

.data-table tr.row-collected { background: var(--success-bg); }
.data-table tr.row-collected:hover { background: #DCFCE7; }

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

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

.modal {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--primary-dark);
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}

.modal-actions button { flex: 1; }

/* ──────────────── Slide-out Panel ──────────────── */
.panel-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(2px);
    z-index: 90;
}

.panel-overlay.show { display: block; }

.slide-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 440px;
    max-width: 100%;
    background: white;
    box-shadow: -8px 0 40px rgba(0,0,0,0.15);
    z-index: 95;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: 24px;
}

html[dir="rtl"] .slide-panel { right: 0; transform: translateX(100%); }
html[dir="ltr"] .slide-panel { left: 0; transform: translateX(-100%); }

.slide-panel.open { transform: translateX(0); }

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

.panel-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-dark);
}

.panel-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 20px;
    transition: all var(--transition);
}

.panel-close:hover { background: #F1F5F9; color: var(--text); }

/* ──────────────── Tabs ──────────────── */
.tab-bar {
    display: flex;
    gap: 4px;
    background: white;
    padding: 6px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    color: var(--text-light);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tab-btn:hover { color: var(--text); background: #F8FAFC; }

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(8,145,178,0.3);
}

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

/* ──────────────── Stats Grid ──────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.stat-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
}

.stat-num.success { color: var(--success); }
.stat-num.warning { color: var(--warning); }
.stat-num.danger { color: var(--danger); }

.stat-label {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 500;
    margin-top: 4px;
}

/* ──────────────── Progress Bar ──────────────── */
.progress-bar-wrapper {
    background: #E2E8F0;
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--primary), var(--success));
    transition: width 0.5s ease;
}

/* ──────────────── Autocomplete ──────────────── */
.autocomplete-wrapper { position: relative; }

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1.5px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 60;
    max-height: 240px;
    overflow-y: auto;
    display: none;
}

.autocomplete-dropdown.show { display: block; }

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #F1F5F9;
    transition: background var(--transition);
}

.autocomplete-item:hover, .autocomplete-item.highlighted { background: var(--primary-light); }

.autocomplete-item:last-child { border-bottom: none; }

.autocomplete-name { font-weight: 600; font-size: 14px; color: var(--text); }
.autocomplete-details { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ──────────────── Filter Bar ──────────────── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
}

.filter-pills {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.filter-pill {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1.5px solid var(--border);
    background: white;
    color: var(--text-light);
    transition: all var(--transition);
}

.filter-pill:hover { border-color: var(--primary); color: var(--primary); }

.filter-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-input-wrapper svg {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    fill: var(--text-muted);
}

html[dir="rtl"] .search-input-wrapper svg { right: 12px; }
html[dir="ltr"] .search-input-wrapper svg { left: 12px; }

html[dir="rtl"] .search-input-wrapper .form-input { padding-right: 36px; }
html[dir="ltr"] .search-input-wrapper .form-input { padding-left: 36px; }

/* ──────────────── Toggle ──────────────── */
.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
    display: inline-block;
}

.toggle input { display: none; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #CBD5E1;
    border-radius: 12px;
    transition: background var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    right: 3px;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

html[dir="ltr"] .toggle-slider::before { right: auto; left: 3px; }

.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(-20px); }
html[dir="ltr"] .toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ──────────────── Checkbox ──────────────── */
.checkbox-collect {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--border);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}

.checkbox-collect:hover { border-color: var(--success); }

.checkbox-collect.checked {
    background: var(--success);
    border-color: var(--success);
}

.checkbox-collect.checked svg { display: block; }
.checkbox-collect svg { display: none; width: 14px; height: 14px; fill: white; }

/* ──────────────── Breakdowns ──────────────── */
.breakdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #F1F5F9;
}

.breakdown-item:last-child { border-bottom: none; }

.breakdown-label {
    font-weight: 600;
    font-size: 14px;
    min-width: 120px;
    color: var(--text);
}

.breakdown-bar { flex: 1; }

.breakdown-nums {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
    min-width: 70px;
    text-align: left;
}

html[dir="rtl"] .breakdown-nums { text-align: left; }
html[dir="ltr"] .breakdown-nums { text-align: right; }

/* ──────────────── Section ──────────────── */
.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* ──────────────── Toast ──────────────── */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.toast {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    animation: toastIn 0.3s ease;
    color: white;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }

@keyframes toastIn {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ──────────────── Empty State ──────────────── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-light);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    background: var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.empty-state-icon svg { width: 32px; height: 32px; fill: var(--text-light); }

.empty-state-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

/* ──────────────── Progress Ring ──────────────── */
.progress-ring-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.progress-ring-text {
    font-size: 32px;
    font-weight: 800;
    fill: var(--primary-dark);
}

.progress-ring-label {
    font-size: 14px;
    fill: var(--text-light);
}

/* ──────────────── Responsive ──────────────── */
@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .slide-panel { width: 100%; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .search-input-wrapper { min-width: unset; }
    .tab-btn { font-size: 12px; padding: 8px 10px; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 6px; }
    .container { padding: 12px 10px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 12px 8px; }
    .stat-num { font-size: 22px; }
}

/* ──────────────── Mobile Field-Use Utilities ──────────────── */
.input-lg {
    height: 56px;
    font-size: 18px;
    padding: 14px 16px;
    border-radius: 12px;
}

.btn-lg {
    height: 56px;
    font-size: 16px;
    font-weight: 700;
    min-width: 44px;
    border-radius: 12px;
}

.card-field {
    background: var(--card);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 12px;
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.card-field-collected {
    background: var(--success-bg);
    border-color: #BBF7D0;
}

.phone-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.phone-link:active { opacity: 0.7; }

.counter-strip {
    background: white;
    border-radius: var(--radius);
    padding: 14px 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

.counter-strip-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 15px;
}

.counter-strip-num {
    color: var(--primary);
    font-weight: 800;
    font-size: 18px;
}

.session-counter {
    text-align: center;
    padding: 12px;
    color: var(--success);
    font-weight: 600;
    font-size: 15px;
}

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

.nav-pill {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: 500;
    transition: all var(--transition);
}

.nav-pill:hover { background: rgba(255,255,255,0.15); color: white; }

.field-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.btn-took {
    height: 52px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
}

.btn-took:hover { background: #16A34A; }
.btn-took:active { transform: scale(0.97); }

.btn-cancel-action {
    height: 52px;
    background: white;
    color: var(--danger);
    border: 2px solid var(--danger);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
}

.btn-cancel-action:hover { background: var(--danger-bg); }
.btn-cancel-action:active { transform: scale(0.97); }

.collected-stamp {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--success);
    font-weight: 700;
    font-size: 15px;
    margin-top: 10px;
}

.cancelled-stamp {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--danger);
    font-weight: 700;
    font-size: 15px;
    margin-top: 10px;
}

.card-field-cancelled {
    background: var(--danger-bg);
    border-color: #FECACA;
    opacity: 0.7;
}
