/* Latvia VFS Auto-Booking — Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --teal: #14b8a6;
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --radius: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 100;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 24px; height: 56px;
    background: #1e293b; color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.logo { font-weight: 700; font-size: 16px; letter-spacing: -0.3px; }
.topbar-right { display: flex; gap: 16px; align-items: center; }

/* ── Notification bell ───────────────────────────────────────────── */
.notif-wrap { position: relative; }
.notif-bell {
    position: relative; background: #f1f5f9; border: 1px solid var(--border); cursor: pointer;
    color: #475569; padding: 8px 10px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.notif-bell:hover { background: #e2e8f0; color: var(--primary); border-color: #cbd5e1; }
.notif-bell.has-unread { color: var(--primary); background: #eff6ff; border-color: #bfdbfe; }
.notif-bell.has-unread { color: var(--primary); animation: bell-shake 0.6s ease-in-out 1; }
@keyframes bell-shake { 0%,100%{transform:rotate(0)} 20%{transform:rotate(-12deg)} 40%{transform:rotate(10deg)} 60%{transform:rotate(-6deg)} 80%{transform:rotate(4deg)} }
.notif-badge {
    position: absolute; top: 0; right: 0;
    background: var(--danger); color: #fff;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 10px; font-size: 11px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-card);
}
.notif-panel {
    position: absolute; top: 48px; right: 0; width: 440px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.14);
    max-height: 560px; overflow-y: auto; z-index: 1000;
}
.notif-head {
    padding: 12px 14px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.notif-clear {
    background: transparent; border: 0; color: var(--text-muted);
    cursor: pointer; font-size: 12px; padding: 4px 8px;
}
.notif-clear:hover { color: var(--danger); }
.notif-list { padding: 4px 0; }
.notif-empty { padding: 20px; text-align: center; }
.notif-item {
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 3px;
    cursor: pointer; transition: background 0.15s;
}
.notif-item:hover { background: #f8fafc; }
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: #eff6ff; border-left: 3px solid var(--primary); }
.notif-title { font-weight: 600; color: var(--text); font-size: 13px; }
.notif-desc { font-size: 12px; color: var(--text-muted); }
.notif-time { font-size: 11px; color: var(--text-muted); }
.badge-green { background: #d1fae5; color: #065f46; padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.text-xs { font-size: 10px; }

/* Live stage pill in "Last Check" column */
.stage-pill {
    display: inline-block; padding: 3px 10px;
    background: linear-gradient(135deg, #dbeafe, #e0e7ff);
    color: var(--primary-dark); border: 1px solid #bfdbfe;
    border-radius: 12px; font-size: 11px; font-weight: 500;
    max-width: 240px; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; vertical-align: middle;
}
.stage-pill::before {
    content: "●"; color: var(--primary); margin-right: 4px;
    animation: pulse 1.4s infinite;
}

/* ── Screenshot gallery modal ─────────────────────────────────────── */
.shots-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 2000; padding: 24px;
}
.shots-modal {
    background: var(--bg-card); border-radius: 14px;
    width: min(1100px, 96vw); max-height: 92vh; display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden;
}
.shots-head {
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.shots-close {
    background: transparent; border: 0; font-size: 18px; cursor: pointer;
    color: var(--text-muted); padding: 4px 10px; border-radius: 6px;
}
.shots-close:hover { background: #f1f5f9; color: var(--danger); }
.shots-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px; padding: 16px; overflow-y: auto;
}
.shot-card {
    border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
    background: #fafbfc; cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.shot-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.shot-card img { width: 100%; height: 180px; object-fit: cover; display: block; background: #f8fafc; }
.shot-card .shot-meta { padding: 8px 10px; font-size: 11px; color: var(--text-muted); }
.shot-card .shot-name { font-weight: 500; color: var(--text); font-size: 12px; margin-bottom: 2px; }
.nav-link { color: #cbd5e1; text-decoration: none; font-size: 13px; font-weight: 500; }
.nav-link:hover { color: #fff; }
.logout-link { color: #f87171; }

/* ── Content ────────────────────────────────────────────────── */
.content { max-width: 1400px; margin: 0 auto; padding: 20px 24px; }

/* ── Stats Grid ─────────────────────────────────────────────── */
.stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 16px 20px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.stat-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.icon-blue { background: #dbeafe; color: var(--primary); }
.icon-green { background: #dcfce7; color: var(--success); }
.icon-teal { background: #ccfbf1; color: var(--teal); }
.icon-red { background: #fee2e2; color: var(--danger); }
.stat-value { font-size: 24px; font-weight: 700; display: block; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Action Bar ─────────────────────────────────────────────── */
.action-bar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px; gap: 12px;
}
.action-right { display: flex; gap: 12px; align-items: center; }
.scan-status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.scan-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #94a3b8;
}
.scan-dot.active { background: var(--success); animation: pulse 2s infinite; }
.scan-dot.error { background: var(--danger); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── Filter Bar ────────────────────────────────────────────── */
.filter-bar {
    display: flex; gap: 8px; align-items: center; margin-bottom: 16px;
    background: var(--bg-card); padding: 10px 12px; border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,.06); flex-wrap: wrap;
}
.search-box {
    position: relative; flex: 1 1 240px; min-width: 200px;
}
.search-box .search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none;
}
.search-box .form-control {
    padding-left: 36px; height: 36px;
}
.filter-group {
    position: relative; flex: 0 1 auto; display: flex; align-items: center;
}
.filter-group .filter-icon {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none; transition: color 0.15s;
}
.filter-select {
    height: 36px; min-width: 140px; max-width: 200px;
    padding: 0 28px 0 30px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-card); color: var(--text);
    font-size: 13px; font-family: inherit; cursor: pointer;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
    transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.filter-select:hover { border-color: #cbd5e1; }
.filter-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.filter-select.active {
    background-color: #eff6ff; border-color: var(--primary);
    color: var(--primary-dark); font-weight: 500;
}
.filter-group:has(.filter-select.active) .filter-icon { color: var(--primary); }
.clear-filters-btn {
    display: none; align-items: center; gap: 6px;
    height: 36px; padding: 0 12px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-card); color: var(--text-muted);
    font-size: 13px; font-family: inherit; cursor: pointer;
    transition: all 0.15s;
}
.clear-filters-btn:hover {
    border-color: var(--danger); color: var(--danger); background: #fef2f2;
}
.clear-filters-btn.visible { display: inline-flex; }

/* ── Table ──────────────────────────────────────────────────── */
.table-wrapper {
    background: var(--bg-card); border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,.06); overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 12px 16px; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
    background: #f8fafc; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.customer-row { cursor: pointer; transition: background 0.15s; }
.customer-row:hover { background: #f8fafc; }
.name-cell { font-weight: 600; }

/* ── Expand Button ──────────────────────────────────────────── */
.expand-btn {
    width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border);
    background: #fff; cursor: pointer; font-size: 14px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; color: var(--text-muted);
}
.expand-btn.open { transform: rotate(45deg); background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Detail Row ─────────────────────────────────────────────── */
.detail-row td { padding: 0 !important; background: #f8fafc; }
.detail-content { padding: 20px 24px; border-left: 3px solid var(--primary); }
.detail-grid { display: grid; grid-template-columns: 1fr 240px; gap: 24px; }
.detail-info h4 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 8px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.info-label { font-size: 11px; color: var(--text-muted); display: block; }
.detail-passport { text-align: center; }
.passport-preview { max-width: 200px; border-radius: 6px; border: 1px solid var(--border); margin-bottom: 12px; }
.passport-placeholder {
    width: 200px; height: 140px; border: 2px dashed var(--border); border-radius: 6px;
    display: flex; align-items: center; justify-content: center; color: var(--text-muted);
    font-size: 12px; margin: 0 auto 12px;
}
.detail-actions { display: flex; flex-direction: column; gap: 6px; }

/* ── Status Badges ──────────────────────────────────────────── */
.status-badge {
    display: inline-block; padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
}
.status-waiting { background: #fef3c7; color: #92400e; }
.status-scanning { background: #dbeafe; color: #1e40af; }
.status-booking { background: #e0e7ff; color: #3730a3; }
.status-booked { background: #dcfce7; color: #166534; }
.status-error { background: #fee2e2; color: #991b1b; }
.status-paused { background: #f1f5f9; color: #64748b; }
.status-registering { background: #fef3c7; color: #92400e; }

.register-banner { display:flex; align-items:center; gap:10px; padding:10px 16px; margin: 8px 16px 0; border-radius:8px; font-size:13px; background:#fef3c7; border-left:4px solid #f59e0b; color:#78350f; }
.register-banner.proxy { background:#fee2e2; border-left-color:#dc2626; color:#7f1d1d; }
.register-banner .rb-icon { font-size:16px; font-weight:700; }
.register-banner .rb-details { font-size:11px; opacity:.8; margin-left:auto; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f1f5f9; color: #64748b; }

/* ── Toggle Switch ──────────────────────────────────────────── */
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: #cbd5e1; border-radius: 22px; transition: 0.3s;
}
.toggle-slider::before {
    content: ''; position: absolute; width: 16px; height: 16px;
    left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.3s;
}
input:checked + .toggle-slider { background: var(--success); }
input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; border-radius: 6px; border: 1px solid var(--border);
    background: #fff; color: var(--text); font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 0.15s; text-decoration: none;
}
.btn:hover { background: #f8fafc; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-icon { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 12px; padding: 2px 6px; }
.btn-danger-text { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 16px; font-weight: 700; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.form-control {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; font-family: inherit; color: var(--text); background: #fff;
    transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-full { grid-column: 1 / -1; }
.phone-row { display: flex; align-items: center; gap: 0; }
.phone-prefix {
    padding: 8px 12px; background: #f1f5f9; border: 1px solid var(--border);
    border-right: none; border-radius: 6px 0 0 6px; font-size: 13px; color: var(--text-muted);
    white-space: nowrap;
}
.phone-row .form-control { border-radius: 0 6px 6px 0; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
.modal-card {
    background: #fff; border-radius: 12px; width: 560px; max-height: 90vh;
    overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px 0;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); }
.modal-card form { padding: 16px 24px 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ── Cards ───────────────────────────────────────────────────── */
.card { background: var(--bg-card); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.06); overflow: hidden; }
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.card-header h4 { font-size: 14px; font-weight: 600; }

/* ── Login ───────────────────────────────────────────────────── */
.login-wrapper { display: flex; align-items: center; justify-content: center; min-height: 70vh; }
.login-card {
    background: var(--bg-card); padding: 40px; border-radius: 12px; width: 380px;
    box-shadow: 0 4px 20px rgba(0,0,0,.08); text-align: center;
}
.login-card h2 { font-size: 20px; margin-bottom: 6px; }
.login-subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }

/* ── Alerts ──────────────────────────────────────────────────── */
.flash-container { max-width: 1400px; margin: 12px auto 0; padding: 0 24px; }
.alert { padding: 10px 16px; border-radius: 6px; font-size: 13px; margin-bottom: 8px; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error, .alert-danger { background: #fee2e2; color: #991b1b; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* ── Webmail ─────────────────────────────────────────────────── */
.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 20px; font-weight: 700; }
.account-list { padding: 12px 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.account-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; background: #f1f5f9; border-radius: 16px; font-size: 12px;
}
.badge-close { background: none; border: none; cursor: pointer; color: var(--danger); font-size: 14px; font-weight: 700; }
.unread { font-weight: 600; }

/* ── Utility ─────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-success { color: var(--success); font-weight: 600; }
code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.pwd-mask { font-family: monospace; }
.error-box { background: #fee2e2; color: #991b1b; padding: 8px 12px; border-radius: 6px; font-size: 12px; }
.last-result { background: #f8fafc; padding: 8px 12px; border-radius: 6px; }
.empty-state { text-align: center; padding: 40px !important; color: var(--text-muted); }
.vfs-email { font-size: 12px; font-family: monospace; }
.passport-preview-small { max-width: 160px; border-radius: 4px; border: 1px solid var(--border); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .action-bar { flex-direction: column; align-items: stretch; }
    .filter-bar { gap: 8px; }
    .search-box { flex: 1 1 100%; }
    .filter-group { flex: 1 1 calc(50% - 4px); }
    .filter-select { min-width: 0; max-width: none; width: 100%; }
    .modal-card { width: 95%; margin: 0 10px; }
}
