/* 
 * StyleAgain: Editorial Minimalist System 
 * High contrast, massive whitespace, fast rendering.
 */
:root {
    --bg-color: #ffffff;
    --text-primary: #000000;
    --text-secondary: #888888;
    --border-color: #eaeaea;
    --surface-light: #f9f9f9;
    --surface-mid: #f4f4f4;
    --surface-dark: #eee;
    --invert-icon: 0;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
    --bg-color: #050505;
    --text-primary: #ffffff;
    --text-secondary: #999999;
    --border-color: #222222;
    --surface-light: #111111;
    --surface-mid: #1a1a1a;
    --surface-dark: #222222;
    --invert-icon: 1;
}

html, body { width: 100%; max-width: 100%; overflow-x: hidden; position: relative; margin: 0; padding: 0; overflow-wrap: break-word; }
#nav-container, #app-root { width: 100%; max-width: 100%; overflow-x: hidden; box-sizing: border-box; display: block; }

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-stack);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Invert static graphics in dark mode */
.invert-on-dark {
    filter: invert(var(--invert-icon));
    transition: filter 0.3s ease;
}

/* The Editorial Grid */
.editorial-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2-column default for a denser mobile feed */
    gap: 20px;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.product-card {
    text-align: left;
}

.product-image-placeholder {
    width: 100%;
    aspect-ratio: 3/4; /* High fashion portrait ratio */
    background: var(--surface-mid);
    margin-bottom: 10px;
}

.product-meta .brand {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.product-meta .title {
    font-size: 0.85rem;
    font-weight: 400;
    margin: 0 0 4px 0;
    line-height: 1.2;
}

.product-meta .price {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

@media (min-width: 768px) {
    .editorial-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px;
        padding: 20px;
        max-width: 1200px;
    }
    .product-meta .brand { font-size: 0.75rem; margin-bottom: 5px; }
    .product-meta .title { font-size: 1rem; margin-bottom: 5px; }
    .product-meta .price { font-size: 0.9rem; }
}

/* --- Navigation Bar --- */
.editorial-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .editorial-nav { padding: 20px 40px; }
    .nav-brand { font-size: 1.2rem; letter-spacing: 2px; }
    .nav-links { gap: 20px; }
}

.nav-links {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0;
}

.nav-text {
    display: none;
}

@media (min-width: 768px) {
    .nav-text {
        display: inline;
    }
}

.nav-brand {
    font-weight: 900;
    letter-spacing: 1px;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.nav-user {
    font-size: 0.85rem;
    margin-right: 15px;
    color: var(--text-secondary);
}

.nav-btn {
    background: none;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    letter-spacing: 1px;
}

.nav-btn:hover {
    text-decoration: underline;
}

/* --- Auth Modal --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    z-index: 999;
}

.modal-content {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-color);
    width: 100%;
    max-width: 400px;
    padding: 40px;
    box-sizing: border-box;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    z-index: 1000;
    border-radius: 4px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 15px; right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-header {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding-bottom: 10px;
    margin: 0;
    transition: color 0.3s;
}

.modal-header h2.active {
    color: var(--text-primary);
    border-bottom: 2px solid var(--text-primary);
}

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-group input, .input-group textarea, .input-group select {
    width: 100%;
    padding: 10px 0;
    border: none;
    border-bottom: 1px solid #ccc;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
    background: transparent;
    color: var(--text-primary);
}

.input-group input:focus {
    border-bottom-color: var(--text-primary);
}

.btn-primary {
    width: 100%;
    background: var(--text-primary);
    color: var(--bg-color);
    border: 1px solid var(--text-primary);
    padding: 12px 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-primary:hover {
    background: transparent;
    color: var(--text-primary);
}

.btn-primary:disabled {
    background: var(--surface-dark);
    border-color: var(--surface-dark);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.btn-critical {
    background: #c62828;
    color: #ffffff;
    border: 1px solid #c62828;
}

.btn-critical:hover {
    background: transparent;
    color: #c62828;
}

.auth-error {
    background: #ffebee;
    color: #c62828;
    padding: 10px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    border-radius: 4px;
    text-align: center;
}

/* --- Shop Grid Link Wrappers --- */
.product-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: opacity 0.3s ease;
}
.product-card-link:hover .product-image-placeholder {
    opacity: 0.9;
}

/* --- Item Detail Layout (SSENSE Style) --- */
.item-detail-layout {
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
}

.item-image-col {
    width: 100%;
    background: var(--surface-mid);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    min-height: 70vh;
}

.item-meta-col {
    width: 100%;
    padding: 40px 20px;
    box-sizing: border-box;
}

.back-link {
    display: inline-block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 30px;
    transition: color 0.3s;
}
.back-link:hover { color: var(--text-primary); }

.meta-brand {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.meta-title {
    font-family: "Times New Roman", Times, serif; /* High fashion serif touch */
    font-size: 2rem;
    font-weight: 400;
    margin: 0 0 15px 0;
    line-height: 1.2;
}

.meta-price {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 40px 0;
}

.meta-specs {
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    margin-bottom: 30px;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 10px;
}
.spec-row:last-child { margin-bottom: 0; }
.spec-label { color: var(--text-secondary); }
.spec-value { font-weight: 600; }

.meta-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.buyer-protection-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 20px;
    padding: 15px;
    background: var(--surface-light);
}

/* Desktop Split Layout */
@media (min-width: 900px) {
    .item-detail-layout {
        flex-direction: row;
    }
    .item-image-col {
        width: 60%;
        min-height: calc(100vh - 80px); /* Fill screen height minus nav */
    }
    .hero-image {
        min-height: 100vh;
    }
    .item-meta-col {
        width: 40%;
        padding: 60px;
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }
}

/* --- Brutalist Dropzone --- */
.image-dropzone {
    width: 100%;
    aspect-ratio: 3/4;
    border: 1px dashed #ccc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
    background: var(--surface-light);
    transition: all 0.3s ease;
}
.image-dropzone:hover, .image-dropzone.dragover {
    border-color: var(--text-primary);
    background: #f0f0f0;
    color: var(--text-primary);
}
.image-dropzone-text {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    pointer-events: none;
}
.image-preview {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 5; display: none;
}
.image-dropzone input[type="file"] {
    display: none;
}

/* --- Side Drawer --- */
.side-drawer-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.7); backdrop-filter: blur(4px); z-index: 1999; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.side-drawer-overlay.active { opacity: 1; pointer-events: auto; }
.side-drawer { position: fixed; top: 0; right: 0; width: 320px; max-width: 85vw; height: 100vh; background: var(--bg-color); border-left: 1px solid var(--border-color); z-index: 2000; transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); display: flex; flex-direction: column; padding: 30px; box-sizing: border-box; box-shadow: -10px 0 30px rgba(0,0,0,0.05); }
.side-drawer.active { transform: translateX(0); }
.drawer-close { align-self: flex-end; background: none; border: none; font-size: 2rem; font-weight: 300; cursor: pointer; color: var(--text-primary); margin-bottom: 30px; line-height: 1; }
.drawer-link { font-size: 1rem; text-transform: uppercase; letter-spacing: 1.5px; text-decoration: none; color: var(--text-primary); margin-bottom: 25px; font-weight: 600; display: flex; align-items: center; gap: 15px; transition: color 0.2s; }
.drawer-link:hover { color: var(--text-secondary); }
.drawer-user-info { margin-bottom: 40px; padding-bottom: 20px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 15px; }

/* --- Filter Bar --- */
.filter-bar { 
    display: grid; 
    grid-template-columns: 1fr; /* Stack vertically on very small screens */
    gap: 16px; 
    margin: 0 auto 30px auto; 
    max-width: 1200px; 
    padding: 0 20px; 
    width: 100%; 
    box-sizing: border-box; 
}

@media (min-width: 600px) {
    .filter-bar { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
    .filter-bar { grid-template-columns: repeat(6, 1fr); gap: 30px; } /* 6 columns to fit all filters on one line */
}

.filter-input { 
    width: 100%; 
    padding: 10px 0; 
    border: none; 
    border-bottom: 1px solid var(--border-color); 
    font-size: 0.75rem; 
    outline: none; 
    background: transparent; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    transition: border-color 0.3s; 
    color: var(--text-primary); 
    box-sizing: border-box;
    border-radius: 0;
    -webkit-appearance: none; /* Removes default iOS styling */
}
.filter-input:focus { border-bottom-color: var(--text-primary); }
.filter-input::placeholder { color: var(--text-secondary); text-transform: none; }
select.filter-input { cursor: pointer; border-radius: 0; background: var(--bg-color); }

/* Micro-viewport constraints */
@media (max-width: 360px) { 
    .editorial-nav { padding: 10px; } 
    .nav-links { gap: 10px; } 
    .nav-item svg { width: 18px; height: 18px; } 
    .nav-brand { font-size: 0.85rem; letter-spacing: 0; } 
}

/* Indeterminate Preloader */
@keyframes styleagain-load { 
    0% { left: -100%; width: 100%; } 
    100% { left: 100%; width: 10%; } 
}

.global-preloader { 
    position: fixed; 
    top: 0; 
    left: 0; 
    height: 3px; 
    background: var(--text-primary); 
    z-index: 99999; 
    display: none; 
    overflow: hidden; 
    width: 100%; 
}

.global-preloader::after { 
    content: ''; 
    position: absolute; 
    top: 0; 
    left: 0; 
    height: 100%; 
    background: var(--surface-light); 
    animation: styleagain-load 1.5s infinite ease-in-out; 
}

/* --- Toggle Switch --- */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--surface-dark);
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--text-primary);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--text-primary);
}

input:checked + .slider:before {
  -webkit-transform: translateX(20px);
  -ms-transform: translateX(20px);
  transform: translateX(20px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 20px;
}

.slider.round:before {
  border-radius: 50%;
}

/* --- Soft Grid Actions --- */
.btn-soft {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    
    /* CRITICAL: ANTI-CRUSH PROTOCOL */
    white-space: nowrap !important;
    flex-shrink: 0;
    min-width: max-content;
}
.btn-soft:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
    background: rgba(0,0,0,0.02); /* Very subtle fill */
}

/* --- Global Editorial Footer --- */
.editorial-footer {
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
    padding: 40px 20px;
    margin-top: 40px;
    color: var(--text-primary);
    width: 100%;
    box-sizing: border-box;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto 60px auto;
}

@media (min-width: 768px) {
    .editorial-footer { padding: 80px 20px 40px 20px; margin-top: 80px; }
    .footer-grid { grid-template-columns: repeat(3, 1fr); }
}

.footer-column {
    text-align: center;
}

.footer-column h4 {
    font-family: 'Times New Roman', serif;
    font-size: 1.2rem;
    margin: 0 0 20px 0;
    font-weight: 400;
}

@media (min-width: 768px) {
    .footer-column { text-align: left; }
}

.footer-column a {
    display: block;
    color: var(--text-secondary);
    text-decoration: underline transparent;
    text-underline-offset: 4px;
    font-size: 0.85rem;
    margin-bottom: 12px;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.footer-column a:hover {
    color: var(--text-primary);
    text-decoration-color: var(--text-primary);
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    border-top: 1px solid var(--border-color);
    padding-top: 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    flex-wrap: wrap;
    gap: 15px;
}

@media (min-width: 768px) {
    .footer-bottom { flex-direction: row; justify-content: space-between; text-align: left; }
}

.footer-socials { display: flex; gap: 20px; }
.footer-socials a { color: var(--text-secondary); text-decoration: none; transition: color 0.2s; font-weight: 600; }
.footer-socials a:hover { color: var(--text-primary); }

/* --- Static Article Layout --- */
.static-article-layout {
    max-width: 800px;
    margin: 60px auto 100px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.article-header {
    border-bottom: 2px solid var(--text-primary);
    padding-bottom: 30px;
    margin-bottom: 40px;
}

.article-meta {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.article-title {
    font-family: 'Times New Roman', serif;
    font-size: 3rem;
    font-weight: 400;
    margin: 0;
    line-height: 1.1;
}

.article-body {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.article-body p {
    margin-bottom: 25px;
}

.article-body h3 {
    font-family: 'Times New Roman', serif;
    font-size: 1.5rem;
    margin: 40px 0 15px 0;
    font-weight: 400;
}

@media (max-width: 600px) {
    .article-title { font-size: 2.2rem; }
    .article-body { font-size: 0.95rem; line-height: 1.6; }
}

/* --- Back to Top Button --- */
.back-to-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--text-primary);
    color: var(--bg-color);
    border: none;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
    opacity: 0;
}
.back-to-top-btn:hover { transform: translateY(-5px); }
