/* -------------------------------------------------------------------------- */
/* File: styles.css
   Purpose: Global styling for the StickerShock storefront demo.
   Responsibilities:
   - Define base layout, typography, and mobile-friendly behavior.
   - Style the main shop, checkout, header, footer, and info pages.
   - Provide components such as cart, toast notifications, overlays,
     address autocomplete, and hosted payment iframe container.
   Dependencies:
   - index.html, receipt.html, about.html, terms.html, refund.html
*/
/* -------------------------------------------------------------------------- */

/* -------------------------------------------------------------------------- */
/* Base resets and typography                                                 */
/* -------------------------------------------------------------------------- */

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f1f5f9;
    display: flex;
    flex-direction: column;
    min-height: 100vh;

    /* iOS mobile friendliness */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: contain;
}

img {
    max-width: 100%;
    height: auto;
}

input,
select,
textarea,
button {
    font-size: 16px;
    line-height: 1.25;
}

/* -------------------------------------------------------------------------- */
/* Safe area handling (iOS notches)                                           */
/* -------------------------------------------------------------------------- */

.main-layout,
#header-placeholder,
#footer-placeholder {
    padding-left: 0;
    padding-right: 0;
}

#header-placeholder {
    padding-top: 0;
}

#footer-placeholder {
    padding-bottom: 0;
}

@supports (padding: max(0px)) {

    .main-layout,
    #header-placeholder,
    #footer-placeholder {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }

    #header-placeholder {
        padding-top: max(0px, env(safe-area-inset-top));
    }

    #footer-placeholder {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

/* -------------------------------------------------------------------------- */
/* Header                                                                     */
/* -------------------------------------------------------------------------- */

.header-bar {
    background: #0f172a;
    color: #f8fafc;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.header-inner {
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.header-bar .logo {
    height: 50px;
    margin-bottom: 0.5rem;
    padding-right: 10px;
}

.logo {
    height: 40px;
    width: auto;
    margin-right: 1rem;
}

.main-nav {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-top: 0.5rem;
}

.main-nav a {
    color: #f8fafc;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.main-nav a:hover {
    color: #38bdf8;
    text-decoration: underline;
}

/* -------------------------------------------------------------------------- */
/* Footer                                                                     */
/* -------------------------------------------------------------------------- */

.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0f172a;
    color: #f8fafc;
    padding: 1rem 2rem;
    flex-wrap: wrap;
}

.footer-nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-link {
    color: #f8fafc;
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-link:hover {
    text-decoration: none;
}

/* Old footer anchors kept for compatibility */
.footer a {
    color: #f8fafc;
    text-decoration: none;
    font-size: 0.9rem;
}

.footer a:hover {
    text-decoration: none;
}

/* -------------------------------------------------------------------------- */
/* Main layout: shop + checkout                                               */
/* -------------------------------------------------------------------------- */

.main-layout {
    flex: 1;
    display: flex;
    flex-direction: row;
    min-height: 0;
}

.shop-section {
    flex: 1;
    padding: 2rem;
    background: #0f172a;
    color: #f8fafc;
    overflow-y: auto;
}

.shop-subtitle {
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
    color: #cbd5e1;
    max-width: 40rem;
}

.sticker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    max-width: calc(350px * 4 + 3.5rem * 3);
}

.checkout-section {
    width: 400px;
    padding: 2rem;
    background: #f8fafc;
    color: #0f172a;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out;
}

.checkout-subtitle {
    margin-top: 0.25rem;
    margin-bottom: 1.25rem;
    color: #4b5563;
}

/* -------------------------------------------------------------------------- */
/* Stickers                                                                   */
/* -------------------------------------------------------------------------- */

.sticker {
    background: #1e293b;
    border: 1px solid #334155;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.sticker:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.sticker img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 1rem;
}

.sticker-details h3,
.sticker-details p {
    margin: 0 0 0.5rem;
}

.sticker-price {
    font-weight: 600;
}

.sticker-details button,
.add-btn {
    background: #3b82f6;
    color: #ffffff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
}

.sticker-details button:hover,
.add-btn:hover {
    background: #2563eb;
}

/* -------------------------------------------------------------------------- */
/* Cart                                                                       */
/* -------------------------------------------------------------------------- */

.cart-summary {
    margin-bottom: 2rem;
    background: #e2e8f0;
    padding: 1rem;
    border-radius: 6px;
}

.cart-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.5rem 0;
}

.cart-item button {
    background: none;
    border: none;
    color: #ef4444;
    font-weight: bold;
    cursor: pointer;
}

.remove-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.2rem;
    cursor: pointer;
}

.remove-btn:hover {
    color: #dc2626;
}

/* Floating cart toggle for mobile */
.cart-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 0.5rem 1rem;
    font-size: 1.2rem;
    z-index: 999;
    display: none;
    cursor: pointer;
}

/* Finger-friendly targets */
.add-btn,
.cart-toggle,
.button-wrapper button {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 14px;
    border-radius: 12px;
}

.cart-toggle span {
    background: #ef4444;
    border-radius: 50%;
    padding: 0.2rem 0.5rem;
    margin-left: 0.3rem;
    font-weight: bold;
}

.cart-toggle.bump span {
    transform: scale(1.2);
    transition: transform 0.2s ease;
}

/* -------------------------------------------------------------------------- */
/* Forms                                                                      */
/* -------------------------------------------------------------------------- */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
}

.form-group input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1.25;
}

/* Address combobox + suggestions */
.address-combobox {
    position: relative;
}

.address-input {
    width: 100%;
}

/* Address suggestions dropdown */
#address-suggestions,
.address-suggestions {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    max-height: 240px;
    overflow: auto;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    display: none;
}

#address-suggestions li,
.address-suggestions li {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}

#address-suggestions li:last-child,
.address-suggestions li:last-child {
    border-bottom: none;
}

#address-suggestions li:hover,
.address-suggestions li:hover {
    background: #f1f5f9;
}

#address-suggestions li:focus,
.address-suggestions li:focus {
    outline: 2px solid #94a3b8;
}

/* Spinner for address lookup */
.addr-spinner {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: rgba(0, 0, 0, 0.65);
    border-radius: 50%;
    animation: addr-spin 0.8s linear infinite;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
}

.addr-spinner[data-active="true"] {
    opacity: 1;
}

@keyframes addr-spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Visually hidden helper (for a11y text) */
.visually-hidden {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
    border: 0;
    padding: 0;
    margin: -1px;
}

/* -------------------------------------------------------------------------- */
/* Card logos                                                                 */
/* -------------------------------------------------------------------------- */

.card-logos {
    text-align: center;
    margin-top: 1.5rem;
}

.card-logos img {
    height: 30px;
    margin: 0 0.5rem;
    vertical-align: middle;
}

/* -------------------------------------------------------------------------- */
/* Nulliti button                                                             */
/* -------------------------------------------------------------------------- */

.nulliti-button {
    margin-top: 1rem;
    background: #0f172a;
    color: #f8fafc;
    font-weight: bold;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s;
}

.nulliti-button:hover {
    background: #1e3a8a;
}

/* -------------------------------------------------------------------------- */
/* Toast notification                                                         */
/* -------------------------------------------------------------------------- */

.toast {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: #22c55e;
    color: #ffffff;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 9999;
}

.toast.show {
    opacity: 1;
}

/* -------------------------------------------------------------------------- */
/* Content pages (About / Terms / Refunds)                                    */
/* -------------------------------------------------------------------------- */

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0f172a;
}

.page-section {
    background: #0f172a;
    color: #f8fafc;
    padding: 3rem 2rem;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    text-align: center;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.page-section h1 {
    margin-bottom: 1rem;
    font-size: 2rem;
}

.page-section a {
    color: #38bdf8;
    text-decoration: underline;
}

.page-section a:hover {
    color: #0ea5e9;
    text-decoration: none;
}

.info-box {
    background: #1e293b;
    border: 1px solid #334155;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    margin: 1.5rem auto 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    max-width: 1200px;
    width: 100%;
}

.info-box p {
    margin-bottom: 1rem;
    color: #f8fafc;
    font-size: 1rem;
    line-height: 1.6;
}

.info-box a {
    color: #38bdf8;
    text-decoration: underline;
}

.info-box a:hover {
    color: #0ea5e9;
    text-decoration: none;
}

.info-box-align {
    text-align: left;
}

/* -------------------------------------------------------------------------- */
/* Hosted overlay (hosted.js)                                                 */
/* -------------------------------------------------------------------------- */

.overlay {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.65);
    justify-content: center;
    align-items: center;
}

.overlay.show {
    display: flex;
}

.overlay iframe {
    width: 420px;
    height: 640px;
    border: 0;
    border-radius: 8px;
}

.overlay .close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 24px;
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                 */
/* -------------------------------------------------------------------------- */

@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }

    .checkout-section {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        background: #f8fafc;
        transform: translateX(100%);
        z-index: 998;
        overflow-y: auto;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
        border-top: 1px solid #cbd5e1;
    }

    .checkout-section.open {
        transform: translateX(0);
    }

    .shop-section,
    .checkout-section {
        padding: 1.5rem 1rem;
    }

    .cart-toggle {
        display: block;
    }
}

@media (max-width: 480px) {
    .sticker-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .sticker img {
        width: 100%;
        height: auto;
        margin-right: 0;
    }

    .sticker {
        flex-direction: column;
        align-items: stretch;
    }

    .checkout-section,
    .shop-section {
        padding: 12px;
    }
}


/* -------------------------------------------------------------------------- */
/* Logout button                                                              */
/* -------------------------------------------------------------------------- */

.logout-btn {
    /* Match .add-btn visual style */
    background: #3b82f6;   /* same blue as .add-btn */
    color: #ffffff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;

    /* Align to the far right within .header-inner flex row */
    margin-left: auto;
    min-height: 44px;      /* optional: match finger-friendly targets */
    min-width: 44px;
}

.logout-btn:hover {
    background: #2563eb;   /* same hover as .add-btn:hover */
}


/* -------------------------------------------------------------------------- */
/* Payment flow selector (styled like regular inputs)                         */
/* -------------------------------------------------------------------------- */

.flow-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #ffffff;
    font-size: 16px;
    line-height: 1.25;
    color: #0f172a;
}

.flow-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.flow-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
}