/* ==========================================================================
ANOTHER PRINT SHOP - HIGH-FIDELITY DESIGN SYSTEM (main.css)
========================================================================== */

@import url(_variables.css);
@import url(auth.css);
@import url(cart.css);
@import url(catalog.css);
@import url(checkout.css);
@import url(home.css);
@import url(product.css);
@import url(prose.css);

/* --- BASE STYLES --- */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-height, 72px); 
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
}

a {
    text-decoration: none;
    color: var(--accent-trust);
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

a:hover {
    color: var(--accent-trust-hover);
    text-shadow: 0 0 8px var(--accent-trust-glow);
}

/* --- GLOBAL LAYOUT COMPONENTS --- */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.app-main {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 4rem;
}

.main-content {
    /* Forces the content to physically start BELOW the floating header */
    padding-top: var(--header-height, 72px); 
    min-height: 100vh;
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
        /* Tighter padding for mobile viewports */
    }

    .app-main {
        /* Add padding at the bottom so the app bar doesn't cover content */
        padding-bottom: calc(4rem + 70px + env(safe-area-inset-bottom));
    }

    .app-header {
        padding: 0.5rem 0;
    }
}

/* Unified Surface Utility */
.surface-card {
    background-color: var(--bg-surface);
    border: var(--border-subtle);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Unified Button System */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    padding: 0.85rem 1.75rem;
    border-radius: var(--border-radius-md);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.95rem;
    line-height: 1.2;
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Primary CTA - The Impulse Trigger */
.btn--primary {
    background-color: var(--accent-action);
    color: #ffffff;
    box-shadow: 0 4px 15px var(--accent-action-glow);
}

.btn--primary:hover:not(:disabled) {
    background-color: var(--accent-action-hover);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px var(--accent-action-glow);
}

.btn--secondary {
    background-color: transparent;
    color: var(--accent-trust);
    border: 2px solid var(--accent-trust);
}

.btn--secondary:hover:not(:disabled) {
    background-color: rgba(0, 229, 255, 0.1);
    box-shadow: 0 4px 15px var(--accent-trust-glow);
    transform: translateY(-2px);
}

.btn--ghost {
    background-color: transparent;
    color: var(--text-muted);
}

.btn--ghost:hover:not(:disabled) {
    color: var(--text-primary);
    background-color: var(--bg-elevated);
}

/* HTMX Swap States */
.btn-success {
    background-color: var(--accent-success) !important;
    color: #0F1115 !important;
    box-shadow: 0 0 20px rgba(0, 245, 155, 0.5) !important;
    border: none;
}

/* Unified Form Controls */
.form-control {
    width: 100%;
    padding: 0.85rem 1rem;
    background-color: var(--bg-elevated);
    border: 1px solid transparent;
    color: var(--text-primary);
    border-radius: var(--border-radius-md);
    font-family: var(--font-body);
    transition: all 0.2s ease;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-trust);
    background-color: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--accent-trust-glow);
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- HEADER & NAVIGATION --- */
.app-header {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    font-family: var(--font-heading);
    /* Fluid typography: Shrinks cleanly on a 384px screen */
    font-size: clamp(1.1rem, 5vw, 1.5rem);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.brand-logo span {
    color: var(--accent-action);
}

.desktop-nav {
    display: block;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
}

.nav-link {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--text-primary);
    text-shadow: none;
    /* Keep nav clean */
}

.nav-link.admin-link {
    color: var(--accent-alert);
    /* Make admin distinct */
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.nav-link.admin-link:hover {
    color: #FF7096;
}

.mobile-menu-btn {
    display: none;
    /* Hidden on desktop */
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .desktop-nav {
        display: none;
    }

    /* Hide primary links */
    .mobile-menu-btn {
        display: block;
    }

}

/* Cart Icon & Badge */
.cart-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    color: var(--text-muted);
    transition: color 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.cart-wrapper:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    background-color: var(--accent-action);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-heading);
    height: 20px;
    min-width: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 8px var(--accent-action-glow);
    /* HTMX swap animation class */
    transition: transform 0.2s ease;
}

.cart-badge.htmx-swapping {
    transform: scale(1.5);
}

/* --- MOBILE MENU & BOTTOM APP BAR --- */

/* Slide-out Menu */
.mobile-side-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    max-width: 80vw;
    height: 100vh;
    background-color: var(--bg-surface);
    z-index: 2001;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
    transition: right 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
}

.mobile-side-menu.open {
    right: 0;
}

.mobile-menu-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: var(--border-subtle);
}

.mobile-menu-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.mobile-nav-list {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

.mobile-nav-list li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-nav-link {
    display: block;
    padding: 1.25rem 1.5rem;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.mobile-nav-link:active {
    background-color: var(--bg-elevated);
}

.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* Bottom App Bar */
.bottom-app-bar {
    display: none;
    /* Hidden on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(65px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background-color: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--glass-border);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
}

@media (max-width: 768px) {
    .bottom-app-bar {
        display: flex;
    }

    .app-footer {
        margin-bottom: calc(65px + env(safe-area-inset-bottom));
    }
}

.app-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 600;
    width: 25%;
    /* Divide evenly */
    height: 100%;
    transition: color 0.2s ease;
}

.app-bar-item:active,
.app-bar-item:focus {
    color: var(--accent-trust);
}

.app-bar-icon {
    margin-bottom: 4px;
    width: 22px;
    height: 22px;
}

/* --- HTMX PROGRESS BAR --- */
.htmx-indicator {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background-color: var(--accent-action);
    width: 0%;
    z-index: 1000;
    opacity: 0;
    transition: width 0.2s ease, opacity 0.2s ease;
}

.htmx-request .htmx-indicator {
    width: 100%;
    opacity: 1;
    transition: width 2s cubic-bezier(0.1, 0.7, 0.1, 1);
    /* Faux loading animation */
}

/* --- FOOTER --- */
.app-footer {
    background-color: var(--bg-surface);
    border-top: var(--border-subtle);
    padding: 3rem 0;
    text-align: center;
    margin-top: auto;
}

.footer-text {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.footer-link {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-link:hover {
    color: var(--accent-trust);
}

/* --- PRODUCT CARDS --- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2.5rem;
}

.product-card {
    background-color: var(--bg-surface);
    border: var(--border-subtle);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    position: relative;
}

.product-card:hover {
    border-color: var(--accent-trust);
    box-shadow: var(--shadow-glow);
    transform: translateY(-8px);
}

.product-image-wrap {
    display: block;
    height: 260px;
    background-color: #0F1115;
    /* Even darker to make prints pop */
    overflow: hidden;
    position: relative;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Keep the whole 3D model visible */
    transition: transform 0.6s ease;
    padding: 1rem;
}

.product-card:hover .product-image {
    transform: scale(1.08);
}

/* The Psychological Overlay */
.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 229, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.product-card:hover .image-overlay {
    opacity: 1;
}

.image-overlay span {
    background-color: var(--bg-base);
    color: var(--accent-trust);
    padding: 0.5rem 1.2rem;
    border-radius: var(--border-radius-md);
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    border: 1px solid var(--accent-trust);
    box-shadow: 0 0 15px var(--accent-trust-glow);
    transform: translateY(10px);
    transition: transform 0.3s ease;
}

.product-card:hover .image-overlay span {
    transform: translateY(0);
}

.product-info {
    padding: 1.75rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-base) 100%);
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.product-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    margin: 0;
}

.product-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.product-title a:hover {
    color: var(--accent-trust);
}

.product-price {
    color: var(--accent-trust);
    font-family: 'Space Grotesk', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    background-color: rgba(0, 229, 255, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
}

.product-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.product-link {
    color: var(--accent-action);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    margin-top: auto;
}

.product-link:hover {
    color: var(--accent-action-hover);
    gap: 0.75rem;
    /* The arrow slides slightly to the right */
}

/* --- FLASH MESSAGES (TOASTS) --- */
.flash-container-fixed {
    position: fixed;
    top: 5rem;
    right: 2rem;
    z-index: 150;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

@media (max-width: 768px) {
    .flash-container-fixed {
        left: 1rem;
        right: 1rem;
        align-items: center;
        /* Center toast on mobile */
    }
}

.flash-toast {
    animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, fadeOut 0.5s ease-in 3.5s forwards;
    pointer-events: auto;
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    font-weight: 500;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-left: 4px solid transparent;
    /* Accent border */
}

.flash-success {
    border-left-color: var(--accent-success);
    color: var(--text-primary);
}

.flash-success .flash-icon {
    color: var(--accent-success);
}

.flash-error {
    border-left-color: var(--accent-alert);
    color: var(--text-primary);
}

.flash-error .flash-icon {
    color: var(--accent-alert);
}

.flash-icon {
    margin-right: 0.75rem;
    font-size: 1.2rem;
}

@keyframes slideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* Swatches */
.swatch-glass-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px;
    border-radius: 6px;
    flex-shrink: 0;
    margin-right: 0.5rem;
}

/* The Inner Circle */
.swatch-circle {
    display: block;
    width: 16px;
    /* Adjust size if needed */
    height: 16px;
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    margin: 0 !important;
}