/* ============================================================
   Main CSS — Global styles, layout, nav, components
   ============================================================ */

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

:root {
    --primary:      #1a73e8;
    --primary-dark: #1558b0;
    --success:      #34a853;
    --warning:      #fbbc04;
    --danger:       #ea4335;
    --muted:        #9aa0a6;
    --border:       #e0e0e0;
    --bg:           #f8f9fa;
    --surface:      #ffffff;
    --text:         #202124;
    --text-light:   #5f6368;
    --radius:       6px;
    --shadow:       0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
    --nav-height:   56px;
}

html { font-size: 15px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

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

code {
    font-family: 'Courier New', monospace;
    font-size: .88rem;
    background: #f1f3f4;
    padding: 2px 5px;
    border-radius: 3px;
}

pre {
    background: #f1f3f4;
    padding: 14px 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: .85rem;
}

pre code { background: none; padding: 0; }

/* ---- Navbar -------------------------------------------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-height);
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,.2);
}

.navbar-brand a {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: .3px;
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    list-style: none;
    gap: 4px;
    flex: 1;
}

.navbar-menu a {
    color: rgba(255,255,255,.85);
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: .92rem;
    text-decoration: none;
    transition: background .15s;
}

.navbar-menu a:hover,
.navbar-menu a.active {
    background: rgba(255,255,255,.18);
    color: #fff;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .88rem;
    color: rgba(255,255,255,.9);
    margin-left: auto;
}

/* ---- Main content -------------------------------------- */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* ---- Cards --------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.card-header h2, .card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

/* ---- Buttons ------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, opacity .15s;
    white-space: nowrap;
}

.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); color: #fff; text-decoration: none; }
.btn-success  { background: var(--success);  color: #fff; }
.btn-success:hover  { opacity: .88; text-decoration: none; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-danger:hover   { opacity: .88; color: #fff; text-decoration: none; }
.btn-outline  { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover  { background: var(--bg); text-decoration: none; }

.btn-sm  { padding: 5px 12px; font-size: .83rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---- Badges -------------------------------------------- */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 12px;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .3px;
}

.badge-new      { background: #e8f0fe; color: var(--primary); }
.badge-reviewed { background: #e6f4ea; color: var(--success); }
.badge-forwarded{ background: #fce8e6; color: var(--danger);  }
.badge-success  { background: #e6f4ea; color: var(--success); }
.badge-inactive { background: #f1f3f4; color: var(--muted);   }

/* ---- Alerts -------------------------------------------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: .92rem;
}

.alert-success { background: #e6f4ea; color: #1e7e34; border: 1px solid #c3e6cb; }
.alert-error   { background: #fce8e6; color: #b31412; border: 1px solid #f5c2c1; }

/* ---- Login page ---------------------------------------- */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px 40px;
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo h2 {
    color: var(--primary);
    font-size: 1.4rem;
}

/* ---- Two-col layout ------------------------------------ */
.two-col-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

/* ---- Enquiry detail layout ----------------------------- */
.enquiry-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}

.meta-list {
    padding: 16px 18px;
}

.meta-list dt {
    font-size: .78rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 14px;
}

.meta-list dt:first-child {
    margin-top: 0;
}

.meta-list dd {
    font-size: .95rem;
    margin-top: 3px;
    color: var(--text);
}

.detail-table { width: 100%; border-collapse: collapse; }
.detail-table th, .detail-table td { padding: 10px 18px; border-bottom: 1px solid var(--border); vertical-align: top; }
.detail-table th { width: 180px; font-weight: 600; color: var(--text-light); font-size: .88rem; background: var(--bg); }

/* ---- Footer -------------------------------------------- */
.site-footer {
    text-align: center;
    font-size: .82rem;
    color: var(--muted);
    padding: 24px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* ---- Misc ---------------------------------------------- */
.muted { color: var(--muted); }
.required { color: var(--danger); }
.optional { color: var(--muted); font-size: .85rem; }

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-light);
}

.card-footer-nav { margin-top: 12px; }

/* ---- Enquiry sidebar card body padding ----------------- */
.enquiry-sidebar .card form,
.enquiry-sidebar .card .card-body {
    padding: 16px 18px;
}

.embed-snippet {
    margin-top: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
}

.embed-snippet h3 { margin-bottom: 12px; }

.api-key-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.api-key { font-size: .82rem; color: var(--text-light); }

/* ---- Responsive ---------------------------------------- */
@media (max-width: 768px) {
    .two-col-layout,
    .enquiry-layout { grid-template-columns: 1fr; }
    .navbar-menu { display: none; }
    .main-content { padding: 16px; }
}
