/* === Reset === */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section { display: block; }
ol, ul { list-style: none; }

/* === Base — Apple-inspired light glassy === */
html, body {
    background: linear-gradient(135deg, #f5f5f7 0%, #e8eef5 60%, #eaf0f8 100%);
    background-attachment: fixed;
    color: #1d1d1f;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-size: 15px;
    line-height: 1.55;
    margin: 0;
    padding: 40px 48px 80px;
    width: auto;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Typography Hierarchy === */
.page-title {
    font-size: 2.6em !important;
    font-weight: 700 !important;
    color: #1d1d1f !important;
    letter-spacing: -0.025em;
    margin: 0 0 36px !important;
    padding: 0;
    text-transform: none;
    line-height: 1.15;
}
h1 {
    font-size: 1.35em;
    font-weight: 600;
    color: #1d1d1f;
    letter-spacing: -0.01em;
    margin: 36px 0 18px;
}
h2 {
    font-size: 1.05em;
    font-weight: 600;
    color: #1d1d1f;
    margin: 24px 0 12px;
}

/* === Links === */
a { color: #0071e3; text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Inputs === */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="date"],
input[type="tel"],
input[type="url"],
select,
textarea {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #d2d2d7;
    color: #1d1d1f;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}
input:focus,
select:focus,
textarea:focus {
    border-color: #0071e3;
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
    background: #ffffff;
}
input::placeholder, textarea::placeholder { color: #86868b; }
input[type="checkbox"], input[type="radio"] {
    accent-color: #0071e3;
    margin-right: 6px;
    transform: scale(1.05);
}

/* Datepicker inputs — fixed width so date ranges sit side-by-side (legacy fallback) */
input.hasDatepicker {
    display: inline-block;
}

/* === Date-range pair: two date inputs side-by-side with calendar icon === */
.date-range {
    display: flex;
    gap: 12px;
    margin: 12px 0;
}
.date-range input {
    flex: 1 1 0;
    min-width: 0;
    background: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") rgba(255, 255, 255, 0.92) no-repeat right 12px center;
    background-size: 16px 16px;
    padding-right: 36px !important;
    margin: 0 !important;
    width: auto !important;
}
.date-range input:focus {
    background-color: #ffffff;
}

/* === Buttons === */
input[type="button"],
input[type="submit"],
button {
    font-size: 14px;
    background: #0071e3;
    color: #ffffff;
    border: none;
    padding: 11px 22px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 1px 2px rgba(0, 113, 227, 0.18);
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    margin-top: 8px;
}
input[type="button"]:hover,
input[type="submit"]:hover,
button:hover {
    background: #0077ed;
    box-shadow: 0 4px 14px rgba(0, 113, 227, 0.28);
    transform: translateY(-1px);
}
input[type="button"]:active,
input[type="submit"]:active,
button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 113, 227, 0.18);
}

/* === Labels === */
label {
    display: inline-block;
    color: #5e5e63;
    font-size: 13px;
    font-weight: 500;
    margin-right: 10px;
    margin-bottom: 4px;
}

/* === Forms — generous spacing === */
form {
    margin: 24px 0;
    padding: 0;
    background: transparent;
}
form p { margin: 20px 0; }

/* Vertical breathing room after each block-level field
   (datepickers excluded — they pair side-by-side via inline-block) */
form input[type="text"]:not(.hasDatepicker),
form input[type="number"],
form input[type="email"],
form input[type="password"],
form input[type="search"],
form input[type="tel"],
form input[type="url"],
form select,
form textarea {
    margin-bottom: 12px;
}

/* Extra breathing room before action buttons */
form input[type="submit"],
form input[type="button"] {
    margin-top: 24px;
}

/* Inline labels next to fields shouldn't push margin */
form label {
    margin-bottom: 0;
    line-height: 2.4;
}

/* === Tables === */
table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
    margin: 24px 0;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
th {
    background: #f5f5f7;
    color: #1d1d1f;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0, 113, 227, 0.03); }

/* === Report cards — subtle shaded boxes wrapping each h1 + its form === */
.report-card {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 14px;
    padding: 28px 32px 0;            /* no bottom padding; the action button fills the bottom */
    margin: 0;
    max-width: 500px;
    overflow: hidden;                 /* clip button bottom corners to follow card radius */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.report-card h1 {
    margin: 0 0 20px;
    font-size: 1.25em;
    font-weight: 600;
    color: #1d1d1f;
}

/* Generate CSV (or any final action button) — full-width, flush to card bottom */
.report-card input[type="button"]:last-of-type,
.report-card input[type="submit"]:last-of-type {
    display: block !important;
    width: calc(100% + 64px) !important;     /* extend past horizontal padding */
    margin: 28px -32px 0 -32px !important;
    padding: 15px !important;
    font-size: 14px !important;
    border-radius: 0 !important;             /* card's border-radius + overflow:hidden clips this */
    box-sizing: border-box !important;
    box-shadow: none !important;
    transform: none !important;
    letter-spacing: 0.01em;
}
.report-card input[type="button"]:last-of-type:hover,
.report-card input[type="submit"]:last-of-type:hover {
    transform: none !important;
    box-shadow: none !important;
    background: #0077ed !important;
}

/* Trailing <br> after the action button shouldn't add space below the card */
.report-card input[type="button"]:last-of-type ~ br,
.report-card input[type="submit"]:last-of-type ~ br {
    display: none;
}

/* Tighten the very last form row's bottom margin (the row right before the button) */
.report-card > br + br { display: none; }

/* === MAIN tab — explicit two-column flex with .left-col / .right-col === */
.tab_page.visible:has(> .col) {
    display: flex !important;
    gap: 100px !important;
    align-items: flex-start !important;
    max-width: 1200px !important;
}
.tab_page.visible > .col {
    flex: 1 1 500px;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.tab_page.visible > .col > .report-card {
    margin-bottom: 0;
}

/* SALES FILTERS / GPM tabs — single column, full-width cards */
.tab_page.visible:not(:has(> .col)) {
    display: block !important;
    max-width: 1200px !important;
}
.tab_page.visible:not(:has(> .col)) .report-card {
    max-width: none !important;
    margin-bottom: 28px;
}

/* Cards stay tightly packed in their column */
.report-card {
    break-inside: avoid !important;
}

/* === Override reports.php inline styles (.tab_page, #nav, fieldset) === */
.tab_page {
    background: rgba(255, 255, 255, 0.72) !important;
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    width: auto !important;
    max-width: 1400px !important;
    padding: 44px !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    border-radius: 18px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    height: auto !important;
    color: #1d1d1f !important;
}

#nav { margin-bottom: 0; }
#nav button {
    background: rgba(255, 255, 255, 0.55) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    border-bottom: none !important;
    color: #5e5e63 !important;
    font-size: 14px !important;
    padding: 10px 22px !important;
    cursor: pointer;
    border-radius: 12px 12px 0 0 !important;
    box-shadow: none !important;
    font-weight: 500;
    margin-right: 4px;
    margin-top: 0;
    transition: background 0.15s, color 0.15s;
}
#nav button:hover {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #1d1d1f !important;
    text-decoration: none !important;
    transform: none;
    box-shadow: none !important;
}
#nav button.active_tab,
.active_tab {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #1d1d1f !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    text-decoration: none !important;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.04) !important;
    font-weight: 600 !important;
}

fieldset {
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    padding: 20px 24px !important;
    border-radius: 12px;
    margin: 18px 0;
    background: rgba(255, 255, 255, 0.45);
}
fieldset legend {
    display: block !important;
    width: auto !important;
    padding: 0 10px !important;
    font-weight: 600 !important;
    color: #1d1d1f !important;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
fieldset label { margin-right: 18px; color: #1d1d1f; }

#message {
    color: #5e5e63 !important;
    font-style: italic;
    font-size: 13px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem 1rem;
}

/* === Lobster report table === */
.lobster-table {
    background: white;
    border-collapse: collapse;
    width: 100%;
    max-width: 880px;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    margin: 0;
}
.lobster-table th, .lobster-table td {
    padding: 16px;
    border-bottom: 1px solid #d2d2d7;
    border-right: 1px solid #d2d2d7;
    vertical-align: middle;
    text-align: left;
    line-height: 1.5;
}
.lobster-table th:last-child, .lobster-table td:last-child { border-right: none; }
.lobster-table tr:last-child td { border-bottom: none; }
.lobster-table th {
    background: #f5f5f7;
    font-weight: 700;
    font-size: 1.15em;
    text-align: right;
}
.lobster-table th:first-child { width: 70%; background: white; }
.lobster-row-green td {
    background: #5fa85d !important;
    color: white !important;
    font-weight: 500;
}
.lobster-row-green td strong { color: white; }

/* === jQuery UI datepicker — light theme === */
.ui-datepicker {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #1d1d1f !important;
    border-radius: 14px !important;
    padding: 12px !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12) !important;
    font-family: inherit !important;
}
.ui-datepicker .ui-datepicker-header {
    background: transparent !important;
    border: none !important;
    color: #1d1d1f !important;
    padding: 4px 0 !important;
}
.ui-datepicker .ui-datepicker-title { color: #1d1d1f !important; font-weight: 600; }
.ui-datepicker th { background: transparent !important; color: #86868b !important; font-size: 11px !important; padding: 6px !important; }
.ui-datepicker td { background: transparent !important; padding: 1px !important; }
.ui-datepicker td a,
.ui-datepicker td span {
    background: transparent !important;
    color: #1d1d1f !important;
    border: none !important;
    text-align: center !important;
    padding: 8px !important;
    border-radius: 6px;
}
.ui-datepicker td .ui-state-hover { background: #f5f5f7 !important; }
.ui-datepicker td .ui-state-active,
.ui-datepicker td .ui-state-highlight {
    background: #0071e3 !important;
    color: #ffffff !important;
}
.ui-datepicker .ui-datepicker-prev,
.ui-datepicker .ui-datepicker-next {
    color: #1d1d1f !important;
    cursor: pointer;
    background: transparent !important;
    border: none !important;
    top: 6px !important;
    border-radius: 6px;
}
.ui-datepicker .ui-datepicker-prev:hover,
.ui-datepicker .ui-datepicker-next:hover {
    background: #f5f5f7 !important;
}

/* === Login page (index.php) — glassy card === */
#frmLogin {
    max-width: 380px;
    margin: 100px auto 0;
    padding: 40px;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.08);
}
#frmLogin p { margin: 18px 0; }
#frmLogin label {
    display: block;
    margin-bottom: 8px;
    color: #1d1d1f;
    font-size: 13px;
    font-weight: 500;
    margin-right: 0;
}
#frmLogin input[type="text"],
#frmLogin input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    padding: 13px 16px;
}
#frmLogin input[type="submit"] {
    width: 100%;
    background: #0071e3 !important;
    color: white !important;
    border: none !important;
    padding: 14px !important;
    margin-top: 24px;
    font-size: 15px !important;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 113, 227, 0.2);
}
#frmLogin input[type="submit"]:hover {
    background: #0077ed !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 113, 227, 0.3);
}

/* === Logout link — pill button === */
p a[href="logout.php"] {
    display: inline-block;
    color: #5e5e63;
    font-size: 13px;
    padding: 8px 14px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 999px;
    margin-bottom: 28px;
    background: rgba(255, 255, 255, 0.6);
    transition: all 0.15s;
}
p a[href="logout.php"]:hover {
    color: #1d1d1f;
    background: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    border-color: rgba(0, 0, 0, 0.16);
}
