/* ==============================
   style.css — shared across all pages
   Fonts: Bebas Neue + Inter via Google Fonts
   ============================== */

/* ==============================
   GOOGLE FONTS
   ============================== */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700&display=swap');

/* ==============================
   THEME VARIABLES
   ============================== */
:root {
    --bg:     #fff;
    --bg2:    #f4f4f4;
    --card:   #fff;
    --text:   #111;
    --muted:  #666;
    --border: #e0e0e0;
    --red:    #c8001e;
    --red2:   #a00018;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 8px;
}

[data-theme="dark"] {
    --bg:     #111;
    --bg2:    #1c1c1c;
    --card:   #1e1e1e;
    --text:   #f0f0f0;
    --muted:  #999;
    --border: #2e2e2e;
    --red:    #e8002a;
    --red2:   #c0001a;
    --shadow: 0 2px 12px rgba(0,0,0,0.5);
}

/* ==============================
   RESET
   ============================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    display: block;
    max-width: 100%;
}

/* ==============================
   SKIP NAV
   ============================== */
.skip-nav {
    position: absolute;
    top: -999px;
    left: 8px;
    background: var(--red);
    color: #fff;
    padding: 10px 18px;
    border-radius: 0 0 6px 6px;
    font-weight: 600;
    z-index: 9999;
    transition: top 0.2s;
}

.skip-nav:focus {
    top: 0;
}

/* ==============================
   NAVBAR
   ============================== */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 2px solid var(--border);
    transition: background 0.3s, border-color 0.3s;
}

nav {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* Logo */
.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.nav-logo img {
    height: 44px;
    width: auto;
}

.nav-logo span {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 1px;
    color: var(--red);
}

/* Nav links */
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    transition: background 0.2s, color 0.2s;
}

.nav-links a:hover,
.nav-links a:focus {
    background: var(--bg2);
    color: var(--red);
    outline: none;
}

.nav-links a.active {
    color: var(--red);
    font-weight: 600;
}

/* Admin link - border styling only, visibility controlled by JS */
.nav-links a.admin-link {
    border: 1px solid var(--border);
}

/* ==============================
   NAV RIGHT — Auth + Settings
   ============================== */
.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ==============================
   AUTH ELEMENTS
   All hidden by default — JS shows correct ones after Firebase loads
   This prevents the flash of wrong state
   ============================== */

/* Admin link */
.admin-link {
    display: none;
}

/* User greeting */
.user-greeting {
    display: none;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

/* Login button */
.nav-login-btn {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 18px;
    background: var(--red);
    color: #fff;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Inter', sans-serif;
}

.nav-login-btn:hover,
.nav-login-btn:focus {
    background: var(--red2);
    outline: 2px solid var(--red);
    outline-offset: 2px;
}

/* Sign out button */
.nav-signout-btn {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 18px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    font-family: 'Inter', sans-serif;
}

.nav-signout-btn:hover,
.nav-signout-btn:focus {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
    outline: none;
}

/* Mobile sign out */
.mobile-signout {
    display: none;
    width: 100%;
    padding: 12px;
    background: var(--red);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    text-align: center;
    font-family: 'Inter', sans-serif;
    transition: background 0.2s;
}

.mobile-signout:hover {
    background: var(--red2);
}

/* ==============================
   SETTINGS GEAR
   ============================== */
.settings-wrap {
    position: relative;
}

.settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 1.2rem;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    position: relative;
    z-index: 10;
    transition: background 0.2s;
}

.settings-btn:hover,
.settings-btn:focus {
    background: var(--bg2);
    outline: 2px solid var(--red);
    outline-offset: 2px;
}

.settings-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    width: 220px;
    box-shadow: var(--shadow);
    z-index: 200;
}

.settings-panel.open {
    display: block;
}

.settings-panel h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 12px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.setting-row:last-child {
    margin-bottom: 0;
}

.setting-label {
    font-size: 0.88rem;
    font-weight: 500;
}

/* Dark mode toggle pill */
.toggle-pill {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 44px;
    height: 24px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
    flex-shrink: 0;
}

.toggle-pill::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform 0.3s, background 0.3s;
}

.toggle-pill.on::after {
    transform: translateX(20px);
    background: var(--red);
}

/* Language select */
.lang-select {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}

.lang-select:focus {
    outline: 2px solid var(--red);
    outline-offset: 2px;
}

/* ==============================
   HAMBURGER + MOBILE MENU
   ============================== */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: 0.3s;
}

.mobile-menu {
    display: none;
    flex-direction: column;
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 16px 24px 24px;
    gap: 4px;
}

.mobile-menu.open {
    display: flex;
}

.mobile-menu a {
    display: block;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
    transition: color 0.2s;
}

.mobile-menu a:hover {
    color: var(--red);
}

/* Mobile login link — hidden by default, JS shows when logged out */
.mobile-menu .login-link {
    display: none;
    font-weight: 700;
    color: var(--red);
}

/* ==============================
   BUTTONS
   ============================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 22px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, outline 0.2s;
    border: 2px solid transparent;
    text-decoration: none;
    line-height: 1;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: var(--red);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--red2);
    outline: 2px solid var(--red);
    outline-offset: 2px;
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.btn-outline:hover,
.btn-outline:focus {
    border-color: var(--red);
    color: var(--red);
    outline: none;
}

.btn-danger {
    background: transparent;
    border-color: var(--red);
    color: var(--red);
}

.btn-danger:hover,
.btn-danger:focus {
    background: var(--red);
    color: #fff;
}

.btn-secondary {
    background: var(--bg2);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover,
.btn-secondary:focus {
    border-color: var(--red);
    color: var(--red);
    outline: none;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
    min-height: 36px;
}

.btn-filter,
.btn-sort,
.btn-view,
.tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    line-height: 1;
    min-height: 36px;
}

/* ==============================
   PAGE HEADER BANNER
   ============================== */
.page-header {
    background: var(--red);
    color: #fff;
    padding: 44px 24px;
}

.page-header-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.page-header h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2rem, 5vw, 3.2rem);
    line-height: 1;
    margin-bottom: 6px;
}

.page-header p {
    opacity: 0.85;
    font-size: 1rem;
}

/* ==============================
   ITEM CARDS
   ============================== */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.item-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.item-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.13);
}

.item-card:focus-within {
    outline: 2px solid var(--red);
    outline-offset: 2px;
}

.item-img {
    height: 160px;
    background: var(--bg2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    overflow: hidden;
}

.item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-info {
    padding: 14px 16px;
}

.item-info h4 {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.item-info p {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 2px;
}

/* ==============================
   BADGES
   ============================== */
.badge {
    display: inline-block;
    margin-top: 8px;
    padding: 3px 10px;
    background: var(--red);
    color: #fff;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-gray  { background: var(--muted); }
.badge-green { background: #1a7a3c; }

/* ==============================
   EMPTY + LOADING STATES
   ============================== */
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--muted);
    grid-column: 1 / -1;
}

.empty-state a {
    color: var(--red);
}

.loading-state {
    text-align: center;
    padding: 48px;
    grid-column: 1 / -1;
}

.spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ==============================
   FORMS
   ============================== */
.form-wrap {
    max-width: 700px;
    margin: 48px auto 80px;
    padding: 0 24px;
}

.form-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow);
}

.field {
    margin-bottom: 22px;
}

.field label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.req {
    color: var(--red);
    margin-left: 2px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(200,0,30,0.1);
}

.field input.invalid,
.field select.invalid,
.field textarea.invalid {
    border-color: var(--red);
}

.field textarea {
    resize: vertical;
    min-height: 100px;
}

.field-hint {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 5px;
}

.field-error {
    font-size: 0.8rem;
    color: var(--red);
    margin-top: 5px;
    display: none;
}

.field-error.show {
    display: block;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* ==============================
   FOOTER
   ============================== */
footer {
    background: var(--bg2);
    border-top: 1px solid var(--border);
    padding: 36px 24px;
    text-align: center;
}

footer p {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.8;
}

footer a {
    color: var(--red);
}

/* ==============================
   STATS BAR
   ============================== */
.stats-bar a {
    text-decoration: none;
    color: inherit;
}

.stats-bar a:hover .stat-num {
    opacity: 0.85;
}

/* ==============================
   ANIMATIONS
   ============================== */
.fade-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==============================
   CATEGORY BADGE
   ============================== */
.category-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--bg2);
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    border: 1px solid var(--border);
}

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .field-row {
        grid-template-columns: 1fr;
    }

    .form-card {
        padding: 24px;
    }

    .form-actions .btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    nav {
        padding: 0 16px;
    }

    .page-header {
        padding: 28px 16px;
    }

    .form-wrap {
        padding: 0 16px;
    }
}

/* ==============================
   TOUCH DEVICE ACCESSIBILITY
   ============================== */
@media (pointer: coarse) {
    button,
    .btn,
    [role="button"],
    a.btn {
        min-height: 44px;
        min-width: 44px;
    }
}