/*
File: public/assets/app.css

Purpose:
- Styles the public PWA, installer, authentication, and dense staff workspace.

Files required by this file:
- None.

Main known callers:
- index.php
- setup.php
- admin/login.php
- admin/index.php

Function index:
- None.
*/

:root {
    --navy: #173b57;
    --navy-dark: #102b40;
    --blue-soft: #e8f0f4;
    --gold: #f4b942;
    --cream: #f4f1e9;
    --paper: #ffffff;
    --ink: #19252e;
    --muted: #66747e;
    --line: #d7dee2;
    --green: #21855b;
    --red: #b43c3c;
    --shadow: 0 12px 35px rgba(16, 43, 64, .1);
    --radius: 14px;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--cream);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--cream); }
.public-page { overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
a { color: var(--navy); }
h1, h2, h3, p { margin-top: 0; }
button, a { touch-action: manipulation; }

.button {
    display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: .65rem 1rem;
    border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--navy);
    font-weight: 700; text-decoration: none; cursor: pointer;
}
.button:hover { border-color: var(--navy); }
.button.primary { border-color: var(--navy); background: var(--navy); color: white; }
.button.primary:hover { background: var(--navy-dark); }
.button.large { min-height: 50px; padding-inline: 1.4rem; }
.button.small { min-height: 35px; padding: .4rem .7rem; font-size: .88rem; }
.button.full { width: 100%; }
.button.whatsapp { background: #178c54; color: white; border-color: #178c54; }
.button-row, .row-actions { display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; }
.text-button { padding: 0; border: 0; color: var(--navy); background: transparent; cursor: pointer; text-decoration: underline; }
.text-button.danger { color: var(--red); }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 9px; background: white; cursor: pointer; font-size: 1.3rem; }
.muted { color: var(--muted); }
.notice { margin-bottom: 1rem; padding: .85rem 1rem; border-radius: 9px; border: 1px solid; }
.notice.success { color: #145d40; background: #e9f7f0; border-color: #9ed4ba; }
.notice.error { color: #812b2b; background: #fff0f0; border-color: #e5adad; }
.brand-mark { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--navy); color: var(--gold); font-weight: 900; letter-spacing: -.05em; }
.brand-mark.small { width: 40px; height: 40px; border-radius: 11px; flex: 0 0 auto; }

/* Authentication and setup */
.auth-page { display: grid; place-items: center; padding: 2rem 1rem; background: radial-gradient(circle at 20% 10%, #fff 0, transparent 35%), var(--cream); }
.auth-card { width: min(100%, 440px); padding: 2rem; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.auth-card .brand-mark { margin-bottom: 1.4rem; }
.auth-card h1 { margin-bottom: .35rem; }
.text-link { display: block; margin-top: 1.25rem; text-align: center; }
.stack-form { display: grid; gap: 1rem; }
.stack-form label, .form-grid label, .filter-drawer label { display: grid; gap: .35rem; font-size: .86rem; font-weight: 700; color: #344650; }
input, select, textarea { width: 100%; min-height: 42px; padding: .62rem .7rem; border: 1px solid #bac6cc; border-radius: 8px; background: white; color: var(--ink); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(244, 185, 66, .35); border-color: var(--navy); }

/* Public website */
.public-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: .45rem max(1rem, calc((100vw - 1440px) / 2)); background: rgba(244, 241, 233, .96); border-bottom: 1px solid rgba(23, 59, 87, .12); backdrop-filter: blur(10px); }
.public-brand { display: flex; align-items: center; gap: .75rem; color: var(--ink); text-decoration: none; }
.public-brand span:last-child { display: grid; }
.public-brand small { color: var(--muted); }
.public-header nav { display: flex; gap: 1.2rem; }
.public-header nav a { text-decoration: none; font-weight: 700; }
.hero { display: grid; grid-template-columns: 1fr 170px; gap: 1.5rem; align-items: center; max-width: 1440px; margin: 0 auto; padding: 1.15rem 1rem; }
.hero h1 { max-width: 800px; margin: .25rem 0 .35rem; font-family: Georgia, serif; font-size: clamp(1.55rem, 3vw, 2.5rem); line-height: 1.05; letter-spacing: -.035em; color: var(--navy); }
.hero h1 em { color: #a86e12; font-weight: 400; }
.hero p { max-width: 760px; margin-bottom: .65rem; font-size: .92rem; line-height: 1.45; color: var(--muted); }
.eyebrow { color: #94600d; font-size: .78rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.hero .button.large { min-height: 38px; padding: .45rem .9rem; font-size: .86rem; }
.hero-stat { padding: .75rem 1rem; border-left: 3px solid var(--gold); background: rgba(255,255,255,.7); }
.hero-stat strong { display: block; font-family: Georgia, serif; font-size: 2rem; line-height: 1; color: var(--navy); }
.hero-stat span { color: var(--muted); font-size: .72rem; }
.catalogue { max-width: 1440px; margin: 0 auto; padding: .75rem 1rem 3rem; }
.catalogue-results { min-width: 0; }
.storefront-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 54px; margin-bottom: .7rem; padding: .35rem 0; }
.storefront-toolbar h1 { margin: 0; color: var(--navy); font-family: Georgia, serif; font-size: 1.55rem; }
.result-summary { color: var(--muted); font-size: .8rem; }
.storefront-actions { display: flex; align-items: center; gap: .75rem; }
.clear-filter-link { font-size: .82rem; font-weight: 700; }
.filter-button { gap: .45rem; min-width: 112px; border-color: var(--navy); background: var(--navy); color: white; }
.filter-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 .3rem; border-radius: 999px; background: var(--gold); color: var(--navy-dark); font-size: .74rem; }
.filter-backdrop { position: fixed; inset: 0; z-index: 49; background: rgba(7, 24, 35, .55); opacity: 0; transition: opacity .2s ease; }
.filter-drawer { position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(370px, 92vw); background: white; box-shadow: 18px 0 50px rgba(7,24,35,.22); transform: translateX(-105%); transition: transform .24s ease; }
.filter-drawer form { display: flex; flex-direction: column; height: 100%; }
.filter-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; border-bottom: 1px solid var(--line); }
.filter-heading h2 { margin: .15rem 0 0; font-size: 1.2rem; }
.filter-fields { display: grid; gap: .9rem; overflow-y: auto; padding: 1rem; }
.filter-drawer fieldset { padding: 0; border: 0; }
.filter-drawer legend { margin-bottom: .4rem; font-size: .86rem; font-weight: 700; }
.filter-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: .6rem; margin-top: auto; padding: .85rem 1rem; border-top: 1px solid var(--line); background: white; }
.public-page.filter-drawer-open { overflow: hidden; }
.public-page.filter-drawer-open .filter-backdrop { opacity: 1; }
.public-page.filter-drawer-open .filter-drawer { transform: translateX(0); }
.range-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.results-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: .65rem; }
.results-heading h2 { margin: .1rem 0 0; font-family: Georgia, serif; font-size: 1.55rem; color: var(--navy); }
.result-count { padding: .45rem .75rem; border: 1px solid #c8d4da; border-radius: 999px; background: white; color: var(--muted); font-size: .86rem; }
.result-count strong { color: var(--navy); }
.tender-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: .75rem; align-items: stretch; }
.tender-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 25px rgba(16,43,64,.06); transition: transform .18s ease, box-shadow .18s ease; }
.tender-card:hover { transform: translateY(-4px); box-shadow: 0 16px 35px rgba(16,43,64,.13); }
.product-card-media { position: relative; display: flex; align-items: center; justify-content: center; min-height: 82px; padding: .7rem; overflow: hidden; color: white; }
.product-card-media::after { content: ""; position: absolute; width: 180px; height: 180px; right: -60px; bottom: -110px; border: 28px solid rgba(255,255,255,.13); border-radius: 50%; }
.product-card-media.blue { background: linear-gradient(135deg, #1c5d8c, #173b57); }
.product-card-media.amber { background: linear-gradient(135deg, #c47a13, #7d4707); }
.product-card-media.green { background: linear-gradient(135deg, #258460, #14523c); }
.product-card-media.violet { background: linear-gradient(135deg, #7356a4, #44306d); }
.product-card-media.rose { background: linear-gradient(135deg, #af5269, #713345); }
.product-card-media.teal { background: linear-gradient(135deg, #16848a, #0a5258); }
.product-symbol { font-family: Georgia, serif; font-size: 2.35rem; font-weight: 900; letter-spacing: -.12em; opacity: .3; transform: translateX(-.08em); }
.product-category, .closing-badge { position: absolute; z-index: 1; padding: .32rem .58rem; border-radius: 999px; background: rgba(255,255,255,.92); color: var(--navy-dark); font-size: .7rem; font-weight: 900; }
.product-category { left: .8rem; top: .8rem; }
.closing-badge { right: .8rem; bottom: .8rem; }
.product-card-body { flex: 1; padding: .75rem; }
.product-reference { display: block; margin-bottom: .45rem; color: #7a8790; font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.tender-card h3 { min-height: 3.3em; margin-bottom: .4rem; font-family: Georgia, serif; font-size: 1.02rem; line-height: 1.18; color: var(--navy); }
.product-authority { min-height: 2.4em; margin-bottom: .55rem; color: var(--muted); font-size: .76rem; line-height: 1.25; }
.product-facts { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; padding: .75rem 0; border-block: 1px solid #e4e9ec; }
.product-facts span { display: grid; gap: .15rem; min-width: 0; }
.product-facts small, .product-price small { color: var(--muted); font-size: .67rem; text-transform: uppercase; }
.product-facts strong { overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.product-value-row { display: flex; justify-content: space-between; gap: .6rem; padding-top: .75rem; color: var(--muted); font-size: .72rem; }
.product-value-row span { display: grid; gap: .15rem; }
.product-value-row strong { color: var(--ink); font-size: .78rem; }
.product-card-footer { padding: .65rem .75rem .75rem; background: #f7f9fa; border-top: 1px solid #e2e8eb; }
.product-price { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.product-price strong { color: var(--navy); font-size: 1.2rem; }
.tender-card-actions { display: flex; gap: .65rem; align-items: center; }
.tender-card-actions .button { flex: 1; }
.product-card .tender-card-actions .button { min-height: 42px; background: #e59b18; border-color: #d58b0c; color: #172b3a; font-weight: 900; }
.product-card .tender-card-actions .button:hover { background: #f4b942; border-color: #b87306; }
.whatsapp-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; border-radius: 50%; background: #178c54; color: white; font-size: .72rem; font-weight: 900; text-decoration: none; }
.empty-state { padding: 4rem 2rem; text-align: center; background: white; border: 1px dashed #aebbc2; border-radius: var(--radius); }
.payment-success { display: grid; grid-template-columns: 1fr minmax(240px, 360px); gap: 2rem; max-width: 1100px; margin: 0 auto 3rem; padding: 2rem; border-radius: 20px; background: var(--navy); color: white; box-shadow: var(--shadow); }
.payment-success h2 { margin: .35rem 0 1rem; font-family: Georgia, serif; font-size: 2.6rem; }
.payment-success .eyebrow { color: var(--gold); }
.amount-due { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; margin: 1rem 0; border-block: 1px solid rgba(255,255,255,.2); }
.amount-due strong { font-size: 1.6rem; color: var(--gold); }
.qr-card { padding: .75rem; border-radius: 14px; background: white; color: var(--ink); text-align: center; }
.qr-card img { display: block; width: 100%; max-height: 420px; object-fit: contain; border-radius: 10px; }
.qr-card span { display: block; padding-top: .6rem; font-weight: 700; }
.enquiry-dialog { width: min(92vw, 680px); max-height: 90vh; padding: 0; border: 0; border-radius: 18px; box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.enquiry-dialog::backdrop { background: rgba(8,24,35,.72); backdrop-filter: blur(3px); }
.enquiry-dialog form { padding: 1.5rem; }
.dialog-heading { display: flex; justify-content: space-between; gap: 1rem; }
.dialog-heading h2 { margin: .3rem 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.fine-print { color: var(--muted); font-size: .85rem; line-height: 1.5; }
.public-footer { display: flex; justify-content: space-between; gap: 2rem; padding: 3rem max(1rem, calc((100vw - 1440px) / 2)); background: var(--navy-dark); color: white; }
.public-footer div { display: grid; gap: .4rem; }
.public-footer a { color: var(--gold); }

/* Staff workspace */
.admin-page { background: #eef1f3; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: 245px; overflow-y: auto; padding: 1rem; background: var(--navy-dark); color: white; transition: transform .2s ease; }
.sidebar-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.2rem; font-size: 1.1rem; font-weight: 800; }
.menu-group { margin-bottom: .6rem; }
.menu-group summary { padding: .55rem .4rem; color: #a9bcc9; font-size: .75rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.menu-group a, .public-link { display: block; padding: .6rem .75rem; border-radius: 7px; color: #eaf1f5; text-decoration: none; font-size: .9rem; }
.menu-group a:hover, .menu-group a.active { background: rgba(255,255,255,.12); color: white; }
.public-link { margin-top: 1.5rem; border: 1px solid rgba(255,255,255,.2); }
.admin-shell { min-height: 100vh; margin-left: 245px; }
.topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; min-height: 62px; padding: .65rem 1.4rem; background: rgba(255,255,255,.95); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.user-menu { display: flex; align-items: center; gap: 1rem; }
.admin-content { padding: 1.4rem; }
.page-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-heading h1 { margin-bottom: .2rem; font-size: 1.7rem; }
.page-heading p { margin-bottom: 0; color: var(--muted); }
.panel { background: white; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 14px rgba(16,43,64,.04); }
.action-panel { margin-bottom: 1rem; }
.action-panel summary { padding: .8rem 1rem; cursor: pointer; font-weight: 700; }
.action-panel-content { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0 1rem 1rem; }
.checkbox { display: flex; align-items: center; gap: .45rem; }
.checkbox input { width: auto; min-height: auto; }
.inline-form { display: flex; gap: .5rem; align-items: center; }
.inline-form input[type="file"] { max-width: 220px; min-height: 35px; padding: .35rem; }
.saved-chips { display: flex; gap: .4rem; }
.chip { padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--muted); }
.chip.active { background: var(--blue-soft); border-color: #9eb9c8; color: var(--navy); }
.table-panel { overflow: hidden; }
.table-toolbar { padding: .75rem; border-bottom: 1px solid var(--line); }
.table-search { max-width: 340px; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.data-table th, .data-table td { padding: .65rem .7rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { background: #e8edf0; white-space: nowrap; }
.data-table th[data-sort] { cursor: pointer; }
.data-table tbody tr:nth-child(even) { background: #f8fafb; }
.data-table input[type="checkbox"] { width: 16px; min-height: 16px; }
.row-actions { white-space: nowrap; font-size: .82rem; }
.row-actions form { display: inline; }
.status { display: inline-block; padding: .2rem .48rem; border-radius: 999px; font-size: .74rem; font-weight: 800; }
.status.active { color: #176343; background: #dcf3e7; }
.status.deleted { color: #843333; background: #fae0e0; }
.pagination { display: flex; gap: .35rem; padding: .75rem; justify-content: flex-end; }
.pagination button { min-width: 34px; min-height: 34px; border: 1px solid var(--line); border-radius: 6px; background: white; cursor: pointer; }
.pagination button.active { color: white; background: var(--navy); }
.record-form { padding: 1.2rem; }
.form-section h2 { padding-bottom: .65rem; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
.form-actions { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.detail-card { padding: 1.2rem; margin-bottom: 1rem; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; margin: 0; }
.detail-grid div { min-width: 0; }
.detail-grid dt { color: var(--muted); font-size: .77rem; font-weight: 800; text-transform: uppercase; }
.detail-grid dd { margin: .3rem 0 0; line-height: 1.45; overflow-wrap: anywhere; }
.related-list { margin-top: 1rem; padding: 1rem; }
.related-list h2 { font-size: 1rem; }
.count-badge { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 999px; background: var(--blue-soft); font-size: .75rem; }
.mobile-only { display: none; }

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; }
    .hero-stat { display: none; }
    .payment-success { grid-template-columns: 1fr; margin-inline: 1rem; }
    .tender-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .admin-shell { margin-left: 0; }
    .mobile-only { display: inline-grid; place-items: center; }
    .desktop-only { display: none; }
    .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    .public-header nav { display: none; }
    .hero { padding-block: 1rem; }
    .hero h1 { font-size: 1.75rem; }
    .catalogue { width: 100%; max-width: 100%; padding-inline: .75rem; overflow: hidden; }
    .catalogue-results, .tender-grid, .tender-card { width: 100%; max-width: 100%; min-width: 0; }
    .storefront-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; min-height: 54px; }
    .storefront-toolbar > div:first-child { min-width: 0; }
    .storefront-toolbar h1 { font-size: 1.3rem; }
    .storefront-actions { position: static; }
    .clear-filter-link { display: none; }
    .filter-button { min-width: 108px; border-color: var(--gold); background: var(--navy); box-shadow: 0 5px 16px rgba(7,24,35,.2); }
    .filter-drawer { inset: auto 0 0 0; width: 100%; max-height: 88vh; border-radius: 18px 18px 0 0; transform: translateY(105%); }
    .filter-drawer form { max-height: 88vh; }
    .public-page.filter-drawer-open .filter-drawer { transform: translateY(0); }
    .tender-grid { grid-template-columns: 1fr; }
    .tender-card h3 { overflow-wrap: anywhere; }
    .product-authority { min-height: 0; }
    .product-value-row { flex-wrap: wrap; }
    .tender-card-actions { display: grid; grid-template-columns: minmax(0, 1fr) 42px; }
    .form-grid, .detail-grid { grid-template-columns: 1fr; }
    .public-footer { flex-direction: column; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .user-menu span { display: none; }
    .admin-content { padding: .8rem; }
    .tender-card-actions .button { flex: 1; }
}

