/* Voice-Tele LK — Main Styles */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --info: #0ea5e9;
    --info-light: #f0f9ff;
    --secondary: #6b7280;
    --secondary-light: #f9fafb;

    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);

    --header-h: 56px;
    --sidenav-w: 240px;
    --bottomnav-h: 64px;
    --transition: 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* ─── Top Header ─────────────────────────────────── */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
    box-shadow: var(--shadow);
}

.top-header__left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-header__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
}
.top-header__logo:hover { color: var(--primary); }
.logo-icon { font-size: 22px; }

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: var(--radius-sm);
}
.menu-toggle:hover { background: var(--secondary-light); }

.top-header__right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}
.user-name { font-weight: 500; color: var(--text); }

.btn-icon {
    display: flex;
    align-items: center;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
}
.btn-icon:hover { background: var(--secondary-light); color: var(--danger); }

/* ─── Side Navigation ────────────────────────────── */
.side-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: var(--sidenav-w);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 90;
    padding: 12px 8px;
    transition: transform var(--transition);
}

.side-nav__items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.side-nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}
.side-nav__item:hover {
    background: var(--secondary-light);
    color: var(--text);
}
.side-nav__item.active {
    background: var(--primary-light);
    color: var(--primary);
}
.side-nav__item .material-icons-round { font-size: 20px; }

.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 85;
}

/* ─── Bottom Navigation (mobile) ─────────────────── */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottomnav-h);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding: 4px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    position: relative;
    transition: var(--transition);
}
.bottom-nav__item.active { color: var(--primary); }
.bottom-nav__item .material-icons-round { font-size: 22px; }

/* ─── Main Content ───────────────────────────────── */
.main-content {
    margin-left: var(--sidenav-w);
    margin-top: var(--header-h);
    min-height: calc(100vh - var(--header-h));
    padding: 24px;
}

.page-content {
    max-width: 1200px;
    margin: 0 auto;
}

/* ─── Cards ──────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    overflow: hidden;
}
.card + .card { margin-top: 16px; }

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h2 { font-size: 16px; font-weight: 600; }

.card-body { padding: 20px; }
.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--secondary-light);
}

/* ─── Buttons ────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.4;
    text-decoration: none;
}
.btn .material-icons-round { font-size: 18px; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }
.btn-secondary { background: var(--secondary-light); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border-light); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Forms ──────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    background: var(--bg-card);
    transition: var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-control::placeholder { color: var(--text-muted); }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ─── Tables ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}
th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--secondary-light);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
tr:hover td { background: var(--secondary-light); }
td a { font-weight: 500; }

/* ─── Badges ─────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}
.badge-primary   { background: var(--primary-light);  color: var(--primary); }
.badge-success   { background: var(--success-light);  color: var(--success); }
.badge-warning   { background: var(--warning-light);  color: var(--warning); }
.badge-danger    { background: var(--danger-light);    color: var(--danger); }
.badge-info      { background: var(--info-light);      color: var(--info); }
.badge-secondary { background: var(--secondary-light); color: var(--secondary); }
.badge-sm { padding: 1px 6px; font-size: 10px; }
.badge-xs {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* ─── Alerts ─────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #bbf7d0; }
.alert-error, .alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--info-light); color: #0369a1; border: 1px solid #bae6fd; }
.alert-close { background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; opacity: 0.6; }
.alert-close:hover { opacity: 1; }

.flash-message { animation: fadeIn 0.3s ease; }

/* ─── Stat Cards ─────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
}
.stat-card__value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-card__label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-card__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.stat-card__icon .material-icons-round { font-size: 22px; color: #fff; }

/* ─── Pagination ─────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: var(--transition);
}
.pagination a:hover { background: var(--secondary-light); color: var(--text); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: 0.4; pointer-events: none; }

/* ─── Modal ──────────────────────────────────────── */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-backdrop.show { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--secondary-light); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border-light); display: flex; gap: 8px; justify-content: flex-end; }

/* ─── Search-specific styles ─────────────────────── */
.search-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
}
.search-inputs .separator { color: var(--text-muted); font-weight: 600; padding: 0 2px; }
.code-input, .num-input {
    width: 36px;
    height: 40px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
}
.code-input:focus, .num-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.quick-codes {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.quick-codes .btn { font-size: 12px; padding: 4px 10px; }

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}
.search-result-item:hover { background: var(--secondary-light); }
.search-result-number {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Cart */
.cart-panel {
    background: var(--primary-light);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
}
.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.cart-count { font-weight: 600; color: var(--primary); }
.cart-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.cart-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    font-size: 12px;
    font-family: monospace;
}
.cart-item-remove {
    cursor: pointer;
    color: var(--danger);
    font-size: 14px;
    line-height: 1;
}

/* Region modal */
.region-list {
    max-height: 400px;
    overflow-y: auto;
}
.region-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
}
.region-item:hover { background: var(--primary-light); }
.region-city { font-weight: 500; }
.region-code { font-family: monospace; color: var(--primary); font-weight: 600; }

/* ─── Empty state ────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state .material-icons-round { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ─── Steps (wizard) ─────────────────────────────── */
.steps {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
}
.step {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 3px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
}
.step.active { color: var(--primary); border-color: var(--primary); }
.step.completed { color: var(--success); border-color: var(--success); }
.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    margin-right: 6px;
}
.step.active .step-number { background: var(--primary); color: #fff; }
.step.completed .step-number { background: var(--success); color: #fff; }

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
    .menu-toggle { display: flex; }

    .side-nav {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }
    .side-nav.open { transform: translateX(0); }
    .nav-overlay.show { display: block; }

    .bottom-nav { display: flex; }

    .main-content {
        margin-left: 0;
        margin-bottom: var(--bottomnav-h);
        padding: 16px;
    }

    .top-header .user-name,
    .top-header .user-role,
    .btn-text { display: none; }

    .form-row { grid-template-columns: 1fr; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .code-input, .num-input { width: 30px; height: 36px; font-size: 16px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .search-inputs { flex-wrap: wrap; }
}

/* ─── Animations ─────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Utils ──────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-lg { font-size: 16px; }
.font-mono { font-family: 'SF Mono', 'Consolas', monospace; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Wizard Steps ──────────────────────────────── */
.steps { display: flex; gap: 4px; overflow-x: auto; }
.step {
    flex: 1; min-width: 0;
    padding: 10px 12px; border-radius: 8px;
    background: var(--card-bg); border: 2px solid var(--border);
    cursor: pointer; font-size: 13px; text-align: center;
    transition: all .2s; white-space: nowrap;
}
.step:hover { border-color: var(--primary-light); }
.step.active { border-color: var(--primary); background: rgba(79,70,229,.08); font-weight: 600; }
.step.completed { border-color: var(--success); background: rgba(16,185,129,.06); }
.step-number {
    display: inline-flex; width: 22px; height: 22px; border-radius: 50%;
    background: var(--border); color: var(--text-muted); font-size: 12px; font-weight: 700;
    align-items: center; justify-content: center; margin-right: 4px; vertical-align: middle;
}
.step.active .step-number { background: var(--primary); color: #fff; }
.step.completed .step-number { background: var(--success); color: #fff; }

/* ─── Empty State ───────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .material-icons-round { font-size: 48px; opacity: .4; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 15px; margin-bottom: 8px; }

/* ─── Extra ─────────────────────────────────────── */
.btn-block { display: block; width: 100%; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.card-footer { padding: 12px 16px; border-top: 1px solid var(--border); }
