/* ========================= Global base + theme ========================= */
:root {
    --bg: #0f172a;
    --bg-elevated: #111827;
    --accent: #3b82f6;
    --accent-soft: rgba(59, 130, 246, 0.15);
    --border-subtle: rgba(148, 163, 184, 0.3);
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --text-soft: #6b7280;
    --danger: #ef4444;
    --warning: #f97316;
    --success: #22c55e;
    --radius-lg: 18px;
    --radius-pill: 999px;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.85);
    --shadow-subtle: 0 10px 30px rgba(15, 23, 42, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, #1d283a 0, #020617 45%, #000 100%);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Make sure the app can fill the viewport height */
html,
body {
    height: 100%;
}

/* ========================= Header ========================= */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 22px;
    width: 100%;
    background: linear-gradient(to bottom right, #0a0f2b, #090622 60%, #05041a);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-image {
    max-height: 80px;
    width: auto;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    padding: 0 5px !important;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.35));
}

.logo-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #f5e76b;
    text-shadow: 0 1px 8px rgba(255,243,136,0.3);
    white-space: nowrap;
}

header nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

header nav a {
    text-decoration: none;
    color: #e5e7eb;
    font-size: 18px;
    padding: 9px 18px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

header nav a:hover {
    background: rgba(59,130,246,0.15);
    border-color: rgba(59,130,246,0.4);
    color: #fff;
}

.login-btn,
.logout-btn {
    border: none;
    padding: 9px 20px;
    font-size: 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.login-btn {
    background: linear-gradient(135deg, #f2d648, #d6b600);
    color: #06003b;
    box-shadow: 0 4px 14px rgba(255,227,88,0.35);
}

.login-btn:hover {
    transform: translateY(-1px);
}

.logout-btn {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 4px 14px rgba(239,68,68,0.35);
}

.logout-btn:hover {
    transform: translateY(-1px);
}

/* Hamburger button */
.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #e5e7eb;
    margin-left: auto;
}

.menu-toggle-label {
    font-size: 14px;
}

.menu-toggle-icon {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.menu-toggle-icon span {
    display: block;
    width: 18px;
    height: 2px;
    background: #e5e7eb;
    border-radius: 999px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* animation to X */
header.nav-open .menu-toggle-icon span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

header.nav-open .menu-toggle-icon span:nth-child(2) {
    opacity: 0;
}

header.nav-open .menu-toggle-icon span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Responsive header tweaks */
@media (max-width: 1024px) {
    header {
        padding: 12px 16px;
    }

    nav a,
    .login-btn,
    .logout-btn {
        font-size: 16px;
        padding: 8px 16px;
    }

    .logo-text {
        font-size: 22px;
    }

    .logo-image {
        max-height: 64px;
    }
}

@media (max-width: 768px) {
    header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 14px;
    }

    .logo {
        gap: 10px;
    }

    .logo-text {
        font-size: 20px;
        white-space: normal;
    }

    .logo-image {
        max-height: 56px;
    }

    .menu-toggle {
        display: inline-flex;
    }

    /* Only affect header nav */
    header > nav {
        width: 100%;
        display: none;
        margin-top: 8px;
    }

    header.nav-open > nav {
        display: block;
    }

    header nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    header nav li {
        width: 100%;
    }

    header nav a,
    .login-btn,
    .logout-btn {
        width: 100%;
        text-align: left;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 8px 10px;
    }

    .logo {
        gap: 8px;
    }

    .logo-image {
        max-height: 48px;
    }

    .logo-text {
        font-size: 18px;
    }
}

/* ========================= App shell / layout ========================= */
/* Two-column grid: sidebar + main, at ALL widths */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    align-items: stretch;
    background:
        radial-gradient(circle at 0 0, rgba(59,130,246,0.2), transparent 55%),
        radial-gradient(circle at 100% 0, rgba(236,72,153,0.12), transparent 50%);
}

/* Slightly narrower sidebar on small screens, but still two columns */
/*@media (max-width: 960px) {*/
/*    .app-shell {*/
/*        grid-template-columns: 220px minmax(0, 1fr);*/
/*    }*/
/*}*/

/* Collapsed sidebar state, shrink first column */
.app-shell.sidebar-collapsed {
    grid-template-columns: 56px minmax(0, 1fr);
}

@media (max-width: 960px) {
    .app-shell.sidebar-collapsed {
        grid-template-columns: 56px minmax(0, 1fr);
    }
}

/* Sidebar basic layout (visual styles come from sidebar.php inline <style>) */
.sidebar {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

/* Main content grid column */
.main {
    min-width: 0;
    padding: 20px 22px 26px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

@media (max-width: 720px) {
    .main {
        padding: 16px 14px 22px;
    }
}

/* ========================= Top bar + buttons ========================= */
.top-bar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.top-bar-left {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.page-subtext {
    font-size: 0.9rem;
    color: var(--text-soft);
}

.tag {
    border-radius: var(--radius-pill);
    padding: 5px 11px;
    font-size: 0.8rem;
    border: 1px solid rgba(148,163,184,0.4);
    color: var(--text-muted);
    background: rgba(15,23,42,0.95);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.button {
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.96);
    color: #e5e7eb;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    transition: all 0.15s ease-out;
    white-space: nowrap;
}

.button.primary {
    border-color: rgba(59, 130, 246, 0.9);
    background: radial-gradient(circle at 0 0, #3b82f6, #1d4ed8);
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.45);
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-subtle);
}

.button span.icon {
    font-size: 1rem;
}

.time-filter {
    padding: 8px 11px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(15, 23, 42, 0.98);
    color: var(--text-muted);
    font-size: 0.8rem;
    outline: none;
}

/* ========================= Panels ========================= */
.panel {
    background: radial-gradient(circle at 0 0, rgba(148, 163, 184, 0.1), rgba(15, 23, 42, 0.98));
    border-radius: var(--radius-lg);
    padding: 16px 16px 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 0 0, rgba(59, 130, 246, 0.06), transparent 55%),
        radial-gradient(circle at 100% 0, rgba(236, 72, 153, 0.08), transparent 55%);
    opacity: 0.8;
    pointer-events: none;
}

.panel-inner {
    position: relative;
    z-index: 1;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.panel-title {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title-icon {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.92);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.5);
}

.panel-subtitle {
    font-size: 0.85rem;
    color: var(--text-soft);
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--accent);
}

/* KPI row */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 10px;
}

@media (max-width: 960px) {
    .kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .kpi-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

.kpi-card {
    border-radius: 13px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    padding: 10px 11px;
    background: rgba(15, 23, 42, 0.96);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-label {
    font-size: 0.85rem;
    color: var(--text-soft);
    display: flex;
    justify-content: space-between;
    gap: 6px;
    align-items: center;
}

.kpi-value {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.kpi-badge {
    font-size: 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    padding: 2px 8px;
    color: var(--text-muted);
}

.kpi-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ========================= Layout grids / lists / footer ========================= */
.grid-overview {
    display: grid;
    grid-template-columns: 1.4fr 1.1fr;
    gap: 16px;
}

@media (max-width: 1080px) {
    .grid-overview {
        grid-template-columns: minmax(0, 1fr);
    }
}

.stack-vertical {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stack-horizontal {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 720px) {
    .stack-horizontal {
        grid-template-columns: minmax(0, 1fr);
    }
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 6px;
    margin-bottom: 6px;
}

.pill-soft {
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.78rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: var(--text-soft);
    background: rgba(15, 23, 42, 0.96);
}

.pill-soft.accent {
    border-color: rgba(59, 130, 246, 0.8);
    color: #bfdbfe;
    background: rgba(37, 99, 235, 0.2);
}

.table-compact {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin-top: 6px;
}

.table-compact th,
.table-compact td {
    padding: 6px 5px;
    border-bottom: 1px solid rgba(31, 41, 55, 0.9);
}

.table-compact thead {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-soft);
}

.table-compact tbody tr:hover td {
    background: rgba(15, 23, 42, 0.9);
}

.list {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.list li {
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feature-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.9);
}

.empty-state {
    padding: 9px;
    border-radius: 12px;
    border: 1px dashed rgba(148, 163, 184, 0.4);
    font-size: 0.8rem;
    color: var(--text-soft);
    background: rgba(15, 23, 42, 0.96);
    margin-top: 8px;
}

.empty-title {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 3px;
    color: #e5e7eb;
}

.label-pill {
    font-size: 0.78rem;
    border-radius: 999px;
    padding: 3px 8px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: var(--text-soft);
}

footer {
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--text-soft);
    text-align: right;
    opacity: 0.7;
}

footer span {
    color: var(--accent);
}

/* ========================= Generic forms (CRM) ========================= */
.form-layout-narrow {
    max-width: 1120px;
    margin: 0 auto 28px;
}

/* 2-column responsive form grid */
.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
}

@media (max-width: 720px) {
    .form-grid-2 {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Form groups */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
}

.form-label {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.form-label .required {
    color: var(--warning);
    margin-left: 3px;
}

/* Inputs */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-main);
    font-size: 0.85rem;
    padding: 7px 9px;
    outline: none;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease,
        transform 0.08s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-soft);
    background: #020617;
    transform: translateY(-1px);
}

.form-textarea {
    min-height: 70px;
    resize: vertical;
}

.form-input[type="file"] {
    padding: 5px 9px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* Full-width fields inside grid */
.form-full {
    grid-column: 1 / -1;
}

/* Actions + hints */
.form-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-soft);
    margin-top: 8px;
}

.form-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Light section divider inside panels */
.form-divider {
    height: 1px;
    margin: 14px 0 16px;
    background: linear-gradient(
        90deg,
        rgba(148, 163, 184, 0.5),
        rgba(148, 163, 184, 0.12)
    );
}

/* ========================= Full-width content shell (no sidebar) ========================= */
.content-shell {
    min-height: 100vh;
    width: 100%;
    display: block;
    background:
        radial-gradient(circle at 0 0, rgba(59,130,246,0.2), transparent 55%),
        radial-gradient(circle at 100% 0, rgba(236,72,153,0.12), transparent 50%);
}

/* =====================================================
   BUSINESS ENQUIRY PAGE (Apps/CRM/BusinessEnquiry)
   ===================================================== */
.enquiry-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Content area */
.enquiry-content {
    max-width: 960px;
    margin: 0 auto;
}

.enquiry-intro-title {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.enquiry-intro-sub {
    font-size: 0.9rem;
    color: var(--text-soft);
    margin-top: 4px;
}

.enquiry-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
    margin-top: 18px;
}

@media (max-width: 900px) {
    .enquiry-form-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.enquiry-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
}

.enquiry-label {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.enquiry-label .required {
    color: #f97316;
    margin-left: 3px;
}

.enquiry-input,
.enquiry-select,
.enquiry-textarea {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(15, 23, 42, 0.96);
    color: var(--text-main);
    font-size: 0.85rem;
    padding: 7px 9px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.enquiry-textarea {
    min-height: 70px;
    resize: vertical;
}

.enquiry-input:focus,
.enquiry-select:focus,
.enquiry-textarea:focus {
    border-color: rgba(59, 130, 246, 0.9);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
    background: rgba(15, 23, 42, 0.98);
}

.enquiry-input[type="file"] {
    padding: 5px 9px;
    font-size: 0.8rem;
}

.enquiry-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.enquiry-hint {
    font-size: 0.78rem;
    color: var(--text-soft);
    margin-top: 8px;
}
