/* ================================================================
1. VARIABLEN & DESIGN-TOKENS
================================================================ */
:root {
  /* Hintergrund-Farben (Light Mode) */
  --bg-main: #f8f9fa;
  --bg-dark: #1a1a1a;
  --bg-mid: #2d2d2d;
  --bg-light: #404040;
  --bg-hover: #555555;
  --bg-trans: rgba(248, 249, 250, 0.92);
  
  /* UI-Element Hintergründe */
  --card-bg: #ffffff;
  --card-content-bg: #fafafa;
  --input-bg: #ffffff;
  --table-header-bg: #f1f3f5;
  --disabled-bg: #f1f3f5;
  --progress-bg: #e0e0e0;
  
  /* Text-Farben */
  --text-primary: #212529;
  --text-muted: #6c757d;
  --text-light: #ffffff;
  --text-dark: #121212;
  --text-silver: #adb5bd;
  
  /* Status-Farben */
  --success: #28a745;
  --success-bg: #e8f5e9;
  --success-text: #1b5e20;
  
  --error: #dc3545;
  --error-bg: #ffebee;
  --error-text: #c62828;
  
  --warning: #ffc107;
  --warning-bg: #ffeeba;
  --warning-light: #fff3cd;
  --warning-text: #856404;
  
  --accent: #007bff;
  --accent-action: #d32f2f;

  /* Struktur */
  --border-light: #dee2e6;
  --divider-white: rgba(255, 255, 255, 0.1);
  --divider-grey: #dee2e6;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  
  --container-width: 900px;
  --header-height: 56px;
}

/* ================================================================
1.5 OVERRIDE FÜR DARK MODE
================================================================ */
html[data-theme="dark"] {
  /* Hintergründe */
  --bg-main: #121212;
  --bg-dark: #000000;
  --bg-trans: rgba(18, 18, 18, 0.92);
  
  /* UI-Elemente */
  --card-bg: #1e1e1e;
  --card-content-bg: #181818;
  --input-bg: #2d2d2d;
  --table-header-bg: #2d2d2d;
  --disabled-bg: #222222;
  --progress-bg: #333333;
  
  /* Text-Farben */
  --text-primary: #e0e0e0;
  --text-muted: #a0a0a0;
  --text-dark: #ffffff;
  --warning-text: #1f1804;
  
  /* Rahmen */
  --border-light: #333333;
  --divider-white: #333333;
  --divider-grey: #dee2e652;

  /* Status-Hintergründe */
  --success-bg: rgba(40, 167, 69, 0.15);
  --success-text: #81c784;
  --error-bg: rgba(220, 53, 69, 0.15);
  --error-text: #e57373;
  --warning-light: #81744e;
  --warning-bg: #ffffff3f;

}

/* ================================================================
2. BASIS & RESET
================================================================ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  scroll-behavior: smooth;
}

a { color: inherit; text-decoration: none; transition: opacity 0.2s; }

h1, h2, h3, h4 { margin: 0.5em 0; color: var(--text-muted); }

/* ================================================================
3. LAYOUT-KOMPONENTEN
================================================================ */
.container { max-width: var(--container-width); margin: 0 auto; padding: 10px 15px; }
.container-narrow { max-width: 800px; margin: 0 auto; }

.main-content {
  padding-top: calc(var(--header-height) + 10px);
  padding-bottom: 120px;
  min-height: 100vh;
}

/* Grids */
.grid-auto { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
  gap: 5px;
}

.grid-2 { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
  gap: 20px; 
}

.grid-types {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

/* ================================================================
4. NAVIGATION & HEADER
================================================================ */
header {
  position: fixed; top: 0; left: 0; right: 0;
  background: var(--bg-dark); color: white;
  height: var(--header-height); z-index: 2000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

header.admin-warning { background-color: var(--error) !important; }

.header-inner {
  max-width: var(--container-width); margin: 0 auto;
  height: 100%; display: flex; align-items: center; padding: 0 15px; gap: 15px;
}

header .page-title { font-weight: 700; font-size: 1.1em; flex-grow: 1; }

.menu-toggle { background: none; border: none; color: white; font-size: 24px; cursor: pointer; }

.notification-dot {
  position: absolute;
  top: 5px;
  right: -2px;
  width: 10px;
  height: 10px;
  background-color: var(--warning);
  border-radius: 50%;
  border: 2px solid var(--bg-dark);
  animation: pulse-dot 2s infinite;
}

.main-nav {
  position: fixed; top: var(--header-height); left: 0; right: 0; bottom: 0;
  background: var(--bg-mid); z-index: 1900;
  display: none; flex-direction: column; padding: 20px; overflow-y: auto;
}

body.nav-open .main-nav { display: flex; animation: slideDown 0.3s ease-out; }

.main-nav a { padding: 15px; color: white; font-size: 1.1em; border-bottom: 1px solid var(--divider-white); border-radius: var(--radius-md); }
.main-nav a.active { background: var(--bg-hover); border-left: 4px solid var(--success); padding-left: 11px; font-weight: 700; }

.nav-divider { display: block; height: 1px; background: var(--divider-white); margin: 10px 15px; }
.logout-link { color: var(--error-text) !important; margin-top: auto; font-weight: 700; }

/* ================================================================
5. UI-ELEMENTE (KARTEN, BUTTONS, ALERTS)
================================================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  margin-bottom: 5px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  border: 1px solid var(--border-light);
  padding: 20px;
}

/* Alert Banner */
.alert { padding: 15px; border-radius: var(--radius-md); margin-bottom: 20px; border-left: 5px solid transparent; font-weight: 500; }
.alert-success { background: var(--success-bg); color: var(--success-text); border-color: var(--success); }
.alert-error { background: var(--error-bg); color: var(--error-text); border-color: var(--error); }
.alert-warning { background: var(--warning-light); color: var(--warning-text); border-color: var(--warning-bg); }

/* Buttons */
.btn {
  background: var(--bg-mid); color: var(--text-light); border: none; padding: 10px 20px;
  border-radius: var(--radius-md); cursor: pointer; font-weight: 600;
  transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { background: var(--bg-hover); transform: translateY(-1px); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: var(--error); }
.btn-success { background: var(--success); }
.btn-info { background: #17a2b8; }
.btn-outline { background: transparent; border: 1px solid var(--border-light); color: var(--text-primary); }

/* Badges */
.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.badge-admin { background: var(--error-bg); color: var(--error-text); border: 1px solid rgba(198, 40, 40, 0.2); }
.badge-user { background: var(--success-bg); color: var(--success-text); border: 1px solid rgba(40, 167, 69, 0.2); }
.badge-guest { background: var(--bg-main); color: var(--text-muted); border: 1px solid var(--border-light); }
.badge-pending { background: var(--warning-light); color: #2e2200; border: 1px solid rgba(255, 193, 7, 0.2); }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-muted { background: var(--border-light); color: var(--text-muted); }
.badge-outline { background: var(--bg-main); border: 1px solid var(--border-light); color: var(--text-primary); font-size: 10px; padding: 2px 8px; border-radius: 4px; }

/* ================================================================
6. FORMULARE & INPUTS
================================================================ */
.form-group { margin-bottom: 15px; }
.form-label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9em; color: var(--text-dark); }

.form-control {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); font-size: 16px; background: var(--card-bg); color: var(--text-primary);
}

.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,123,255,0.1); }

.checkbox-card {
  display: flex; align-items: center; gap: 10px; background: var(--bg-main);
  padding: 10px 15px; border-radius: var(--radius-md); border: 1px solid var(--border-light);
  cursor: pointer; font-weight: 600; font-size: 0.9em; transition: all 0.2s;
}
.checkbox-card:hover { border-color: var(--bg-hover); }
.checkbox-card input { margin: 0; width: 18px; height: 18px; cursor: pointer; }
.checkbox-card:has(input:checked) { background: var(--success-bg); border-color: var(--success); color: var(--success-text); }

/* ================================================================
7. POKÉDEX SPEZIAL (DEX.PHP)
================================================================ */
.dex-card { padding: 0; overflow: hidden; }

.card-header { padding: 2px 15px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.card-content { padding: 12px 15px; border-top: 1px solid var(--border-light); background: (--card-content-bg); }

#cards-container.filter-hide-complete .is-complete { display: none !important; }
#cards-container.filter-hide-unreleased .not-released { display: none !important; }

.collapsed .card-content { display: none; }
.is-complete { border-left: 6px solid var(--success); background: linear-gradient(to right, var(--success-bg), var(--card-bg)) !important; }
.not-released { background: var(--disabled-bg) !important; opacity: 0.7; }

.dex-num { font-family: monospace; font-size: 0.85em; color: var(--text-muted); margin-right: 12px; }
.type-icons-wrapper { min-width: 90px; display: inline-flex; gap: 6px; margin-right: 18px; }
.pokemon-name { font-weight: 700; font-size: 1.05em; color: var(--text-dark); }

.type-pill {
  width: 40px; height: 18px; border-radius: 4px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 10px;
  font-weight: 800; color: #fff; text-transform: uppercase;
}

.type-1 { background: #A8A77A; } .type-2 { background: #E2BF65; }
.type-3 { background: #6F35FC; } .type-4 { background: #96D9D6; }
.type-5 { background: #F7D02C; } .type-6 { background: #D685AD; }
.type-7 { background: #EE8130; } .type-8 { background: #A98FF3; }
.type-9 { background: #B6A136; } .type-10 { background: #735797; }
.type-11 { background: #A33EA1; } .type-12 { background: #A6B91A; }
.type-13 { background: #C22E28; } .type-14 { background: #7AC74C; }
.type-15 { background: #F95587; } .type-16 { background: #B7B7CE; }
.type-17 { background: #705746; } .type-18 { background: #6390F0; }

.progress-text { font-size: 11px; background: rgba(0,0,0,0.05); padding: 2px 8px; border-radius: 20px; font-weight: 800; color: var(--text-muted); }

.flags, .variant-flags { display: grid; grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); gap: 8px; }
.dexcards label { font-size: 12px; display: flex; align-items: center; gap: 5px; padding: 6px; background: var(--card-bg); border: 1px solid var(--border-light); border-radius: 6px; cursor: pointer; }
.dexcards label:has(input:checked) { background: var(--success-bg); border-color: var(--success); color: var(--success-dark); font-weight: bold; }
.needs-action { border-color: var(--accent-action) !important; color: var(--accent-action); font-weight: bold; animation: pulse-border 2s infinite; }

.circular-progress {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: conic-gradient(#4caf50 calc(var(--progress) * 1%), var(--progress-bg) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.circular-progress::before {
    content: "";
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--bg-main);
}

.progress-value {
    position: relative;
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--text-primary);
}

.progress-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

#global-progress-ring {
    cursor: pointer;
    transition: transform 0.2s ease;
}

#global-progress-ring:hover {
    transform: scale(1.05);
}

.progress-details {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 12px;
    padding: 12px;
    width: 240px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    background: 
        linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
        linear-gradient(135deg, var(--success), var(--accent)) border-box;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.progress-details::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 15px;
    width: 10px;
    height: 10px;
    background: var(--card-bg);
    border-top: 2px solid var(--success);
    border-left: 2px solid var(--success);
    transform: rotate(45deg);
}

.progress-detail-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--divider-grey);
    padding-bottom: 4px;
}

.progress-detail-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.progress-detail-val {
    font-weight: bold;
    font-family: monospace;
}

/* ================================================================
8. STICKY UI & SUCHE
================================================================ */
.dex-filters { position: sticky; top: var(--header-height); background: var(--bg-trans); backdrop-filter: blur(10px); padding: 10px; z-index: 1000; display: flex; justify-content: center; gap: 15px; border-bottom: 1px solid var(--border-light); }

.search-container { position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-trans); backdrop-filter: blur(15px); padding: 12px; border-top: 1px solid var(--border-light); z-index: 1500; }

.search-inner { max-width: var(--container-width); margin: 0 auto; display: flex; justify-content: center; align-items: center; gap: 10px; }

.search-wrapper { position: relative; flex: 1; max-width: 450px; }

#pokemon-search { color: var(--text-primary); background: var(--card-bg); padding: 10px 40px 10px 12px !important; width: 100%; border: 1px solid var(--border-light); border-radius: var(--radius-md); background: var(--input-bg); font-size: 16px; outline: none; }

#pokemon-search::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

.search-clear, .search-clear-btn { 
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  cursor: pointer; color: var(--text-muted); font-size: 1.2rem; line-height: 1; z-index: 10; padding: 5px; user-select: none;
}

/* ================================================================
9. SUCH-STRINGS (SEARCH.PHP)
================================================================ */
.search-string-wrapper { width: 100%; }

.clickable-input {
  width: 100% !important; padding: 10px; border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  background: var(--input-bg); color: var(--text-dark); cursor: pointer; text-align: left; font-family: monospace;
  font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.clickable-input.copy-success { background: var(--success-bg) !important; border-color: var(--success) !important; color: var(--success-text) !important; }

/* ================================================================
10. TABELLEN & ADMIN
================================================================ */
.table-responsive { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border-light); }
.table { width: 100%; border-collapse: collapse; background: var(--card-bg); }
.table th, .table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--border-light); }
.table th { background: var(--table-header-bg); font-size: 12px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; }

.col-id { width: 70px; color: var(--text-muted); font-family: monospace; }
.text-mono { font-family: monospace !important; }

/* ================================================================
11. ANLEITUNGEN & LISTEN (STEP-LIST)
================================================================ */
.step-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 15px 0;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  background: var(--card-bg);
  padding: 15px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.step-number {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--card-bg);
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
}

.step-number-warning {
  background: var(--warning);
  color: #856404;
}

.step-number-success {
  background: var(--success);
  color: var(--card-bg);
}

.step-content {
  flex: 1;
  font-size: 0.95em;
  line-height: 1.5;
  color: var(--text-dark);
  padding-top: 4px;
}

/* ================================================================
12. UTILITIES & ANIMATIONEN
================================================================ */
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-xs { font-size: 0.75rem !important; }
.font-bold { font-weight: 700 !important; }
.text-muted { color: var(--text-muted) !important; }
.mb-20 { margin-bottom: 20px !important; }
.mt-10 { margin-top: 10px !important; }
.m-0 { margin: 0 !important; }
.p-0 { padding: 0 !important; }
.w-full { width: 100% !important; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-wrap { display: flex; flex-wrap: wrap; gap: 10px; }
.items-center { align-items: center; }

@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pulse-border { 0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); } 70% { box-shadow: 0 0 0 5px rgba(220, 53, 69, 0); } 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.saved { background-color: var(--success-bg) !important; transition: background 0.5s; }
.highlight { border: 2px solid var(--accent) !important; animation: flash 2s; }
@keyframes flash { 0%, 100% { background: transparent; } 50% { background: var(--warning-light); } }

.list-end-spacer { height: 20px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.9em; font-style: italic; }
.main-footer { text-align: center; padding: 40px 15px; font-size: 13px; color: var(--text-muted); border-top: 1px solid var(--border-light); margin-top: 20px; }

/* ================================================================
   THEME TOGGLE BUTTON (HEADER)
================================================================ */
.theme-toggle {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 5px;
    display: block;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    user-select: none;
}

/* Feedback-Effekt beim Antippen/Hovern */
.theme-toggle:hover, .theme-toggle:active {
    transform: scale(1.15);
}