/* =====================================================================
   TapSauce Street Distribution Tracker — styles
   Mobile-first, with explicit tablet / desktop / large-desktop tuning.
   ===================================================================== */

:root {
    --ts-accent: #BE1A21;     /* brand red, sampled from logo */
    --ts-accent-dark: #98141A;
    --ts-accent-light: #f6dcdd;
    --ts-green: #A6CE39;      /* brand leaf green, sampled from logo */
    --ts-green-dark: #4A5C19;
    --ts-cream: #fbf6ee;
    --ts-text: #2b2622;
    --ts-radius: 12px;
    --ts-radius-sm: 8px;
    --ts-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    --ts-shadow-md: 0 6px 24px rgba(0, 0, 0, 0.10);
    --ts-border: #e9e2d8;
}

* { -webkit-tap-highlight-color: transparent; }

html, body { scroll-behavior: smooth; }

body {
    background-color: var(--ts-cream);
    color: var(--ts-text);
    padding-bottom: 78px;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a { transition: color .15s ease; }

/* ---------------------------------------------------------------
   Layout / container — give large monitors a bit more breathing room
   --------------------------------------------------------------- */
@media (min-width: 1400px) {
    .container { max-width: 1240px; }
}
@media (min-width: 1700px) {
    .container { max-width: 1380px; }
}

.page-head-row { gap: .75rem; }
.page-head-row h4 { font-weight: 700; }

/* ---------------------------------------------------------------
   Navbar
   --------------------------------------------------------------- */
.navbar-ts {
    background-color: #fff;
    border-bottom: 3px solid var(--ts-accent);
    padding-top: .6rem;
    padding-bottom: .6rem;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}
.navbar-ts .navbar-brand { padding: 0; margin-right: 1.5rem; }
.navbar-ts .navbar-brand img { height: 40px; display: block; }
.navbar-ts .nav-link {
    color: var(--ts-accent-dark) !important;
    font-weight: 600;
    padding: .5rem .9rem !important;
    border-radius: var(--ts-radius-sm);
}
.navbar-ts .nav-link:hover { background-color: var(--ts-accent-light); }
.navbar-ts .nav-link.active { font-weight: 700; background-color: var(--ts-accent-light); }
.navbar-ts .nav-link-logout { color: #8a7f72 !important; font-size: 1.05rem; }
.navbar-ts .nav-link-logout:hover { color: var(--ts-accent) !important; background-color: transparent; }
.navbar-user-pill {
    background-color: var(--ts-cream);
    border: 1px solid var(--ts-border);
    border-radius: 999px;
    padding: .35rem .9rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--ts-text);
    margin-left: .5rem;
    white-space: nowrap;
}

@media (min-width: 1400px) {
    .navbar-ts .navbar-brand img { height: 46px; }
}

/* ---------------------------------------------------------------
   Cards
   --------------------------------------------------------------- */
.card {
    border: 1px solid var(--ts-border);
    border-radius: var(--ts-radius);
    box-shadow: var(--ts-shadow);
}
.card-header { border-radius: var(--ts-radius) var(--ts-radius) 0 0 !important; font-weight: 600; }
.card-body.p-0 .table { margin-bottom: 0; }

.card-stat {
    border-left: 4px solid var(--ts-accent);
    transition: transform .15s ease, box-shadow .15s ease;
}
.card-stat:hover { box-shadow: var(--ts-shadow-md); }
.card-stat .card-body { padding: 1rem .5rem; }
.card-stat-icon {
    width: 38px; height: 38px;
    border-radius: 50%;
    background-color: var(--ts-accent-light);
    color: var(--ts-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    margin: 0 auto .5rem;
}
.card-stat .h3 { font-weight: 700; }

@media (max-width: 400px) {
    .card-stat-icon { width: 32px; height: 32px; font-size: .85rem; margin-bottom: .35rem; }
    .card-stat .text-muted.small { font-size: .68rem; line-height: 1.1; }
    .card-stat .h3 { font-size: 1.3rem; }
    .card-stat .card-body { padding: .75rem .25rem; }
}

@media (min-width: 1400px) {
    .card-stat .card-body { padding: 1.5rem 1rem; }
    .card-stat-icon { width: 46px; height: 46px; font-size: 1.2rem; }
}

/* ---------------------------------------------------------------
   Buttons
   --------------------------------------------------------------- */
.btn { border-radius: var(--ts-radius-sm); font-weight: 600; }
.btn-lg { border-radius: var(--ts-radius); }
.btn-ts { background-color: var(--ts-accent); border-color: var(--ts-accent); color: #fff; }
.btn-ts:hover, .btn-ts:focus { background-color: var(--ts-accent-dark); border-color: var(--ts-accent-dark); color: #fff; }
.btn-ts:focus { box-shadow: 0 0 0 3px var(--ts-accent-light); }

/* Touch-friendly minimum tap target on small screens */
@media (max-width: 767px) {
    .btn { min-height: 40px; }
    .btn-lg { min-height: 50px; }
    .btn-sm { min-height: 34px; }
}

.btn-group.btn-block .btn.active {
    background-color: var(--ts-accent);
    color: #fff;
    border-color: var(--ts-accent);
}

/* ---------------------------------------------------------------
   Forms
   --------------------------------------------------------------- */
label { font-weight: 600; font-size: .88rem; color: #5b5248; }
.form-control {
    border-radius: var(--ts-radius-sm);
    border-color: var(--ts-border);
}
.form-control:focus {
    border-color: var(--ts-accent);
    box-shadow: 0 0 0 3px var(--ts-accent-light);
}
.form-control-lg, .input-group-lg .form-control { border-radius: var(--ts-radius); }
.input-group-text { background-color: #fff; border-color: var(--ts-border); color: var(--ts-accent); }

@media (max-width: 767px) {
    .form-control { min-height: 42px; }
}

/* ---------------------------------------------------------------
   Tables
   --------------------------------------------------------------- */
.table thead th {
    border-top: none;
    border-bottom: 2px solid var(--ts-border);
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #8a7f72;
    font-weight: 700;
    white-space: nowrap;
}
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background-color: var(--ts-accent-light); }
.table-responsive { border-radius: 0 0 var(--ts-radius) var(--ts-radius); }

@media (max-width: 767px) {
    .table td, .table th { padding: .55rem .6rem; font-size: .85rem; }
}

/* ---------------------------------------------------------------
   Badges
   --------------------------------------------------------------- */
.badge { font-weight: 600; border-radius: 6px; padding: .35em .6em; }
.badge-tier1 { background-color: var(--ts-green-dark); color: #fff; }
.badge-tier2 { background-color: #2a5d8a; color: #fff; }
.badge-tier3 { background-color: #7a4ea8; color: #fff; }

/* ---------------------------------------------------------------
   Alerts
   --------------------------------------------------------------- */
.alert { border-radius: var(--ts-radius); border: none; }
.alert-danger { background-color: #fbe4e3; color: #7a2024; }
.alert-success { background-color: #e8f1d3; color: #3e4d16; }
.alert-warning { background-color: #fdf1d9; color: #7a5a14; }

/* ---------------------------------------------------------------
   Modals — near-full-width "sheet" feel on phones, centered on desktop
   --------------------------------------------------------------- */
.modal-content { border-radius: var(--ts-radius); border: none; box-shadow: var(--ts-shadow-md); }
.modal-header, .modal-footer { border-color: var(--ts-border); }

@media (max-width: 575px) {
    .modal-dialog { margin: .75rem; }
    .modal-body { max-height: 70vh; overflow-y: auto; }
}

/* ---------------------------------------------------------------
   Bottom nav for mobile
   --------------------------------------------------------------- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--ts-border);
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.06);
    display: none;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav a {
    flex: 1;
    text-align: center;
    padding: 9px 0 7px;
    color: #8a7f72;
    font-size: .72rem;
    font-weight: 600;
    transition: color .15s ease;
}
.bottom-nav a.active { color: var(--ts-accent); }
.bottom-nav a.active i { transform: translateY(-1px); }
.bottom-nav i { display: block; font-size: 1.25rem; margin-bottom: 3px; }

@media (max-width: 767px) {
    .bottom-nav { display: flex; }
    .navbar-desktop-links { display: none !important; }
}

/* ---------------------------------------------------------------
   Auth pages (login chooser / agent login / admin login)
   --------------------------------------------------------------- */
body.auth-bg {
    background: linear-gradient(160deg, var(--ts-cream) 0%, #fdeeea 45%, #eef4dc 100%);
    min-height: 100vh;
    padding-bottom: 0;
}

.auth-shell {
    min-height: calc(100vh - 30px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: var(--ts-shadow-md);
    padding: 2.25rem 1.75rem;
    width: 100%;
    max-width: 420px;
    animation: ts-fade-up .35s ease;
}
.auth-card-wide { max-width: 560px; }

.auth-logo { height: 52px; margin-bottom: 1rem; }
.auth-icon-badge {
    width: 56px; height: 56px;
    border-radius: 50%;
    background-color: var(--ts-accent-light);
    color: var(--ts-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    margin: 0 auto .9rem;
}
.auth-icon-badge-admin { background-color: #e3eaf2; color: #2a5d8a; }

.auth-title { font-size: 1.4rem; font-weight: 700; margin-bottom: .3rem; }
.auth-subtitle { color: #8a7f72; font-size: .9rem; margin-bottom: 1.5rem; }
.auth-switch { margin-top: 1.25rem; margin-bottom: 0; font-size: .88rem; }
.auth-switch a { color: #8a7f72; font-weight: 600; }
.auth-switch a:hover { color: var(--ts-accent); }

.auth-choice-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}
@media (min-width: 480px) {
    .auth-choice-grid { grid-template-columns: 1fr 1fr; }
}
.auth-choice-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    border: 1px solid var(--ts-border);
    border-radius: var(--ts-radius);
    text-decoration: none;
    color: var(--ts-text);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.auth-choice-tile:hover {
    border-color: var(--ts-accent);
    box-shadow: var(--ts-shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--ts-text);
}
.auth-choice-icon {
    width: 52px; height: 52px;
    border-radius: 50%;
    background-color: var(--ts-accent-light);
    color: var(--ts-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    margin-bottom: .8rem;
}
.auth-choice-label { font-weight: 700; margin-bottom: .25rem; }
.auth-choice-sub { font-size: .78rem; color: #8a7f72; text-align: center; }

@keyframes ts-fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 1400px) {
    .auth-card { padding: 2.75rem 2.25rem; }
}

/* ---------------------------------------------------------------
   Vendor map (vendor_map.php)
   --------------------------------------------------------------- */
.vendor-map {
    height: 60vh;
    min-height: 360px;
    border-radius: var(--ts-radius);
    z-index: 0;
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-size: .85rem;
    margin-bottom: .65rem;
}
.map-legend-item:last-of-type { margin-bottom: 0; }
.map-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--ts-border);
    flex-shrink: 0;
}

.vendor-map-popup { font-size: .85rem; line-height: 1.45; }
.leaflet-popup-content-wrapper { border-radius: var(--ts-radius-sm); }

@media (max-width: 991px) {
    .vendor-map { height: 50vh; min-height: 300px; }
}
