/* ============================================================
   MINIXMART — style_home.css
   Light + Dark theme via CSS custom properties
   Dark mode: soft dark grey, on-brand blue accents
   ============================================================ */

/* ── CSS VARIABLES ── */
:root {
    --bg-page:        #f4f6f9;
    --bg-card:        #ffffff;
    --bg-card-hover:  #f8f9fa;
    --bg-input:       #ffffff;
    --bg-strip:       #ffffff;
    --bg-modal:       #ffffff;
    --bg-subcat:      #f0f6ff;
    --bg-chat:        #f8f9fa;

    --text-primary:   #333333;
    --text-secondary: #586069;
    --text-muted:     #888888;
    --text-price:     #002D62;
    --text-heading:   #002D62;

    --border-color:   #e1e4e8;
    --border-input:   #dddddd;

    --brand:          #002D62;
    --brand-mid:      #0056b3;
    --brand-light:    #e7f3ff;
    --brand-text:     #007bff;

    --shadow-card:    0 2px 8px rgba(0,0,0,0.06);
    --shadow-nav:     0 2px 10px rgba(0,0,0,0.10);

    --bubble-sent-bg: #002D62;
    --bubble-recv-bg: #e9ecef;
    --bubble-recv-tx: #333;

    --toggle-icon: "☀️";
}

[data-theme="dark"] {
    /* ── LINEAR-STYLE: near-black depth layers ── */
    --bg-page:        #060609;
    --bg-card:        #0f1117;
    --bg-card-hover:  #161b27;
    --bg-input:       #060609;
    --bg-strip:       #09090d;
    --bg-modal:       #0f1117;
    --bg-subcat:      #09090d;
    --bg-chat:        #09090d;

    /* ── High-contrast text hierarchy ── */
    --text-primary:   #e2e8f0;
    --text-secondary: #64748b;
    --text-muted:     #334155;
    --text-price:     #60a5fa;
    --text-heading:   #e2e8f0;

    /* ── Hairline borders — barely-there ── */
    --border-color:   #1e2433;
    --border-input:   #1e2433;

    /* ── Single vivid accent: electric blue ── */
    --brand:          #2563eb;
    --brand-mid:      #3b82f6;
    --brand-light:    #0c1a35;
    --brand-text:     #60a5fa;

    --shadow-card:    0 0 0 1px #1e2433;
    --shadow-nav:     0 1px 0 0 #1e2433;

    /* ── Chat bubbles ── */
    --bubble-sent-bg: #1d4ed8;
    --bubble-recv-bg: #0f1117;
    --bubble-recv-tx: #e2e8f0;

    --toggle-icon: "🌙";
}

/* ── RESET ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.25s ease, color 0.25s ease;
}

/* ── NAVBAR ── */
.navbar {
    background: #002D62;
    color: white;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-nav);
    transition: box-shadow 0.25s;
    overflow: visible;
}
[data-theme="dark"] .navbar { background: #09090d; border-bottom: 2px solid var(--text-secondary); }

.nav-container { max-width: 1500px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; overflow: visible; }
.logo a { color: white; text-decoration: none; font-size: 24px; font-weight: bold; }

.search-form { flex-grow: 0.5; position: relative; max-width: 500px; margin: 0 20px; }
.search-form input {
    width: 100%;
    padding: 10px 45px 10px 15px;
    border-radius: 20px;
    border: none;
    outline: none;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: background 0.25s, color 0.25s;
}
/* FIX (accessibility audit): the outline:none above removes the browser's
   default focus ring entirely with no replacement, leaving keyboard-only
   users with zero visible indication that the search box is focused —
   the most prominent interactive element on the page. :focus-visible only
   applies this when the element was reached via keyboard (Tab), not on a
   mouse click, so it doesn't change the look for mouse users at all. */
.search-form input:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}
.search-form button {
    position: absolute !important;
    right: 3px;
    top: 2px;
    border: none;
    background: #002D62;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
}
[data-theme="dark"] .search-form button {/* background: #2563eb; */}

.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a { color: white; text-decoration: none; font-size: 14px; font-weight: 500; }
.login-trigger { background: white; color: #002D62; border: none; padding: 8px 20px; border-radius: 6px; font-weight: bold; cursor: pointer; }
[data-theme="dark"] .login-trigger { background: #2563eb; color: #fff; }
.user-name-pill { background: rgba(255,255,255,0.15); padding: 5px 12px; border-radius: 20px; font-size: 13px; cursor: pointer; }

/* ── DARK MODE TOGGLE ── */
.theme-toggle {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(255,255,255,0.25); }

/* ── CATEGORY STRIP ── */
.category-strip {
    background: var(--bg-strip);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
    transition: background 0.25s, border-color 0.25s;
}
.category-strip a { text-decoration: none; color: var(--text-secondary); font-size: 13px; font-weight: 600; margin-right: 25px; transition: color 0.2s; }
.category-strip a:hover { color: #002D62; }
[data-theme="dark"] .category-strip a:hover { color: #60a5fa; }

/* ── LAYOUT ── */
.main-container { margin-bottom: 60px; margin-top: 60px; padding: 0 20px; }
.section-title { font-size: 36px; color: var(--text-heading); margin-bottom: 25px; font-weight: bold; margin-left: 40px; transition: color 0.25s; }

/* ── GRID & PRODUCT CARDS ── */
.grid-layout { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 2fr)); gap: 35px; padding: 0 40px; }
.product-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}
.product-card:hover { transform: translateY(-6px); box-shadow: 0 14px 28px rgba(0,0,0,0.12); }
[data-theme="dark"] .product-card:hover { box-shadow: 0 14px 28px rgba(0,0,0,0.5); }
.product-card:active { transform: translateY(-2px); }

.image-box { height: 220px; position: relative; overflow: hidden; }
.image-box img { width: 100%; height: 100%; object-fit: cover; }
.cat-tag { position: absolute; top: 10px; left: 10px; background: rgba(255,255,255,0.9); color: #002D62; font-size: 10px; font-weight: bold; padding: 4px 8px; border-radius: 5px; }
[data-theme="dark"] .cat-tag { background: rgba(26,29,36,0.85); color: #7eb8f7; }

.details-box { padding: 15px; flex-grow: 1; display: flex; flex-direction: column; }
.price-text { font-size: 22px; font-weight: 800; color: var(--text-price); margin: 8px 0; transition: color 0.25s; }

/* ── DASHBOARD ── */
.profile-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    transition: background 0.25s, border-color 0.25s;
}
.profile-main { display: flex; align-items: center; gap: 20px; }
.avatar-large { font-size: 60px; color: var(--text-heading); transition: color 0.25s; }
.post-btn-dash { background: #002D62; color: white; border: none; padding: 10px 20px; border-radius: 8px; font-weight: bold; cursor: pointer; }
[data-theme="dark"] .post-btn-dash { background: #2563eb; }

/* ── DASH CONTROLS ── */
.dash-controls { display: flex; gap: 8px; margin-top: auto; padding-top: 15px; width: 100%; }
.btn-edit, .btn-sold, .btn-remove {
    flex: 1; height: 38px; border-radius: 6px; border: none; font-size: 12px;
    cursor: pointer; font-weight: 600; display: flex; align-items: center;
    justify-content: center; text-decoration: none; transition: 0.2s;
}
.btn-edit { background: #f0f2f5; color: #333; }
.btn-edit:hover { background: #e4e6e9; }
.btn-sold { background: #e7f3ff; color: #007bff; }
.btn-sold:hover { background: #d0e7ff; }
.btn-remove { background: #ffebeb; color: #d73a49; }
.btn-remove:hover { background: #ffdada; }

[data-theme="dark"] .btn-edit { background: #0f1117; color: #94a3b8; border: 1px solid #1e2433; }
[data-theme="dark"] .btn-edit:hover { background: #161b27; }
[data-theme="dark"] .btn-sold { background: #0c1a35; color: #60a5fa; border: 1px solid #1e3a5f; }
[data-theme="dark"] .btn-sold:hover { background: #102040; }
[data-theme="dark"] .btn-remove { background: #1a0a0e; color: #f87171; border: 1px solid #3f1d25; }
[data-theme="dark"] .btn-remove:hover { background: #220d12; }

/* ── MODALS ── */
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.65); display: flex; justify-content: center; align-items: center; z-index: 2000; padding: 20px; }
.modal-window {
    background: var(--bg-modal);
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 36px 40px;
    border-radius: 20px;
    position: relative;
    border: 1px solid var(--border-color);
    transition: background 0.25s, border-color 0.25s;
}
.modal-close { position: absolute; top: 15px; right: 20px; border: none; background: none; font-size: 24px; cursor: pointer; color: var(--text-muted); }
.modal-panel input, .modal-panel select, .modal-panel textarea {
    width: 100%; padding: 12px; margin-bottom: 15px;
    border: 1px solid var(--border-input); border-radius: 8px;
    background: var(--bg-input); color: var(--text-primary);
    transition: background 0.25s, border-color 0.25s, color 0.25s;
}
.modal-panel label { color: var(--text-primary); }
.modal-panel h2 { color: var(--text-heading); }
.btn-primary { width: 100%; background: #002D62; color: white; padding: 14px; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; transition: background 0.2s ease, transform 0.15s ease; }
.btn-primary:hover { background: #003d8a; }
.btn-primary:active { transform: scale(0.97); }
[data-theme="dark"] .btn-primary { background: #2563eb; }
[data-theme="dark"] .btn-primary:hover { background: #1d4ed8; }

/* ── BUTTONS ── */
.btn-outline { background: transparent; border: 2px solid #002D62; color: #002D62; padding: 12px; width: 100%; border-radius: 8px; margin-top: 10px; cursor: pointer; font-weight: bold; transition: 0.3s; }
.btn-outline:hover { background: #002D62; color: white; }
.btn-register-toggle { background: transparent; border: 2px solid #002D62; color: #002D62; padding: 12px; width: 100%; border-radius: 8px; margin-top: 15px; cursor: pointer; font-weight: bold; transition: 0.3s; }
.btn-register-toggle:hover { background: #002D62; color: white; }
[data-theme="dark"] .btn-outline,
[data-theme="dark"] .btn-register-toggle { border-color: #2563eb; color: #60a5fa; }
[data-theme="dark"] .btn-outline:hover,
[data-theme="dark"] .btn-register-toggle:hover { background: #2563eb; color: #fff; border-color: #2563eb; }
.hero-btn:active { transform: scale(0.97); }
.post-btn-dash:active { transform: scale(0.97); }

/* ── CHAT ── */
.chat-container { display: flex; flex-direction: column; height: 350px; }
.chat-messages { flex-grow: 1; overflow-y: auto; background: var(--bg-chat); padding: 10px; border-radius: 8px; margin-bottom: 10px; border: 1px solid var(--border-color); display: flex; flex-direction: column; transition: background 0.25s, border-color 0.25s; }
.chat-bubble { margin-bottom: 10px; padding: 10px; border-radius: 12px; max-width: 80%; font-size: 0.9em; }
.bubble-sent { background: var(--bubble-sent-bg); color: white; align-self: flex-end; }
.bubble-received { background: var(--bubble-recv-bg); color: var(--bubble-recv-tx); align-self: flex-start; }

/* ── INQUIRY CARDS ── */
.inquiry-card { background: var(--bg-card); border: 1px solid var(--border-color); padding: 15px; border-radius: 10px; margin-bottom: 10px; cursor: pointer; transition: background 0.2s, border-color 0.25s; border-left: 4px solid #002D62; }
.inquiry-card:hover { background: var(--bg-card-hover); transform: translateX(5px); }
[data-theme="dark"] .inquiry-card { border-left-color: #2563eb; }

/* ── SOLD RIBBON ── */
[data-theme="dark"] .sold-ribbon { background: #7f1d1d !important; }
.sold-ribbon { position: absolute; top: 15px; right: -35px; background: #d73a49; color: white; padding: 5px 40px; transform: rotate(45deg); font-size: 11px; font-weight: bold; box-shadow: 0 2px 5px rgba(0,0,0,0.2); z-index: 2; }
.sold-overlay-card { background: var(--bg-card-hover) !important; border-color: var(--border-color) !important; }
.sold-overlay-card img { filter: grayscale(80%) opacity(0.6); }

/* ── MISC ── */
.wa-btn-full { display: block; background: #25D366; color: white; text-decoration: none; text-align: center; padding: 14px; border-radius: 8px; font-weight: bold; margin-top: 20px; }
.wa-btn-full.gray-btn { background: #606770; }
.view-image-full { width: 100%; height: 250px; object-fit: cover; border-radius: 10px; margin-bottom: 20px; }

.seller-chip { display:flex; align-items:center; gap:5px; font-size:12px; color: var(--text-muted); transition: color 0.25s; }
.seller-chip i { color: var(--text-heading); font-size:13px; }
.product-title-text { font-size: 1.1em; color: var(--text-primary); margin-bottom: 5px; transition: color 0.25s; }
.user-name-pill { cursor:pointer; background:#ffffff; color:#002D62; border-radius:20px; padding:5px 15px; font-size:0.9em; font-weight:600; position:relative; display:inline-flex; align-items:center; gap:6px; }
[data-theme="dark"] .user-name-pill { background: rgba(37,99,235,0.15); color: #e2e8f0; border: 1px solid #1e2433; }

/* ── SECTION HEADER & FILTER BAR ── */
.section-header { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:20px; padding: 0 40px; }
.section-header .section-title { margin-left:0 !important; margin-bottom:0 !important; }
.filter-bar { display:flex; align-items:center; }

/* ── EMPTY STATE ── */
.empty-state { text-align:center; padding:80px 20px; grid-column:1/-1; }
.empty-state i { font-size:52px; color: var(--border-color); display:block; margin-bottom:16px; }
.empty-state h3 { font-size:20px; color: var(--text-secondary); margin-bottom:8px; }
.empty-state p { font-size:14px; color: var(--text-muted); }

/* ── PROFILE STATS ── */
.profile-stats { display:flex; gap:10px; margin-top:10px; }
.stat-chip { background:#f0f4ff; border:1px solid #d0daf5; border-radius:8px; padding:8px 16px; text-align:center; min-width:70px; transition: background 0.25s, border-color 0.25s; }
.stat-chip.sold-chip { background:#fff3f3; border-color:#ffd0d0; }
.stat-chip.active-chip { background:#edfff4; border-color:#b8f0ce; }
.stat-num { display:block; font-size:20px; font-weight:800; color:#002D62; line-height:1.2; }
.sold-chip .stat-num { color:#d73a49; }
.active-chip .stat-num { color:#1a9e5c; }
.stat-label { display:block; font-size:11px; color:#888; font-weight:500; margin-top:2px; }
[data-theme="dark"] .stat-chip { background:#0f1117; border-color:#1e2433; }
[data-theme="dark"] .stat-chip.sold-chip { background:#0f0a0c; border-color:#3f1d25; }
[data-theme="dark"] .stat-chip.active-chip { background:#061410; border-color:#14532d; }
[data-theme="dark"] .stat-num { color:#60a5fa; }
[data-theme="dark"] .sold-chip .stat-num { color:#f87171; }
[data-theme="dark"] .active-chip .stat-num { color:#66bb6a; }
[data-theme="dark"] .stat-label { color: var(--text-muted); }

/* ── UNREAD BADGE ── */
.unread-badge { background:#e53e3e; color:white; font-size:10px; font-weight:800; min-width:18px; height:18px; border-radius:9px; display:inline-flex; align-items:center; justify-content:center; padding:0 4px; line-height:1; animation:badge-pop 0.3s ease; }
@keyframes badge-pop { 0%{transform:scale(0)} 70%{transform:scale(1.2)} 100%{transform:scale(1)} }

/* ── FORM ERROR ── */
.form-error { background:#fff0f0; border:1px solid #ffc0c0; color:#c0392b; padding:10px 12px; border-radius:8px; font-size:13px; margin-bottom:14px; display:flex; align-items:center; gap:8px; }
[data-theme="dark"] .form-error { background:#1a0a0e; border-color:#3f1d25; color:#f87171; }
.form-success { background:#ecfdf5; border:1px solid #a7f3d0; color:#047857; padding:10px 12px; border-radius:8px; font-size:13px; margin-bottom:14px; display:flex; align-items:center; gap:8px; }
[data-theme="dark"] .form-success { background:#052e24; border-color:#14532d; color:#6ee7b7; }
.auth-subtle { text-align:center; margin-top:15px; color:var(--text-secondary); font-size:0.9em; }
.auth-link-btn { background:none; border:none; color:var(--brand); font-weight:600; cursor:pointer; padding:0; text-decoration:underline; font-size:0.95em; }
[data-theme="dark"] .auth-link-btn { color:#60a5fa; }
.auth-divider { display:flex; align-items:center; gap:10px; margin:18px 0 14px; color:var(--text-muted); font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:0.06em; }
.auth-divider::before, .auth-divider::after { content:""; flex:1; height:1px; background:var(--border-color); }

/* ── PAGINATION ── */
.pagination-bar { display:flex; align-items:center; justify-content:center; gap:16px; padding:32px 0 10px; }
.page-btn { background: var(--bg-card); border:1px solid var(--border-color); color: var(--text-heading); padding:8px 20px; border-radius:8px; text-decoration:none; font-weight:600; font-size:14px; transition:0.2s; }
.page-btn:hover { background:#002D62; color:white; border-color:#002D62; }
[data-theme="dark"] .page-btn:hover { background:#2563eb; border-color:#2563eb; }
.page-info { font-size:14px; color: var(--text-muted); }

/* ── MOBILE ── */
@media (max-width: 768px) {
    .nav-container { flex-wrap: wrap; gap: 10px; }
    .search-form { order: 3; flex-grow: 1; max-width: 100%; margin: 0; }
    .nav-links { gap: 12px; }
    .grid-layout { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; padding: 0 16px; }
    .hero-wrapper { padding: 28px 16px; }
    .hero-card { padding: 28px 20px; }
    .hero-heading { font-size: 28px; }
    .main-container { padding: 0 12px; }
    .section-header { padding: 0 16px; flex-direction: column; align-items: flex-start; }
    .filter-bar form { flex-wrap: wrap; }
    .modal-window { padding: 24px 20px; border-radius: 14px; max-height: 92vh; overflow-y: auto; }
    .profile-card { flex-direction: column; align-items: flex-start; gap: 16px; }
    .profile-stats { flex-wrap: wrap; }
    .section-title { margin-left: 16px !important; font-size: 24px !important; }
    .category-strip .nav-container { overflow-x: auto; gap: 20px; justify-content: flex-start; padding: 0 16px; }
    .footer-cards { grid-template-columns: 1fr !important; }
    .footer-links-bar { grid-template-columns: repeat(2,1fr) !important; }
}
@media (max-width: 480px) {
    .grid-layout { grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 12px; }
    .image-box { height: 160px !important; }
    .hero-heading { font-size: 22px; }
}
