/* ============================================
   ARC Raiders Wiki DE — Gemeinsame Styles
   ============================================ */

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

:root {
    --primary: #f97316;
    --primary-dark: #ea580c;
    --primary-glow: rgba(249,115,22,0.15);
    --accent: #06b6d4;
    --accent-glow: rgba(6,182,212,0.1);
    --bg: #09090b;
    --bg-2: #0f0f12;
    --bg-3: #16161a;
    --bg-card: rgba(255,255,255,0.03);
    --text: #f0f0f0;
    --text-2: #8b8b9e;
    --text-3: #52525e;
    --border: rgba(255,255,255,0.06);
    --border-hover: rgba(249,115,22,0.3);
    --spp: #ff4444;
    --sp: #ff6b35;
    --s: #f97316;
    --a: #22c55e;
    --b: #3b82f6;
    --c: #8b5cf6;
    --d: #6b7280;
    --green: #22c55e;
    --red: #ef4444;
    --blue: #3b82f6;
    --purple: #a855f7;
}

/* LIGHT MODE */
[data-theme="light"] {
    --bg: #f5f5f7;
    --bg-2: #e8e8ec;
    --bg-3: #d4d4d8;
    --bg-card: rgba(0,0,0,0.03);
    --text: #18181b;
    --text-2: #52525b;
    --text-3: #a1a1aa;
    --border: rgba(0,0,0,0.08);
    --border-hover: rgba(249,115,22,0.4);
}

html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); overflow-x: hidden; }

/* GRID BACKGROUND */
.grid-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none;
    background-image: linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
}
[data-theme="light"] .grid-bg {
    background-image: linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
}

/* ========== NAVIGATION ========== */
nav {
    position: fixed; top: 0; width: 100%; z-index: 100;
    background: rgba(9,9,11,0.85); backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 24px; height: 64px;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
[data-theme="light"] nav { background: rgba(245,245,247,0.9); }

.logo { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 1.4rem; text-decoration: none; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-icon { background: var(--primary); color: #000; padding: 4px 8px; border-radius: 6px; font-weight: 900; font-size: 0.85rem; letter-spacing: 1px; }
.logo-text { color: var(--text); }
.logo-text span { color: var(--primary); }

/* Nav dropdown groups */
.nav-links { display: flex; gap: 4px; list-style: none; align-items: center; }
.nav-links > li { position: relative; }
.nav-links > li > a, .nav-group-title {
    color: var(--text-2); text-decoration: none; font-size: 0.85rem; font-weight: 500;
    padding: 8px 12px; border-radius: 8px; transition: all 0.2s; cursor: pointer;
    display: flex; align-items: center; gap: 4px; white-space: nowrap;
    background: none; border: none; font-family: inherit;
}
.nav-links > li > a:hover, .nav-group-title:hover { color: var(--text); background: rgba(255,255,255,0.05); }
[data-theme="light"] .nav-links > li > a:hover, [data-theme="light"] .nav-group-title:hover { background: rgba(0,0,0,0.05); }
.nav-links a.active { color: var(--primary); background: var(--primary-glow); }

.nav-group-title::after { content: '▾'; font-size: 0.7rem; margin-left: 2px; }
.nav-dropdown {
    display: none; position: absolute; top: 100%; left: 0; min-width: 200px;
    background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
    padding: 8px; margin-top: 4px; box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 200;
}
[data-theme="light"] .nav-dropdown { background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.nav-links > li.dropdown-open .nav-dropdown { display: block; }
.nav-dropdown a {
    display: block; color: var(--text-2); text-decoration: none; font-size: 0.85rem;
    padding: 8px 12px; border-radius: 6px; transition: all 0.2s;
}
.nav-dropdown a:hover { color: var(--text); background: rgba(255,255,255,0.05); }
[data-theme="light"] .nav-dropdown a:hover { background: rgba(0,0,0,0.05); }

/* Nav right area */
.nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Search */
.nav-search-wrapper { position: relative; }
.nav-search {
    background: var(--bg-3); border: 1px solid var(--border); border-radius: 10px;
    padding: 8px 16px 8px 36px; color: var(--text); font-size: 0.85rem; width: 220px;
    outline: none; transition: all 0.3s; font-family: inherit;
}
[data-theme="light"] .nav-search { background: #fff; }
.nav-search:focus { border-color: var(--primary); width: 280px; }
.nav-search::placeholder { color: var(--text-3); }
.nav-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 0.85rem; pointer-events: none; }
.search-results {
    display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
    max-height: 400px; overflow-y: auto; z-index: 300; box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
[data-theme="light"] .search-results { background: #fff; }
.search-results.active { display: block; }
.search-result-item {
    display: block; padding: 12px 16px; text-decoration: none; color: var(--text);
    border-bottom: 1px solid var(--border); transition: background 0.2s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: rgba(255,255,255,0.05); }
[data-theme="light"] .search-result-item:hover { background: rgba(0,0,0,0.03); }
.search-result-item .sr-title { font-weight: 600; font-size: 0.9rem; }
.search-result-item .sr-desc { color: var(--text-2); font-size: 0.8rem; margin-top: 2px; }
.search-no-results { padding: 16px; color: var(--text-2); text-align: center; font-size: 0.85rem; }

/* Theme toggle */
.theme-toggle {
    background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px;
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1.1rem; transition: all 0.3s; color: var(--text);
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* Mobile nav */
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; z-index: 300; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--text); margin: 5px 0; transition: all 0.3s; border-radius: 2px; }

/* ========== COMMON PAGE ELEMENTS ========== */
.page-header { padding: 120px 40px 60px; text-align: center; position: relative; z-index: 1; }
.page-header h1 { font-family: 'Rajdhani', sans-serif; font-size: 3rem; text-transform: uppercase; margin-bottom: 12px; }
.page-header h1 em { font-style: normal; color: var(--primary); }
.page-header p { color: var(--text-2); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }
.page-header .update { display: inline-block; margin-top: 16px; padding: 6px 16px; background: var(--primary-glow); border-radius: 8px; font-size: 0.8rem; color: var(--primary); font-weight: 600; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 40px 100px; position: relative; z-index: 1; }
section { padding: 100px 40px; position: relative; z-index: 1; }
.section-tag { text-transform: uppercase; letter-spacing: 3px; font-size: 0.75rem; color: var(--primary); font-weight: 600; margin-bottom: 12px; }
.section-title { font-family: 'Rajdhani', sans-serif; font-size: 2.5rem; font-weight: 700; margin-bottom: 50px; text-transform: uppercase; }

/* BUTTONS */
.btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 14px 28px;
    border-radius: 10px; font-weight: 600; text-decoration: none;
    font-size: 0.95rem; transition: all 0.3s; border: none; cursor: pointer; font-family: inherit;
}
.btn-primary { background: var(--primary); color: #000; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 8px 30px rgba(249,115,22,0.3); transform: translateY(-2px); }
.btn-ghost { border: 1px solid var(--border); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; border-radius: 8px; }

/* CARDS */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.cat-card {
    background: var(--bg-2); border: 1px solid var(--border); border-radius: 16px;
    padding: 32px; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); cursor: pointer; text-decoration: none; color: inherit;
    position: relative; overflow: hidden;
}
.cat-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent)); opacity: 0; transition: opacity 0.3s;
}
.cat-card:hover { border-color: var(--border-hover); transform: translateY(-6px) scale(1.02); box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.cat-card:hover::before { opacity: 1; }
.cat-icon { font-size: 2.5rem; margin-bottom: 16px; }
.cat-card h3 { font-family: 'Rajdhani', sans-serif; font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; text-transform: uppercase; }
.cat-card p { color: var(--text-2); font-size: 0.9rem; line-height: 1.6; }
.cat-count { display: inline-block; margin-top: 16px; padding: 4px 12px; background: var(--primary-glow); border-radius: 6px; font-size: 0.8rem; color: var(--primary); font-weight: 600; }

/* FOOTER */
footer {
    background: var(--bg-2); padding: 60px 40px 30px;
    border-top: 1px solid var(--border); position: relative; z-index: 1;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; max-width: 1200px; margin: 0 auto 40px; }
.footer-brand p { color: var(--text-2); font-size: 0.9rem; line-height: 1.6; margin-top: 16px; }
.footer-col h4 { font-family: 'Rajdhani', sans-serif; font-size: 1rem; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 16px; color: var(--primary); }
.footer-col a { display: block; color: var(--text-2); text-decoration: none; font-size: 0.9rem; padding: 4px 0; transition: color 0.2s; }
.footer-col a:hover { color: var(--text); }
.footer-bottom { text-align: center; padding-top: 30px; border-top: 1px solid var(--border); }
.footer-bottom p { color: var(--text-3); font-size: 0.8rem; }

/* NAV GLOW ANIMATION */
.nav-glow { animation: navGlow 2s ease-in-out infinite; }
@keyframes navGlow {
    0%, 100% { color: var(--text-2); text-shadow: none; }
    50% { color: #f97316; text-shadow: 0 0 8px rgba(249,115,22,0.5), 0 0 20px rgba(249,115,22,0.2); }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .nav-links > li > .nav-group-title { font-size: 0.8rem; padding: 6px 8px; }
    .nav-links > li > a { font-size: 0.8rem; padding: 6px 8px; }
}

@media (max-width: 768px) {
    nav { padding: 0 16px; }
    .nav-toggle { display: block; }
    .nav-links {
        display: none !important; position: fixed; top: 64px; left: 0; right: 0; bottom: 0;
        background: rgba(9,9,11,0.98); backdrop-filter: blur(20px);
        flex-direction: column; padding: 16px; gap: 4px;
        border-bottom: 1px solid var(--border); z-index: 250;
        overflow-y: auto;
    }
    [data-theme="light"] .nav-links { background: rgba(245,245,247,0.98); }
    .nav-links.open { display: flex !important; }
    .nav-dropdown { position: static; display: block; box-shadow: none; margin-top: 0; padding-left: 16px; border: none; background: transparent; }
    .nav-group-title::after { content: ''; }
    .nav-search { width: 160px; }
    .nav-search:focus { width: 200px; }
    .page-header { padding: 100px 20px 40px; }
    .page-header h1 { font-size: 2rem; }
    section { padding: 60px 20px; }
    .container { padding: 0 20px 60px; }
    .cat-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; gap: 20px; }
    .section-title { font-size: 2rem; }
}

@media (max-width: 480px) {
    .nav-search { width: 120px; font-size: 0.8rem; }
    .nav-search:focus { width: 160px; }
    .page-header { padding: 80px 16px 30px; }
    .page-header h1 { font-size: 1.5rem; }
    .page-header p { font-size: 0.9rem; }
    .container { padding: 0 12px 40px; }
    section { padding: 40px 12px; }
    .section-title { font-size: 1.5rem; }
}

/* ========== MOBILE-FIRST OPTIMIERUNG ========== */

/* Touch-Targets: Mindestens 44px */
@media (max-width: 768px) {
    .nav-dropdown a { padding: 12px 16px; min-height: 44px; display: flex; align-items: center; font-size: 0.95rem; }
    .nav-group-title { min-height: 44px; }
    button, .btn, input[type="submit"], select { min-height: 44px; font-size: 1rem; }
    input[type="text"], input[type="number"], input[type="email"], input[type="url"], textarea, select {
        font-size: 16px !important; /* Verhindert iOS auto-zoom */
    }
}

/* Tabellen mobil scrollbar */
@media (max-width: 768px) {
    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
    th, td { padding: 8px 12px; font-size: 0.85rem; }
}

/* Cards: 1 Spalte auf Handy */
@media (max-width: 768px) {
    .weapon-grid, .armor-grid, .item-grid, .boss-grid, .map-grid, .loot-grid,
    [class*="-grid"] { grid-template-columns: 1fr !important; }
}

/* Tablet: 2 Spalten */
@media (min-width: 769px) and (max-width: 1024px) {
    .weapon-grid, .armor-grid, .item-grid, .boss-grid, .map-grid, .loot-grid,
    [class*="-grid"] { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Bilder responsive */
img, video, canvas, svg { max-width: 100%; height: auto; }

/* Horizontal Scroll verhindern */
html, body { overflow-x: hidden; }

/* Safe Area für iPhone Notch */
@supports (padding: env(safe-area-inset-bottom)) {
    footer { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
    nav { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
}

/* Tap Highlight entfernen */
* { -webkit-tap-highlight-color: transparent; }

/* Scroll-Verhalten smooth */
@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
