* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: 'Inter', sans-serif;
    background-color: #121212;
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 60px;
}
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: #1f1f1f;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
header h1 {
    font-size: 1.5rem;
}
.centered-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.big-login-btn {
    font-size: 1.2rem;
    padding: 1rem 2rem;
    background: #9146FF;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.login-btn {
    background-color: #9146ff;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}
.search-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80vh;
    color: white;
    text-align: center;
}

.search-wrapper h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #9146FF;
}

.search-box {
    display: flex;
    gap: 1rem;
}

.search-box input {
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border-radius: 8px;
    border: none;
    width: 300px;
    background-color: #2b2b2b;
    color: white;
}

.search-box input:focus {
    outline: 2px solid #9146FF;
}

.search-box button {
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    background-color: #9146FF;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
}

.search-box button:hover {
    background-color: #772ce8;
}
#userInfo {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 0.5rem;
    user-select: none;
}

#userInfo img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

#userDropdown {
    position: absolute;
    top: 120%;
    right: 0;
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    z-index: 1000;
    min-width: 160px;
    padding: 0.2rem 0;
}

#userDropdown a {
    padding: 0.6rem 1rem;
    color: #fff;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background-color 0.2s ease;
    display: block;
}

#userDropdown a:hover {
    background-color: #3e3e3e;
}

/* Container für Suchfeld + Buttons auf der Clipseite */
.clip-page-search {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Input für Streamername */
#clipsPageStreamerInput {
    flex-grow: 1;
    min-width: 180px;
    padding: 10px 15px;
    font-size: 1rem;
    border: 2px solid #444;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s ease;
    background-color: #1e1e1e;
    color: #eee;
}

#clipsPageStreamerInput:focus {
    outline: none;
    border-color: #9147ff;
    /* Twitch-Lila */
    background-color: #2b2b2b;
    color: #fff;
}

/* Buttons für Suchen und Zurück */
#backToSearchBtn,
#searchNewBtn {
    padding: 10px 20px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #fff;
    background-color: #9147ff;
    /* Twitch-Lila */
    transition: background-color 0.3s ease;
    user-select: none;
}

#backToSearchBtn:hover,
#searchNewBtn:hover {
    background-color: #772ce8;
}

/* Clipanzahl-Text */
#clipCountText {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: #aaa;
    margin-bottom: 15px;
}

main {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}
/* Einheitliche Größe für Filterinput und Select */
.filters input,
.filters select {
    padding: 0.75rem 1rem;
    /* etwas größer */
    border-radius: 6px;
    border: 1px solid #444;
    background-color: #1e1e1e;
    color: #ddd;
    min-width: 180px;
    /* etwas breiter */
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
}

/* Clipanzahl-Text über den Filtern */
#clipCountText {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    color: #bbb;
    margin-bottom: 12px;
    text-align: center;
    user-select: none;
}

/* Ladeanzeige im Clip-Grid (z.B. "Clips werden geladen...") mittig und größer */
#clipGrid.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 250px;
    font-size: 1.3rem;
    font-weight: 600;
    color: #9147ff;
    user-select: none;
    animation: pulse 1.2s ease-in-out infinite;
}

/* Optional: Beim Laden wird der ClipGrid-Container leer gemacht und mittig der Lade-Text angezeigt */
#clipGrid:not(.loading) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.clip-card {
    background: #1e1e2f;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.6);
    padding: 12px 16px;
    margin: 10px;
    width: 320px;
    color: #ddd;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.clip-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(120, 0, 255, 0.6);
}

.clip-card img {
    width: 100%;
    border-radius: 6px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.clip-card img:hover {
    border-color: #7a00ff;
}

.clip-card strong {
    font-size: 1.1rem;
    color: #a78eff;
    word-break: break-word;
}

.clip-card span {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #bbb;
}

.clip-info {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.clip-info span {
    background: #322f4c;
    padding: 3px 8px;
    border-radius: 16px;
    font-size: 0.85rem;
    color: #ddd;
    user-select: none;
}

/* Icons mit Emoji als Platzhalter */
.game-tag {
  display: flex;
  align-items: center;
  gap: 6px;
}

.game-tag img.game-icon {
  width: 20px;
  height: 27px;
  border-radius: 3px;
  object-fit: cover;
}

.download-btn {
    background: #7a00ff;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.download-btn:hover {
    background: #9a33ff;
}

/* Stats */
#clipsAndStats {
  display: flex;
  gap: 20px;
  padding: 20px;
  box-sizing: border-box;
  background-color: #181818;
  color: #e0e0e0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.clip-grid {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
}

#clipStats {
  background-color: rgba(30, 30, 30, 0.85);
  border-radius: 10px;
  padding: 15px 20px;
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
  user-select: none;
  font-size: 0.95rem;
  line-height: 1.4;
  width: 320px;
  position: sticky;
  top: 80px;
  align-self: flex-start;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #9146FF transparent;
}

/* Webkit Browsers (Chrome, Safari, Edge) */
#clipStats::-webkit-scrollbar {
  width: 8px;
}

#clipStats::-webkit-scrollbar-track {
  background: #2a2a2a;
  border-radius: 10px;
}

#clipStats::-webkit-scrollbar-thumb {
  background-color: #9146FF;
  border-radius: 10px;
  border: 2px solid #2a2a2a; /* Rand um den Scrollbalken für "eingelassenen" Effekt */
}

#clipStats::-webkit-scrollbar-thumb:hover {
  background-color: #772ce8;
}

#clipStats h2 {
  margin-top: 0;
  border-bottom: 2px solid #444;
  padding-bottom: 8px;
  font-size: 1.5rem;
}

.clip-stats-grid .stat-box {
  margin-bottom: 1rem;
  padding: 10px 15px;
  background-color: rgba(50, 50, 50, 0.6);
  border-radius: 6px;
  transition: background-color 0.3s ease;
}

.clip-stats-grid .stat-box:hover {
  background-color: rgba(70, 70, 70, 0.8);
}

.clip-stats-grid .stat-box h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: #f0f0f0;
}

.clip-stats-grid .stat-box ul {
  margin: 0;
  padding-left: 20px;
  list-style-type: disc;
  color: #ccc;
}

.clip-stats-grid .stat-box p {
  margin: 0;
  color: #ccc;
}

/* Mobile fallback */
@media (max-width: 900px) {
  #clipsAndStats {
    flex-direction: column;
  }
  #clipStats {
    position: relative;
    width: 100%;
    top: auto;
    margin-top: 20px;
  }
}

/* Clip Popup */
.clip-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.clip-popup-content {
    position: relative;
    background-color: #1f1f1f;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0,0,0,0.6);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.clip-popup-content iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    border-radius: 8px;
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4c4c;
    color: white;
    border: none;
    font-size: 1.3rem;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    z-index: 10;
}

.popup-close:hover {
    background: #d23636;
}

/* Responsive für kleine Bildschirme */
@media (max-width: 480px) {
    .clip-page-search {
        flex-direction: column;
        align-items: stretch;
    }

    #clipsPageStreamerInput {
        width: 100%;
        margin-bottom: 8px;
    }

    #backToSearchBtn,
    #searchNewBtn {
        width: 100%;
        margin-bottom: 6px;
    }
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

@media (max-width: 768px) {
    .clip-popup-content {
        padding: 0.5rem;
        border-radius: 0;
        max-width: 100%;
        max-height: 100%;
    }

    .popup-close {
        top: 6px;
        right: 6px;
        font-size: 1.2rem;
        padding: 2px 8px;
    }

    .clip-popup-content iframe {
        aspect-ratio: 9 / 16; /* aufrecht für Handy besser */
    }
}