/* ============================================================
   Design tokens — single source of truth for B2B, 3PL, ADM.
   Edit variables here to retheme all services at once.
   For white-label: inject a <style> block overriding :root vars.
   ============================================================ */
:root {
  --navy:          #111A28;   /* page background */
  --dark-navy:     #0C1420;   /* header, footer, input backgrounds */
  --card-bg:       #1C2A3C;   /* card / container backgrounds */
  --card-hover:    #1F3045;   /* card hover state */
  --card-bg-hover: #1F3045;   /* alias for card-hover */
  --teal:          #21B4A6;   /* primary accent */
  --teal-hover:    #1AA095;   /* hover state for interactive elements */
  --teal-pale:     rgba(33,180,166,0.12);  /* tinted backgrounds */
  --teal-border:   rgba(33,180,166,0.30);  /* tinted borders */
  --heading:       #FFFFFF;   /* all headings */
  --text:          #EDF6F3;   /* body copy */
  --text-muted:    #aaaacc;   /* secondary text, labels, hints */
  --text-light:    #6a7a8e;   /* captions, timestamps */
  --border:        #2a3a4c;   /* borders, dividers */
  --border-light:  #334455;   /* dividers inside cards */
  --border-dark:   #1a2738;   /* subtle row separators */
  --red:           #e74c3c;   /* errors, failures */
  --red-pale:      rgba(231,76,60,0.12);
  --amber:         #d4a800;   /* warnings */
  --amber-pale:    rgba(212,168,0,0.12);
  --green:         #27ae60;   /* success */
  --green-pale:    rgba(39,174,96,0.12);
}

/* General Body Styles */
body {
    font-family: 'Lato', -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--navy);
    color: var(--text);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 100vh;
}

.container {
    width: 80%;
    max-width: 960px;
    margin: 20px auto;
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Headings */
h1, h2, h3 {
    font-family: 'Poppins', 'Lato', sans-serif;
    font-weight: 700;
    color: var(--heading);
    text-align: center;
}

h1 {
    font-size: 2.5em;
    margin-bottom: 0.5em;
}

h2 {
    font-size: 2em;
}

h3 {
    font-size: 1.5em;
}

/* Paragraphs and Links */
p {
    line-height: 1.7;
    text-align: center;
    color: var(--text);
}

a {
    color: var(--teal);
    text-decoration: none;
}

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

/* ── Buttons ──────────────────────────────────────────────── */

/* Primary — filled teal */
.btn,
.btn-primary {
    display: inline-block;
    background-color: var(--teal);
    color: var(--heading);
    padding: 10px 20px;
    border: 2px solid var(--teal);
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Lato', sans-serif;
    font-weight: 700;
    font-size: 1em;
    text-align: center;
    text-decoration: none;
    margin-top: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn:hover,
.btn-primary:hover {
    background-color: var(--teal-hover);
    border-color: var(--teal-hover);
    text-decoration: none;
    color: var(--heading);
}

/* Secondary — outline teal */
.btn-secondary {
    display: inline-block;
    background-color: transparent;
    color: var(--teal);
    padding: 10px 20px;
    border: 2px solid var(--teal);
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Lato', sans-serif;
    font-weight: 700;
    font-size: 1em;
    text-align: center;
    text-decoration: none;
    margin-top: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.btn-secondary:hover {
    background-color: var(--teal);
    border-color: var(--teal);
    color: var(--heading);
    text-decoration: none;
}

/* Scanner Page */
#loadingMessage {
    text-align: center;
    font-style: italic;
    margin-top: 20px;
    color: var(--text);
}

#canvas {
    display: block;
    margin: 20px auto;
    max-width: 100%;
    border-radius: 8px;
}

/* ============================================================
   APP HEADER
   ============================================================ */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--dark-navy);
    border-bottom: 1px solid var(--border);
    width: 100%;
    box-sizing: border-box;
}

.header-inner {
    max-width: 1160px;
    margin: 0 auto;
    padding: 14px 40px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.header-logo {
    height: 28px;
    width: auto;
    filter: brightness(0) invert(1);
    display: block;
}

.header-divider {
    width: 1px;
    height: 22px;
    background: var(--border);
    flex-shrink: 0;
}

.header-product {
    font-size: 0.92em;
    color: var(--text);
    opacity: 0.75;
    flex: 1;
}

.btn--sm {
    padding: 6px 14px;
    font-size: 0.8em;
    margin-top: 0;
}

.header-cta {
    margin-left: auto;
}

/* ============================================================
   PAGE SECTIONS
   ============================================================ */
.page-section {
    width: 100%;
    box-sizing: border-box;
    padding: 60px 0;
    border-bottom: 1px solid var(--border);
}

.section-inner {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 40px;
}

.section-title {
    font-family: 'Poppins', sans-serif;
    font-size: 2em;
    font-weight: 700;
    color: var(--heading);
    text-align: center;
    margin-bottom: 8px;
    padding-bottom: 0;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--teal);
    margin: 12px auto 0;
    border-radius: 2px;
}

.section-lead {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95em;
    margin-top: 8px;
    margin-bottom: 0;
}

.subsection-title {
    text-align: center;
    font-family: 'Poppins', sans-serif;
    font-size: 1.3em;
    font-weight: 700;
    color: var(--heading);
    margin-top: 48px;
    margin-bottom: 24px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.app-footer {
    width: 100%;
    background: var(--dark-navy);
    padding: 32px 0;
    box-sizing: border-box;
    margin-top: auto;
}

.footer-inner {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-logo-link {
    display: inline-block;
    text-decoration: none;
}

.footer-logo {
    height: 72px;
    width: auto;
    display: block;
    opacity: 0.92;
    transition: opacity 0.2s;
}

.footer-logo-link:hover .footer-logo {
    opacity: 1;
}

.footer-tagline {
    font-size: 0.8em;
    color: var(--teal);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0;
}

.footer-copy {
    font-size: 0.78em;
    color: var(--text-muted);
    margin: 0;
}

.footer-links {
    font-size: 0.78em;
    color: var(--text-muted);
    margin: 6px 0 0;
}

.footer-links a {
    color: var(--teal);
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* ============================================================
   Product Info Page
   ============================================================ */
pre {
    background-color: var(--dark-navy);
    color: var(--text);
    padding: 15px;
    border-radius: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
    text-align: left;
    border-left: 3px solid var(--teal);
}

/* ============================================================
   B2B-SPECIFIC: ACTION GRID (Dashboard quick actions)
   ============================================================ */
.action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-top: 40px;
}

.action-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 36px 28px;
    border: 1px solid var(--border);
    border-top: 3px solid var(--teal);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 180px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.action-card:hover {
    background: var(--card-bg-hover);
    border-color: var(--teal);
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(33, 180, 166, 0.18);
    text-decoration: none;
    color: inherit;
}

.action-card--wide {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    gap: 32px;
    min-height: auto;
}

.action-card--wide .action-card-desc {
    flex: 1;
}

.action-card--wide .action-card-arrow {
    margin-top: 0;
    flex-shrink: 0;
}

.action-card-icon {
    font-size: 2.4em;
    line-height: 1;
}

.action-card-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.15em;
    font-weight: 700;
    color: var(--heading);
    margin: 0;
}

.action-card-desc {
    font-size: 0.87em;
    color: var(--text-muted);
    line-height: 1.5;
    text-align: left;
    margin: 0;
    flex: 1;
}

.action-card-arrow {
    font-size: 1.3em;
    color: var(--teal);
    margin-top: auto;
    display: block;
    transition: transform 0.2s;
}

.action-card:hover .action-card-arrow {
    transform: translateX(5px);
}

/* ============================================================
   B2B-SPECIFIC: ACTIVITY TABLE
   ============================================================ */
.activity-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 32px;
    font-size: 0.9em;
}

.activity-table thead tr {
    background: var(--dark-navy);
}

.activity-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--teal);
    font-weight: 700;
    font-size: 0.82em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}

.activity-table td {
    padding: 12px 16px;
    color: var(--text);
    border-bottom: 1px solid var(--card-bg);
}

.activity-table tbody tr:nth-child(even) {
    background: var(--dark-navy);
}

.activity-table tbody tr:hover {
    background: var(--card-bg);
}

/* ============================================================
   B2B-SPECIFIC: INNER PAGES (forms, scanner, etc.)
   ============================================================ */
.back-link {
    display: inline-block;
    font-size: 0.88em;
    color: var(--teal);
    text-decoration: none;
    margin-bottom: 28px;
}

.back-link:hover {
    color: var(--teal-hover);
    text-decoration: underline;
}

.inner-page-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.8em;
    font-weight: 700;
    color: var(--heading);
    text-align: left;
    margin: 0 0 8px;
    position: relative;
    padding-bottom: 14px;
}

.inner-page-title::after {
    content: '';
    display: block;
    width: 48px;
    height: 3px;
    background: var(--teal);
    border-radius: 2px;
    position: absolute;
    bottom: 0;
    left: 0;
}

.form-page {
    max-width: 700px;
    margin: 0 auto;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.field-group label {
    font-size: 0.88em;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

input[type="text"],
input[type="url"],
input[type="datetime-local"],
input[type="number"],
select,
textarea {
    background: var(--dark-navy);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 10px 14px;
    font-family: 'Lato', sans-serif;
    font-size: 0.95em;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="datetime-local"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: var(--teal);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

select option {
    background: var(--dark-navy);
}

/* ============================================================
   B2B-SPECIFIC: SCANNER / CAMERA BOX
   ============================================================ */
.camera-box {
    background: var(--dark-navy);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    margin-top: 24px;
}

.camera-box video,
.camera-box canvas {
    border-radius: 8px;
    max-width: 100%;
}

/* ============================================================
   B2B-SPECIFIC: SSCC RESULT CARD
   ============================================================ */
.sscc-result {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--teal);
    border-radius: 8px;
    padding: 20px 24px;
    margin-top: 32px;
}

.sscc-result h3 {
    text-align: left;
    font-size: 1em;
    color: var(--teal);
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sscc-result p {
    text-align: left;
    font-size: 0.9em;
    color: var(--text);
    margin: 6px 0;
}

.sscc-result p strong {
    color: var(--text-muted);
}

/* ============================================================
   HEADER ACTIONS (wallet, auth, language)
   ============================================================ */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0;
}

/* Font Awesome icons inside action cards */
.action-card .action-card-icon i {
    color: var(--teal);
}

/* ── Language selector ─────────────────────────────────────── */
.lang-selector { position: relative; }

.lang-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--text);
    font-size: 1em;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.lang-btn:hover {
    border-color: var(--teal);
    background: var(--card-bg);
}

.lang-chevron {
    font-size: 0.65em;
    opacity: 0.55;
    transition: transform 0.2s;
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px;
    min-width: 150px;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}

.lang-dropdown.open { display: block; }

.lang-option {
    display: block;
    width: 100%;
    background: transparent;
    border: none;
    padding: 8px 12px;
    color: var(--text);
    font-family: 'Lato', sans-serif;
    font-size: 0.88em;
    text-align: left;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.15s, color 0.15s;
}

.lang-option:hover {
    background: var(--card-bg-hover);
    color: var(--teal);
}

/* ── Google Sign-In button ─────────────────────────────────── */
.sign-in-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #FFFFFF;
    border: none;
    border-radius: 6px;
    padding: 6px 13px;
    color: #3c3c3c;
    font-family: 'Lato', sans-serif;
    font-size: 0.85em;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s, box-shadow 0.2s;
}

.sign-in-btn:hover {
    background: #f0f0f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    text-decoration: none;
    color: #3c3c3c;
}

.google-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* ── User pill (logged-in state) ───────────────────────────── */
.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 4px 12px 4px 4px;
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-name {
    font-size: 0.83em;
    color: var(--text);
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sign-out-btn {
    font-size: 0.78em;
    color: var(--text-muted);
    text-decoration: none;
    border-left: 1px solid var(--border);
    padding-left: 8px;
    margin-left: 2px;
    transition: color 0.2s;
}

.sign-out-btn:hover {
    color: var(--teal);
    text-decoration: none;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */
@media (max-width: 768px) {
    .action-grid {
        grid-template-columns: 1fr;
    }

    .action-card--wide {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-card--wide .action-card-arrow {
        margin-top: auto;
    }

    .section-inner,
    .footer-inner {
        padding: 0 20px;
    }

    .header-inner {
        padding: 14px 20px;
    }
}

/* ============================================================
   B2B: GENERATE QR PAGE
   ============================================================ */
.qr-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 32px;
    padding: 32px;
    background: var(--card-bg);
    border: 1px solid var(--teal-border);
    border-radius: 12px;
}
.qr-result img {
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    width: 240px;
    height: 240px;
}
.qr-url {
    font-family: monospace;
    font-size: 0.80em;
    color: var(--teal);
    background: var(--teal-pale);
    border: 1px solid var(--teal-border);
    border-radius: 6px;
    padding: 8px 14px;
    word-break: break-all;
    text-align: center;
    max-width: 520px;
}
.qr-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}
.gs1-note {
    font-size: 0.82em;
    color: var(--text-muted);
    background: var(--teal-pale);
    border-left: 3px solid var(--teal);
    padding: 10px 16px;
    border-radius: 0 6px 6px 0;
    margin-top: 8px;
}
.meta-row   { display: flex; flex-direction: column; gap: 4px; align-self: stretch; max-width: 520px; }
.meta-label { font-size: 0.72em; text-transform: uppercase; letter-spacing: 0.06em; color: var(--teal); font-weight: 700; }
.meta-value { font-family: monospace; font-size: 0.82em; color: var(--text); word-break: break-all; }

/* ============================================================
   DESKTOP BREAKPOINT  ≥ 1024px
   ============================================================ */
@media (min-width: 1024px) {
    /* 1. Action grid — 4 columns on wide screens */
    .action-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }

    /* 2. Activity table — ensure full-width display, no column constraints */
    .activity-table {
        table-layout: auto;
        width: 100%;
    }

    /* 3. Forms — wider container and 2-column field rows */
    .form-page {
        max-width: 900px;
    }

    .field-group-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .field-group-row .field-group {
        margin-bottom: 0;
    }
}

/* ============================================================
   INLINE ERROR BANNER (replaces alert() calls)
   ============================================================ */
.error-banner {
    background: var(--red-pale);
    border: 1px solid var(--red);
    border-left: 3px solid var(--red);
    border-radius: 6px;
    color: var(--red);
    font-size: 0.9em;
    padding: 10px 14px;
    margin-top: 12px;
}
