/* ========================================
   VARIABLES & BASE STYLES
   ======================================== */
:root {
    --accent-red: #c41e3a;
    --accent-red-dark: #a01729;
    --bg-primary: #1a1a1a;
    --bg-secondary: #222222;
    --bg-tertiary: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #999999;
    --border-color: #333333;
    --success: #4caf50;
    --error: #f44336;
    --warning: #ff9800;
}

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

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
    overflow-x: hidden; /* prevent unwanted horizontal overflow ("orange" edge) */
}

/* ========================================
   CONTAINER & LAYOUT
   ======================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-inner {
    background: var(--bg-primary);
    min-height: calc(100vh - 400px);
}

/* ========================================
   HEADER
   ======================================== */
.header {
    background: var(--bg-primary);
    border-bottom: 2px solid var(--border-color);
    padding: 15px 0;
    margin-bottom: 0;
}

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

.brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent-red);
    letter-spacing: -1px;
}

.site-title {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.header-actions {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.header-actions a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.header-actions a:hover {
    background: var(--bg-secondary);
    color: var(--accent-red);
}

/* ========================================
   TABS & NAVIGATION
   ======================================== */
.tabs {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
}

.tabs-list {
    display: flex !important;
    flex-wrap: wrap;
    gap: 5px;
    padding: 15px 0;
    justify-content: center;
}

.tabs-list a,
.current-tab {
    padding: 8px 16px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tabs-list a:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.tabs-list a.active {
    background: var(--accent-red);
    color: white;
}

/* ========================================
   FORMS & INPUTS
   ======================================== */
.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="file"]:focus,
textarea:focus,
select:focus,
.input:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

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

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.checkbox input {
    width: auto;
    margin: 0;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn-action {
    display: inline-block;
    padding: 12px 20px;
    background: var(--accent-red);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-action:hover {
    background: var(--accent-red-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(196, 30, 58, 0.2);
}

.btn-action:active {
    transform: translateY(0);
}

button[type="submit"] {
    cursor: pointer;
}

/* ========================================
   PANELS & CARDS
   ======================================== */
.panel {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
}

.sep {
    height: 1px;
    background: var(--border-color);
    margin: 15px 0;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-weight: 700;
}

h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 16px; }

p {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

a {
    color: var(--accent-red);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.small {
    font-size: 13px;
}

.muted {
    color: var(--text-muted);
}

/* ========================================
   ALERTS & MESSAGES
   ======================================== */
.alert {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-success {
    background: #e8f5e9;
    border-color: var(--success);
    color: #2e7d32;
}

.alert-error {
    background: #ffecec;
    border-color: #f5c2c2;
    color: #9b1b1b;
}

.alert-warning {
    background: #fff3e0;
    border-color: #ffe0b2;
    color: #e65100;
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    background: var(--bg-secondary);
    border-top: 2px solid var(--border-color);
    padding: 40px 0 20px;
    margin-top: 40px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-grid > div h4 {
    margin-bottom: 15px;
    font-size: 14px;
    color: var(--text-primary);
}

.footer-grid a {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.footer-grid a:hover {
    color: var(--accent-red);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
}

/* ========================================
   RESPONSIVE - MOBILE FIRST
   ======================================== */
@media (max-width: 768px) {
    /* Container & Layout */
    .container {
        padding: 0 15px !important;
        max-width: 100% !important;
    }

    .main-inner {
        padding: 20px 15px !important;
        min-height: auto !important;
    }

    /* Header */
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px !important;
        padding: 15px 0 !important;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px !important;
    }

    .header-actions a {
        font-size: 13px !important;
        padding: 10px 14px !important;
        flex: 1 1 auto;
        min-width: calc(50% - 4px);
    }

    /* Typography */
    h1 { font-size: 24px !important; }
    h2 { font-size: 20px !important; }
    h3 { font-size: 18px !important; }
    h4 { font-size: 16px !important; }

    /* Tabs */
    .tabs-list {
        padding: 10px 0;
        gap: 5px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    .tabs-list a,
    .current-tab {
        padding: 8px 14px;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Forms */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    input[type="file"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 14px 15px !important;
    }

    /* Buttons */
    .btn-action {
        width: 100% !important;
        padding: 14px 20px !important;
        font-size: 16px !important;
        min-height: 44px; /* Touch target */
    }

    button[type="submit"] {
        width: 100% !important;
        padding: 14px 20px !important;
        font-size: 16px !important;
        min-height: 44px;
    }

    /* Panels & Cards */
    .panel, .card {
        padding: 20px 15px !important;
        margin-bottom: 20px;
    }

    /* Row utility */
    .row {
        flex-direction: column !important;
        gap: 15px !important;
    }

    .row > * {
        width: 100% !important;
        flex: 1 1 100% !important;
    }

    /* Alerts */
    .alert {
        padding: 12px 15px !important;
        font-size: 14px !important;
    }

    /* Footer */
    .footer {
        padding: 30px 0 15px !important;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 25px !important;
    }

    /* Checkbox */
    .checkbox {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .checkbox label {
        font-size: 13px;
        line-height: 1.5;
    }
}

@media (max-width: 480px) {
    /* Container */
    .container {
        padding: 0 12px !important;
    }

    .main-inner {
        padding: 15px 12px !important;
    }

    /* Header */
    .logo {
        font-size: 20px !important;
    }

    .site-title {
        display: none !important;
    }

    .header-actions {
        flex-direction: column;
        gap: 8px !important;
    }

    .header-actions a {
        width: 100% !important;
        min-width: 100% !important;
        justify-content: center;
        padding: 12px 16px !important;
    }

    .header-actions a span {
        display: inline !important;
    }

    /* Typography */
    h1 { font-size: 22px !important; }
    h2 { font-size: 18px !important; }
    h3 { font-size: 16px !important; }
    h4 { font-size: 15px !important; }

    p, .small {
        font-size: 14px !important;
    }

    /* Tabs */
    .tabs-list {
        padding: 8px 0;
        gap: 4px;
    }

    .tabs-list a,
    .current-tab {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Forms */
    label {
        font-size: 13px !important;
        margin-bottom: 8px !important;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    input[type="file"],
    textarea,
    select {
        padding: 12px 14px !important;
        font-size: 16px !important;
    }

    /* Buttons */
    .btn-action,
    button[type="submit"] {
        padding: 14px 18px !important;
        font-size: 15px !important;
    }

    /* Panels & Cards */
    .panel, .card {
        padding: 15px 12px !important;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .footer-bottom {
        font-size: 11px !important;
        padding-top: 15px !important;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .main-inner {
        padding: 15px 20px !important;
    }

    .panel, .card {
        max-height: 85vh;
        overflow-y: auto;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    a, button, .btn-action, input[type="submit"], input[type="button"] {
        -webkit-tap-highlight-color: rgba(196, 30, 58, 0.2);
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    input, select, textarea {
        -webkit-tap-highlight-color: rgba(196, 30, 58, 0.1);
    }
}

/* Prevent zoom on input focus (iOS Safari) */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select,
    textarea,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="date"],
    input[type="password"],
    input[type="number"] {
        font-size: 16px !important;
    }
}

/* ========================================
   UTILITIES
   ======================================== */
.row {
    display: flex;
}

.link-muted {
    color: var(--text-secondary);
    font-size: 13px;
}

.link-muted:hover {
    color: var(--accent-red);
    text-decoration: underline;
}

/* ========================================
   GLOBAL MOBILE UTILITIES
   ======================================== */
/* Grid layouts become single column on mobile */
@media (max-width: 768px) {
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    [style*="display: grid"] {
        gap: 20px !important;
    }
    
    /* Flex rows become columns */
    [style*="display: flex"][style*="flex-wrap"] {
        flex-wrap: wrap !important;
    }
    
    /* Full width buttons on mobile */
    button:not([style*="width"]):not(.no-full-width),
    .btn-action:not([style*="width"]) {
        width: 100% !important;
    }
    
    /* Images responsive */
    img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Tables scroll on mobile */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }
    
    /* Better spacing for forms */
    form {
        width: 100%;
    }
    
    form > * {
        margin-bottom: 15px;
    }
}

/* ======================================================
   MOBILE NAV UX ENHANCEMENT (ADD-ON ONLY)
   Safe to append – does NOT override existing desktop UI
   ====================================================== */

/* Mobile-only navbar polish */
@media (max-width: 768px) {

  /* Slide-in menu feels native & premium */
  .header-menu {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: menuSlideIn 0.35s ease;
  }

  @keyframes menuSlideIn {
    from {
      transform: translateX(100%);
      opacity: 0.6;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }

  /* Section separators for clarity (dummy-friendly) */
  .header-menu::before {
    content: "Menu";
    padding: 16px 24px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  /* Bigger, clearer tap targets */
  .menu-item {
    font-size: 15px;
    min-height: 52px;
  }

  .menu-item i {
    font-size: 18px;
    width: 22px;
    text-align: center;
  }

  /* Logged-in priority items stand out */
  .menu-item-primary,
  .menu-item-gold,
  .menu-item-credits {
    margin: 6px 12px;
    border-radius: 10px;
  }

  /* Credits = wallet-style emphasis */
  .menu-item-credits {
    display: flex;
    justify-content: space-between;
    padding-right: 20px;
  }

  /* Chat badge more visible on mobile */
  .menu-badge {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
  }

  /* Bottom safe spacing */
  .header-menu {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Hamburger feedback improvement */
@media (max-width: 768px) {
  .header-hamburger:active {
    transform: scale(0.95) !important;
  }
}
