/* ============================================================
   IO TOURS – Admin Panel  |  assets/css/new.css
   Covers: login, masterpage, default dashboard
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Variables ── */
:root {
    --accent:        #2563eb;
    --accent-dark:   #1d4ed8;
    --accent-light:  #eff6ff;
    --accent-glow:   rgba(37,99,235,0.15);

    --bg:            #f1f5f9;
    --card:          #ffffff;
    --border:        #e2e8f0;
    --border-focus:  #2563eb;

    --text:          #0f172a;
    --text-muted:    #64748b;
    --text-label:    #475569;

    --sidebar-bg:    #ffffff;
    --sidebar-hover: #eff6ff;
    --sidebar-active:#2563eb;
    --sidebar-text:  #475569;
    --sidebar-sub:   #94a3b8;
    --sidebar-w:     240px;
    --sidebar-w-col: 60px;

    --topbar-h:      56px;

    --error-bg:      rgba(239,68,68,0.08);
    --error-border:  rgba(239,68,68,0.35);
    --error-text:    #b91c1c;

    --radius:        12px;
    --radius-sm:     8px;
    --shadow:        0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.05);
    --shadow-md:     0 4px 20px rgba(0,0,0,0.10);
}

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

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

a { text-decoration: none; color: inherit; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.bg-grid {
    position: fixed; inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 36px 36px;
    opacity: 0.45;
    pointer-events: none; z-index: 0;
}
.orb { position: fixed; border-radius: 50%; filter: blur(80px); pointer-events: none; z-index: 0; }
.orb-1 { width: 420px; height: 420px; background: rgba(37,99,235,0.10); top: -100px; right: -120px; }
.orb-2 { width: 320px; height: 320px; background: rgba(99,179,237,0.10); bottom: -80px; left: -100px; }

.page {
    position: relative; z-index: 1;
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px 16px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 44px 40px 36px;
    width: 100%; max-width: 400px;
    box-shadow: 0 20px 60px rgba(37,99,235,0.10), 0 4px 16px rgba(0,0,0,0.06);
    position: relative; overflow: hidden;
}
.card::before {
    content: ''; position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    border-radius: var(--radius) var(--radius) 0 0;
}

.logo-wrap { text-align: center; margin-bottom: 32px; }
.logo-img { height: 56px; width: auto; filter: drop-shadow(0 2px 8px rgba(37,99,235,0.15)); }
.logo-sub { font-size: 12px; color: var(--text-muted); margin-top: 8px; letter-spacing: 0.3px; }

.error-msg {
    display: none; align-items: center; gap: 8px;
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-left: 4px solid #ef4444;
    border-radius: var(--radius-sm);
    padding: 10px 14px; color: var(--error-text);
    font-size: 13px; margin-bottom: 18px; line-height: 1.45;
}
.error-msg.show { display: flex; }
.error-msg svg { flex-shrink: 0; color: #ef4444; }

.field { margin-bottom: 18px; }
.field label {
    display: block; font-size: 11.5px; font-weight: 600;
    color: var(--text-label); letter-spacing: 0.6px;
    text-transform: uppercase; margin-bottom: 7px;
}
.input-wrap { position: relative; }
.input-wrap input[type="text"],
.input-wrap input[type="password"],
.input-wrap input[type="email"] {
    width: 100%; background: #f8fafc;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px 11px 38px;
    font-size: 14px; font-family: 'Inter', sans-serif;
    color: var(--text); outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none; appearance: none;
}
.input-wrap input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: #fff;
}
.input-wrap input::placeholder { color: #b0bec5; }

.input-icon {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%); color: #94a3b8;
    display: flex; align-items: center; pointer-events: none;
}
.toggle-pw {
    position: absolute; right: 10px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: #94a3b8;
    display: flex; align-items: center; padding: 4px;
    border-radius: 6px; transition: color 0.2s, background 0.2s;
}
.toggle-pw:hover { color: var(--accent); background: var(--accent-light); }

.remember {
    display: flex; align-items: center; gap: 9px;
    font-size: 13px; color: var(--text-muted);
    cursor: pointer; margin-bottom: 22px; user-select: none;
}
.remember input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.checkmark {
    width: 18px; height: 18px; min-width: 18px;
    border: 2px solid #93c5fd; border-radius: 5px;
    background: #f8fafc; display: inline-flex;
    align-items: center; justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}
.checkmark svg { opacity: 0; transition: opacity 0.15s; }
.remember:has(input:checked) .checkmark { background: var(--accent); border-color: var(--accent); }
.remember:has(input:checked) .checkmark svg { opacity: 1; }

.btn, input.btn {
    width: 100%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff; border: none;
    border-radius: var(--radius-sm);
    padding: 13px; font-size: 14.5px; font-weight: 600;
    font-family: 'Inter', sans-serif; cursor: pointer;
    letter-spacing: 0.2px;
    box-shadow: 0 4px 14px rgba(37,99,235,0.30);
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    display: block; text-align: center;
}
.btn:hover, input.btn:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    box-shadow: 0 6px 20px rgba(37,99,235,0.40);
    transform: translateY(-1px);
}
.btn:active, input.btn:active { transform: translateY(0); }
.btn:disabled, input.btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.divider { height: 1px; background: var(--border); margin: 28px 0 20px; }
.card-footer { text-align: center; font-size: 12.5px; color: var(--text-muted); }
.card-footer a { color: var(--accent); font-weight: 500; }
.card-footer a:hover { text-decoration: underline; }

/* ============================================================
   MASTERPAGE – SIDEBAR
   ============================================================ */

.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.45); z-index: 200;
}
.sidebar-overlay.show { display: block; }

.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 300;
    transition: width 0.28s ease, transform 0.28s ease;
    overflow: hidden;
}

/* Collapsed state */
.sidebar.collapsed { width: var(--sidebar-w-col); }
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .sidebar-user-info { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .nav-icon { margin: 0; }
.sidebar.collapsed .sidebar-footer { justify-content: center; padding: 12px 0; flex-wrap: wrap; gap: 6px; }
.sidebar.collapsed .sidebar-user-avatar { margin: 0; }
.sidebar.collapsed .sidebar-logout { margin: 0; }
.sidebar.collapsed .nav-section { display: none !important; }
.sidebar.collapsed .hamburger { margin: 0 auto; }

.sidebar-logo {
    display: flex; align-items: center; justify-content: center;
    padding: 16px 12px;
    border-bottom: 1px solid var(--border);
    min-height: 72px;
}
.sidebar-logo-img {
    height: 48px; width: auto;
    max-width: 90%;
    object-fit: contain;
}
.sidebar.collapsed .sidebar-logo-img { height: 32px; }

.sidebar .hamburger { display: none; }

.sidebar-nav {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding: 10px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 16px; color: var(--sidebar-text);
    font-size: 13.5px; font-weight: 400;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap; cursor: pointer;
}
.nav-item:hover { background: var(--sidebar-hover); color: var(--accent); }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 500; }
.nav-icon { display: flex; align-items: center; min-width: 20px; }

.nav-section-title {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 16px 6px;
    font-size: 10px; font-weight: 700;
    color: var(--sidebar-sub);
    letter-spacing: 0.8px; text-transform: uppercase;
    cursor: pointer; user-select: none;
    transition: color 0.15s; white-space: nowrap;
}
.nav-section-title:hover { color: var(--accent); }
.nav-section-arrow { transition: transform 0.25s; }
.nav-section-title.collapsed .nav-section-arrow { transform: rotate(-90deg); }
.nav-section { overflow: hidden; transition: height 0.3s ease, opacity 0.3s ease; }
.nav-section.hidden { height: 0 !important; opacity: 0; }

.sidebar-footer {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    min-height: 56px;
}
.sidebar-user-avatar {
    width: 32px; height: 32px; min-width: 32px;
    background: var(--accent-light);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
}
.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name { display: block; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { display: block; font-size: 11px; color: var(--sidebar-sub); margin-top: 1px; }
.sidebar-logout {
    color: var(--sidebar-sub); padding: 6px; border-radius: 6px;
    display: flex; align-items: center;
    transition: color 0.2s, background 0.2s;
}
.sidebar-logout:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

/* ============================================================
   MASTERPAGE – MAIN WRAP & TOPBAR
   ============================================================ */

.main-wrap {
    margin-left: var(--sidebar-w-col); /* collapsed: 60px */
    min-height: 100vh;
    min-width: 0;
    display: flex; flex-direction: column;
    transition: margin-left 0.28s ease;
}
.main-wrap.sidebar-open { margin-left: var(--sidebar-w); }

.content { flex: 1; padding: 24px; min-width: 0; overflow-x: hidden; }

.topbar {
    position: sticky; top: 0; z-index: 100;
    height: var(--topbar-h);
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
    padding: 0 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.mobile-hamburger {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 6px; border-radius: 8px;
    display: flex; align-items: center;
    transition: color 0.2s, background 0.2s;
}
.mobile-hamburger:hover { color: var(--text); background: var(--bg); }

.topbar-breadcrumb { flex: 1; font-size: 14px; font-weight: 500; color: var(--text-muted); }
.topbar-breadcrumb span { color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-date { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.topbar-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--accent); color: #fff;
    border-radius: var(--radius-sm);
    padding: 7px 14px; font-size: 13px; font-weight: 500;
    transition: background 0.2s, box-shadow 0.2s; white-space: nowrap;
}
.topbar-btn:hover { background: var(--accent-dark); box-shadow: 0 3px 10px var(--accent-glow); }
.topbar-btn-label { display: inline; }



/* ============================================================
   DASHBOARD
   ============================================================ */

.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header-left { display: flex; align-items: center; gap: 12px; }
.page-header-icon {
    width: 40px; height: 40px;
    background: var(--accent-light);
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.page-header-text h3 { font-size: 18px; font-weight: 700; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px; margin-bottom: 24px;
}
.stat-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex; align-items: flex-start; gap: 16px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card-icon {
    width: 44px; height: 44px; min-width: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.stat-card--blue  .stat-card-icon { background: #eff6ff; color: #2563eb; }
.stat-card--red   .stat-card-icon { background: #fef2f2; color: #ef4444; }
.stat-card--gold  .stat-card-icon { background: #fffbeb; color: #d97706; }
.stat-card--green .stat-card-icon { background: #f0fdf4; color: #16a34a; }
.stat-card-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; }
.stat-card-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-card-sub   { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 16px;
}
.panel {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.panel-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 600; color: var(--text);
}
.panel-title svg { color: var(--accent); }
.panel-link { font-size: 12.5px; color: var(--accent); font-weight: 500; }
.panel-link:hover { text-decoration: underline; }
.panel-body { padding: 16px 20px; }
.panel-body-flush { padding: 0; }

.table-wrap { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-table th {
    padding: 10px 16px; text-align: left;
    font-size: 12px; font-weight: 600;
    color: var(--text-muted); letter-spacing: 0.3px;
    background: #f8fafc; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.dash-table td {
    padding: 11px 16px; border-bottom: 1px solid #f1f5f9;
    color: var(--text); vertical-align: middle;
}
.dash-table tr:last-child td { border-bottom: none; }
.dash-table tr:hover td { background: #f8fafc; }
.td-id { font-weight: 600; white-space: nowrap; }
.td-muted { color: var(--text-muted); }
.td-name { font-weight: 500; }
.ref-code { color: var(--accent); font-weight: 600; }
.ref-code:hover { text-decoration: underline; }

.badge-active-yes {
    display: inline-block; background: #f0fdf4; color: #15803d;
    border: 1px solid #bbf7d0; border-radius: 20px;
    padding: 2px 10px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.badge-active-no {
    display: inline-block; background: #fef2f2; color: #b91c1c;
    border: 1px solid #fecaca; border-radius: 20px;
    padding: 2px 10px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.badge {
    display: inline-block; border-radius: 20px;
    padding: 3px 12px; font-size: 12px; font-weight: 500;
}
.badge-confirmed { background: #eff6ff; color: #1d4ed8; }
.badge-pending   { background: #fef3c7; color: #92400e; }
.badge-active    { background: #f0fdf4; color: #15803d; }
.badge-done      { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fef2f2; color: #b91c1c; }

.status-list { padding: 0; }
.status-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; border-bottom: 1px solid #f1f5f9;
}
.status-row:last-child { border-bottom: none; }
.status-count { font-size: 18px; font-weight: 700; color: var(--text); }

.quick-actions { display: flex; flex-direction: column; gap: 8px; }
.qa-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-size: 13.5px; font-weight: 500;
    background: var(--card);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.qa-btn:hover { background: var(--accent-light); border-color: #bfdbfe; color: var(--accent); }
.qa-btn svg { color: var(--text-muted); flex-shrink: 0; }
.qa-btn:hover svg { color: var(--accent); }
.qa-btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.qa-btn--primary svg { color: #fff; }
.qa-btn--primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.qa-btn--primary:hover svg { color: #fff; }

.side-panels { display: flex; flex-direction: column; gap: 16px; }

.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; padding: 40px 20px;
    color: var(--text-muted); font-size: 13px; text-align: center;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ── Large tablet / small desktop (≤1280px) ──
   Sidebar still visible, stats go 2-column,
   bottom grid stays side-by-side but narrower right panel */
@media (max-width: 1280px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .bottom-grid { grid-template-columns: 1fr 300px; }
}

/* ── Tablet landscape (≤1023px) ──
   Sidebar becomes off-canvas drawer */
@media (max-width: 1023px) {
    /* Sidebar: always full-width drawer, hidden off-screen */
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w) !important;
    }
    .sidebar.open      { transform: translateX(0); }
    .sidebar.collapsed { width: var(--sidebar-w) !important; transform: translateX(-100%); }

    /* Main content takes full width */
    .main-wrap,
    .main-wrap.sidebar-open { margin-left: 0 !important; }

    /* Topbar: hide label text on button, keep icon only */
    .topbar-btn-label { display: none; }
    .topbar-date      { display: none; }

    /* Bottom grid: stack vertically */
    .bottom-grid  { grid-template-columns: 1fr; }

    /* Side panels: 2 columns when stacked */
    .side-panels  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
}

/* ── Tablet portrait (≤768px) ── */
@media (max-width: 768px) {
    .content { padding: 16px; }

    /* Stats: 2 columns */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

    /* Stat card: tighter */
    .stat-card { padding: 16px; gap: 12px; }
    .stat-card-icon { width: 38px; height: 38px; min-width: 38px; }
    .stat-card-value { font-size: 22px; }
    .stat-card-sub { font-size: 11px; }

    /* Side panels: stack */
    .side-panels { grid-template-columns: 1fr; }

    /* Table: hide less important columns */
    .dash-table .col-hide-tablet { display: none; }

    /* Topbar: compact */
    .topbar { padding: 0 12px; gap: 8px; }
    .topbar-breadcrumb { font-size: 13px; }

    /* Page header */
    .page-header-text h3 { font-size: 16px; }
}

/* ── Mobile (≤580px) ──
   Dash table becomes card-style rows */
@media (max-width: 580px) {
    /* Stats: single column */
    .stats-grid { grid-template-columns: 1fr; gap: 10px; }

    /* Stat card horizontal compact */
    .stat-card { padding: 14px 16px; gap: 14px; }
    .stat-card-value { font-size: 26px; }

    /* Table: horizontal scroll with min-width so it doesn't squish */
    .table-wrap { -webkit-overflow-scrolling: touch; }
    .dash-table { min-width: 560px; }

    /* Bottom grid full width */
    .bottom-grid { gap: 12px; }

    /* Content padding */
    .content { padding: 12px; }

    /* Topbar: shrink */
    .topbar { height: 50px; padding: 0 10px; }
    .topbar-btn { padding: 6px 10px; }

    /* Page header icon hidden on small screens */
    .page-header-icon { display: none; }
    .page-header { margin-bottom: 16px; }
}

/* ── Small mobile (≤480px) ── */
@media (max-width: 480px) {
    /* Login card */
    .card { padding: 32px 20px 28px; border-radius: 10px; }
    .logo-img { height: 48px; }

    /* Prevent iOS zoom on input focus */
    .input-wrap input[type="text"],
    .input-wrap input[type="password"] { font-size: 16px; }

    /* Quick actions: compact */
    .qa-btn { padding: 9px 12px; font-size: 13px; }

    /* Status list */
    .status-count { font-size: 16px; }
    .badge { font-size: 11px; padding: 3px 8px; }
}

/* ── Very small (≤360px) ── */
@media (max-width: 360px) {
    .card { padding: 24px 14px 20px; }
    .stats-grid { gap: 8px; }
    .stat-card { padding: 12px; gap: 10px; }
    .stat-card-value { font-size: 20px; }
    .content { padding: 8px; }
    .topbar { padding: 0 8px; }
}
