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

:root {
  --bg:       #0A0E1A;
  --bg2:      #111827;
  --card:     #141E32;
  --border:   rgba(255,255,255,.08);
  --accent:   #4da3ff;
  --green:    #00ff99;
  --red:      #ff4d7a;
  --text:     #e2e8f0;
  --muted:    #8899aa;
  --radius:   12px;
  --shadow:   0 8px 32px rgba(0,0,0,.4);
}

html { scroll-behavior:smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg) 0%, #1a1f3a 100%);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 80px;
}

/* ═══════════════════════════════════════
   INFO BUTTON (fixed)
═══════════════════════════════════════ */
#btnInfo {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 9000;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: rgba(20,30,55,.95);
  color: var(--accent);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
  transition: background .2s, color .2s, transform .15s;
}
#btnInfo:hover { background: var(--accent); color: #fff; transform: scale(1.08); }

/* ═══════════════════════════════════════
   INFO MODAL
═══════════════════════════════════════ */
#infoOverlay {
  display: none;
  position: fixed; inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(5px);
  align-items: center; justify-content: center;
  padding: 16px;
}
#infoOverlay.open { display: flex; }

#infoModal {
  background: linear-gradient(135deg, #0d1525 0%, #1a2540 100%);
  border: 1px solid rgba(77,163,255,.25);
  border-radius: 16px;
  max-width: 780px; width: 100%;
  max-height: 88vh; overflow-y: auto;
  padding: 28px 32px 32px;
  box-shadow: 0 24px 64px rgba(0,0,0,.7);
  position: relative;
}

#infoHeader {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}

#infoLangBtns { display: flex; gap: 8px; }

.lang-btn {
  padding: 6px 16px;
  border-radius: 6px;
  border: 2px solid rgba(77,163,255,.4);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-weight: 700; font-size: .85rem;
  transition: all .2s;
}
.lang-btn.active,
.lang-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

#infoBtnClose {
  background: rgba(255,255,255,.08);
  border: none; color: var(--text);
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer; font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
#infoBtnClose:hover { background: rgba(255,80,80,.25); }

#infoContent { color: #cdd; line-height: 1.7; }
#infoContent h2 { color: var(--green); font-size: 1.5rem; margin-bottom: 4px; }
#infoContent h3 { color: var(--accent); font-size: 1rem; margin: 18px 0 8px; }
#infoContent p  { margin-bottom: 8px; }
#infoContent ul, #infoContent ol { padding-left: 20px; }
#infoContent li { margin-bottom: 5px; }
#infoContent code {
  background: rgba(255,255,255,.08);
  padding: 2px 6px; border-radius: 4px;
  font-family: 'Courier New', monospace; font-size: .88em;
}
#infoContent kbd {
  background: rgba(255,255,255,.12);
  padding: 2px 7px; border-radius: 3px;
  font-family: 'Courier New', monospace; font-size: .88em;
}
#infoContent table { width: 100%; border-collapse: collapse; font-size: .9rem; }
#infoContent td    { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,.07); }
#infoContent .warn { color: #ffaa55; margin-top: 8px; font-size: .9rem; }

/* ═══════════════════════════════════════
   LAYOUT
═══════════════════════════════════════ */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px;
}

header { text-align: center; margin-bottom: 32px; }

h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  background: linear-gradient(135deg, var(--accent), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.subtitle {
  color: var(--muted);
  font-size: .9rem;
}
.subtitle a {
  color: var(--accent);
  text-decoration: none;
}
.subtitle a:hover { text-decoration: underline; }

.main-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
}
@media (max-width: 900px) {
  .main-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════
   CARD
═══════════════════════════════════════ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.section-title {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 0 10px;
}
.section-title:first-child { margin-top: 0; }

/* ═══════════════════════════════════════
   VIDEO PLAYER
═══════════════════════════════════════ */
.url-input-group { margin-bottom: 10px; }

.player-container { margin-bottom: 8px; }

.player-wrapper {
  position: relative;
  padding-bottom: 56.25%; height: 0;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.player-wrapper iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.player-wrapper .empty-state {
  position: absolute;
  inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; color: var(--muted);
}
.empty-message { font-size: .9rem; }

/* ═══════════════════════════════════════
   LOOP CONTROLS
═══════════════════════════════════════ */
.global-loop-controls {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.loop-badge {
  font-size: .8rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  max-width: 200px;
}
.loop-badge.looping {
  background: rgba(0,255,153,.1);
  border-color: var(--green);
  color: var(--green);
}

.loop-btns { display: flex; gap: 8px; }

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none; border-radius: 8px;
  font-size: .9rem; font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0066cc);
  color: #fff;
}
.btn-loop-control {
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: .85rem; padding: 7px 14px;
}
.btn-loop-control:hover { background: rgba(255,255,255,.13); }

.btn-capture {
  flex: 1;
  font-weight: 700;
}
.btn-start { background: linear-gradient(135deg, #00cc66, #009944); color: #fff; }
.btn-end   { background: linear-gradient(135deg, #ff4d7a, #cc1144); color: #fff; }

.btn-export {
  background: linear-gradient(135deg, #4a5568, #2d3748);
  color: #fff; font-size: .85rem;
}
.btn-export:hover { background: linear-gradient(135deg, #606880, #3d4758); }

.btn-zip {
  background: linear-gradient(135deg, #7c3aed, #5b21b6) !important;
}
.btn-zip:hover { background: linear-gradient(135deg, #8b5cf6, #6d28d9) !important; }

.btn.pressed { opacity: .7; transform: scale(.97); }

/* ═══════════════════════════════════════
   INPUTS
═══════════════════════════════════════ */
label {
  display: block;
  font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 5px;
}
input[type="text"],
input[type="number"] {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: .9rem;
  transition: border-color .2s;
}
input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(77,163,255,.07);
}
input::placeholder { color: rgba(136,153,170,.6); }

.input-group { margin-bottom: 12px; }
.time-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }

/* ═══════════════════════════════════════
   CURRENT TIME
═══════════════════════════════════════ */
.current-time-display {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(0,0,0,.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 10px;
}
.current-time-label { font-size: .75rem; color: var(--muted); }
.current-time-value {
  font-family: 'Courier New', monospace;
  font-size: 1.3rem; font-weight: 700;
  color: var(--green);
}

/* ═══════════════════════════════════════
   CAPTURE BUTTONS
═══════════════════════════════════════ */
.capture-buttons {
  display: flex; gap: 10px;
  margin-bottom: 12px;
}

/* ═══════════════════════════════════════
   KEYBOARD HINTS
═══════════════════════════════════════ */
.keyboard-hints {
  background: rgba(0,0,0,.2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-top: 16px;
}
.keyboard-hints-title {
  font-size: .75rem; font-weight: 700;
  color: var(--muted); margin-bottom: 8px;
}
.keyboard-hint {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 0;
  font-size: .82rem; color: rgba(200,210,220,.7);
}
kbd {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: 'Courier New', monospace;
  font-size: .8rem; color: var(--text);
}

/* ═══════════════════════════════════════
   LOOPS LIST
═══════════════════════════════════════ */
.loops-list { display: flex; flex-direction: column; gap: 8px; }

.loop-item {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all .2s;
}
.loop-item:hover { border-color: rgba(77,163,255,.35); background: rgba(77,163,255,.06); }
.loop-item.active {
  border-color: var(--green);
  background: rgba(0,255,153,.06);
}

.loop-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; gap: 8px;
}
.loop-name {
  font-weight: 700; font-size: .9rem;
  color: var(--green);
  cursor: pointer; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.loop-time {
  font-family: 'Courier New', monospace;
  font-size: .8rem; color: var(--muted);
  white-space: nowrap;
}
.loop-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.btn-icon {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: .78rem; cursor: pointer;
  transition: all .2s;
}
.btn-icon:hover { background: rgba(255,255,255,.13); border-color: rgba(255,255,255,.2); }
.btn-edit  { color: var(--accent); border-color: rgba(77,163,255,.3); }
.btn-delete { color: var(--red);  border-color: rgba(255,77,122,.3); }
.btn-delete:hover { background: rgba(255,77,122,.12); }

/* ═══════════════════════════════════════
   EXPORT SECTION
═══════════════════════════════════════ */
.export-title {
  font-size: .7rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 12px;
}

/* ═══════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════ */
.loops-list .empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  padding: 28px 0;
  color: var(--muted); text-align: center;
}

/* ═══════════════════════════════════════
   VIRTUELLE ON-SCREEN-BUTTONS
═══════════════════════════════════════ */
.virtual-container {
  position: fixed;
  bottom: 24px; right: 20px;
  z-index: 8000;
  display: flex; gap: 12px;
}
.virtual-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: none;
  font-size: 1.3rem; font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
  transition: all .15s;
  color: #fff;
}
.virtual-btn:active,
.virtual-btn.pressed { transform: scale(.88); opacity: .7; }
.virtual-btn.start { background: linear-gradient(135deg, #00cc66, #009944); }
.virtual-btn.end   { background: linear-gradient(135deg, #ff4d7a, #cc1144); }

/* ═══════════════════════════════════════
   SCROLLBAR
═══════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,.03); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.25); }

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 600px) {
  .capture-buttons { flex-direction: column; }
  .time-inputs { grid-template-columns: 1fr; }
  .loop-actions { gap: 4px; }
  .btn-icon { font-size: .72rem; padding: 4px 8px; }
}
