/* styles.css — Battery Passport Portal (ported from battery_pass_demo/public/css/styles.css,
   with all login/auth-related rules removed — this stub has no login) */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 100%);
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
}

/* --- Loading & Error screens --- */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    color: #6b7280;
    font-size: 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 40px;
}

.error-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.error-screen h2 {
    font-size: 24px;
    color: #374151;
    margin-bottom: 10px;
}

.error-screen p {
    color: #6b7280;
    font-size: 16px;
}

/* --- Main container --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px white;
    overflow: auto;
}

/* --- Header --- */
.header {
    background: black;
    color: white;
    padding: 30px;
    text-align: center;
    border-radius: 12px;
    /* Matches .signature-box, which sits inside it. */
}

.header h1 {
    font-size: 32px;
    margin-bottom: 20px;
}

.verified-badge {
    display: inline-block;
    background: white;
    color: #009637;
    padding: 8px 20px;
    border-radius: 16px;
    font-weight: 600;
    margin-bottom: 5px;
}

.signature-box {
    background: black;
    padding: 15px;
    border-radius: 12px;
    margin-top: 5px;
    word-break: break-all;
    font-size: 16px;
    font-family: monospace;
}

/* --- Main Info --- */
.main-info {
    padding: 30px;
}

.passport-id {
    background: #F5F5F5;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    /* Identifier on the left, record update time on the right. Matches
       .model-serial below so the two cards line up. */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.passport-id label {
    font-size: 12px;
    color: black;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.passport-id .value {
    font-size: 14px;
    color: black;
    margin-top: 5px;
    word-break: break-all;
}

.model-serial {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.info-box {
    background: #FFFFFF;
    padding: 15px;
    border-radius: 12px;
    border-left: 4px solid black;
}

.info-box label {
    font-size: 12px;
    color: black;
    text-transform: uppercase;
    font-weight: 600;
}

.info-box .value {
    font-size: 18px;
    color: black;
    margin-top: 5px;
    font-weight: 600;
}

/* --- Battery Image --- */
.battery-image {
    margin: 30px 0;
    /* Flex rather than text-align: the caption has to centre under the image,
       not under the full width of the card, or it drifts off-centre on wide
       screens where the image is capped at max-width. */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.battery-image picture {
    display: block;
    width: 100%;
    max-width: 420px;
}

.battery-image img {
    display: block;
    width: 100%;
    height: auto;
    /* The cap is repeated here rather than left on the picture element alone.
       The mockup build substitutes a plain image element, which dropped the cap
       and rendered the photograph at full card width. Keep the two the same.
       Do not write element tags in this file: the mockup inlines this stylesheet
       into the head, where a literal tag name is matched by the build's own
       element regexes and silently eats the page. */
    max-width: 420px;
    /* Matches the trimmed asset exactly (1575 x 974). Holds the space open
       while the image loads so nothing below it shifts. */
    aspect-ratio: 1575 / 974;
    object-fit: contain;
    /* No border-radius or background: the photo has a transparent background,
       so a rounded box would clip nothing and a background would reintroduce
       the white rectangle the trim removed. */
}

.image-disclaimer {
    font-size: 12px;
    color: #8c8c8c;
    font-style: italic;
    margin-top: 10px;
}

/* --- Operator Section --- */
.operator-section {
    background: #F5F5F5;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
}

.operator-section h3 {
    font-size: 14px;
    color: black;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 40px;
}

.tab {
    padding: 25px 30px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-weight: 600;
    color: #8c8c8c;
    white-space: nowrap;
    transition: all 0.3s;
}

.tab.active {
    color: #002d46;
    border-bottom-color: #002d46;
}

.tab:hover {
    color: #002d46;
}

.tab-content {
    padding: 30px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* --- Detail rows --- */
.detail-row {
    padding: 20px 0;
    border-bottom: 1px solid #f0f0f0;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: black;
    margin-bottom: 5px;
}

.detail-description {
    font-size: 13px;
    color: black;
    margin-bottom: 10px;
    font-style: italic;
}

.detail-value {
    color: black;
    font-size: 15px;
}

.detail-value a {
    color: #002d46;
    font-weight: 600;
    text-decoration: none;
}

.detail-value a:hover {
    text-decoration: underline;
}

/* --- Footer --- */
.footer {
    background: #FFFFFF;
    padding: 20px 30px;
    border-top: 1px solid #e5e7eb;
    font-size: 12px;
    color: #8c8c8c;
}

/* --- Demonstrator notice (BATPASS-119) -------------------------------------
   Sits above the header so it is read before the data, not after it. Amber
   rather than red: this is a caution about provenance, not an error — the page
   is working exactly as intended. Grey would have let it disappear against the
   surrounding chrome, which is what happened when it lived in the footer. */
.demo-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #FFF8E6;
    border: 1px solid #F0D48A;
    border-left: 4px solid #D9A21B;
    padding: 14px 18px;
    font-size: 13px;
    line-height: 1.55;
    color: #5C4708;
}

.demo-notice-badge {
    flex: 0 0 auto;
    background: #D9A21B;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 3px;
    /* Nudge down so the badge aligns with the first line of text rather than
       the top of the flex box. */
    margin-top: 1px;
    white-space: nowrap;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    body {
        padding: 14px;
    }

    .container {
        width: 100%;
        overflow-x: hidden;
    }

    .header,
    .main-info,
    .tab-content {
        padding: 24px;
    }

    .tabs {
        padding: 0 20px;
    }

    .tab {
        padding: 18px 20px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        min-height: 100dvh;
    }

    .container {
        border-radius: 12px;
    }

    .header h1 {
        font-size: 26px;
        line-height: 1.2;
    }

    .header > div {
        margin-top: 12px !important;
    }

    .header > div > div:first-child {
        font-size: 20px !important;
        line-height: 1.2;
    }

    .signature-box {
        font-size: 14px;
        padding: 12px;
        overflow-wrap: anywhere;
    }

    .main-info,
    .tab-content,
    .header {
        padding: 18px;
    }

    .passport-id {
        padding: 14px;
        /* Side by side is too tight on a phone, and the update-time label is
           long. */
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .model-serial {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }

    .info-box .value {
        font-size: 16px;
    }

    .operator-section {
        padding: 18px;
        margin-bottom: 20px;
    }

    .tabs {
        padding: 0 10px;
        scroll-snap-type: x proximity;
    }

    .tab {
        padding: 14px 16px;
        font-size: 14px;
        min-height: 44px;
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    .detail-row {
        padding: 14px 0;
    }

    .detail-value {
        font-size: 14px;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .passport-id .value {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .footer {
        padding: 16px;
    }

    /* On a phone the badge and the sentence side by side squeeze the text into
       a narrow column, so stack them instead. */
    .demo-notice {
        flex-direction: column;
        gap: 8px;
        padding: 12px 14px;
        font-size: 12.5px;
    }

    .demo-notice-badge {
        align-self: flex-start;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 22px;
    }

    .header > div > div:first-child {
        font-size: 18px !important;
    }

    .verified-badge {
        padding: 6px 14px;
        font-size: 13px;
    }

    .tab {
        padding: 12px 14px;
        font-size: 13px;
    }

    .detail-label {
        font-size: 14px;
    }

    .detail-value,
    .passport-id .value {
        font-size: 13px;
    }
}
