/*
 * TWITCH DARK THEME
 * A dark theme inspired by Twitch TV's modern design system
 * Features Twitch purple branding and sleek UI elements
 */

@import url("https://fonts.googleapis.com/css?family=Open+Sans:400,700,300|Raleway:300,200|Droid+Sans+Mono");

/* ===== TWITCH COLOR PALETTE ===== */
:root {
  /* Twitch Brand Colors */
  --twitch-purple: #9147ff;
  --twitch-purple-hover: #772ce8;
  --twitch-purple-dark: #5c16c5;
  --twitch-purple-light: #a970ff;
  
  /* Background Colors (from Twitch's dark mode) */
  --bg-base: #0e0e10;
  --bg-alt: #18181b;
  --bg-alt-2: #1f1f23;
  --bg-overlay: #26262c;
  --bg-input: #464649;
  
  /* Text Colors */
  --text-primary: #efeff1;
  --text-secondary: #adadb8;
  --text-muted: #808086;
  --text-link: #a970ff;
  --text-link-hover: #bf94ff;
  
  /* UI Element Colors */
  --border-color: #53535f;
  --border-color-light: #3a3a3d;
  --hover-overlay: rgba(145, 71, 255, 0.1);
  --focus-color: #a970ff;
  
  /* Status Colors */
  --success: #00f593;
  --error: #f13c20;
  --warning: #ffa500;
  --live-indicator: #eb0400;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);
  --shadow-purple: 0 0 20px rgba(145, 71, 255, 0.3);
  
  /* Transitions */
  --transition-fast: 0.1s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* ===== GLOBAL RESET ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: "Raleway", sans-serif;
  font-weight: 300;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 300;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 300;
}

h3 {
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 300;
}

h4 {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 300;
  color: var(--text-secondary);
}

h5 {
  font-size: 1.125rem;
  font-weight: 600;
}

p {
  font-size: clamp(0.875rem, 2vw, 1rem);
  line-height: 1.6;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

b, strong {
  font-weight: 700;
  color: var(--twitch-purple-light);
  transition: var(--transition-fast);
}

b:hover, strong:hover {
  color: var(--twitch-purple);
}

code, kbd {
  font-family: "Droid Sans Mono", "Courier New", Courier, monospace;
  font-size: 0.9em;
  padding: 0.2em 0.4em;
  background: var(--bg-overlay);
  border: 1px solid var(--border-color-light);
  border-radius: 4px;
  color: var(--text-primary);
}

kbd {
  background: var(--bg-input);
  border-bottom-width: 2px;
  box-shadow: var(--shadow-sm);
}

/* ===== LINKS ===== */
a {
  color: var(--text-link);
  text-decoration: none;
  transition: var(--transition-fast);
  cursor: pointer;
}

a:hover {
  color: var(--text-link-hover);
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ===== LAYOUT ===== */
main {
  width: 100%;
  max-width: 100%;
  flex: 1;
}

header.row {
  padding: 3rem 2rem;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-alt) 0%, var(--bg-base) 100%);
  position: relative;
}

header.row::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

/* ===== LOGO ===== */
.logo {
  max-width: 100px;
  max-height: 100px;
  filter: drop-shadow(0 4px 12px rgba(145, 71, 255, 0.4));
  transition: filter var(--transition-normal);
  margin-bottom: 1.5rem;
}

.logo:hover {
  filter: drop-shadow(0 8px 20px rgba(145, 71, 255, 0.6));
  animation: breathe 2s ease-in-out infinite;
}

/* ===== THEME TOGGLE BUTTON ===== */
.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  width: 50px;
  height: 50px;
  background: var(--bg-alt-2);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-md);
}

.theme-toggle:hover {
  background: var(--twitch-purple);
  border-color: var(--twitch-purple);
  transform: scale(1.1);
  box-shadow: var(--shadow-purple);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle:focus {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

/* ===== VIDEO CONTAINER ===== */
.container {
  position: relative;
  width: min(90%, 1200px);
  aspect-ratio: 16/9;
  margin: 2rem auto;
  background: var(--bg-alt);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-normal);
  border: 1px solid var(--border-color-light);
}

.container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--twitch-purple), var(--twitch-purple-light));
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.container:hover {
  border-color: var(--twitch-purple);
  box-shadow: 
    var(--shadow-lg),
    0 0 0 1px var(--twitch-purple),
    var(--shadow-purple);
  transform: translateY(-2px);
}

.container:hover::before {
  opacity: 1;
}

/* Loading state for video container */
.container.loading {
  background: linear-gradient(
    90deg,
    var(--bg-alt) 0%,
    var(--bg-alt-2) 50%,
    var(--bg-alt) 100%
  );
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== IFRAME PLAYER ===== */
.player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ===== FOOTER ===== */
footer {
  margin-top: auto;
  padding: 3rem 2rem 2rem;
  background: var(--bg-alt);
  border-top: 1px solid var(--border-color-light);
  text-align: center;
}

footer p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0.5rem 0;
}

footer a {
  color: var(--text-link);
  font-weight: 500;
}

footer a:hover {
  color: var(--text-link-hover);
}

/* ===== SOCIAL LINKS ===== */
.social-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  background: var(--bg-alt-2);
  border: 2px solid var(--border-color-light);
  border-radius: 8px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.social::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--twitch-purple), var(--twitch-purple-light));
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.social:hover {
  border-color: var(--twitch-purple);
  transform: translateY(-4px);
  box-shadow: var(--shadow-purple);
}

.social:hover::before {
  opacity: 0.15;
}

.social:active {
  transform: translateY(-2px);
}

/* Remove underline from social icon links */
.social:hover {
  text-decoration: none;
}

/* ===== SVG ICONS ===== */
.xmlsoc {
  width: 24px;
  height: 24px;
  position: relative;
  z-index: 1;
  transition: all var(--transition-normal);
  filter: brightness(0.9);
}

.social:hover .xmlsoc {
  filter: brightness(1.2);
  transform: scale(1.1);
}

/* ===== BUTTONS (General) ===== */
button {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  background: var(--twitch-purple);
  color: var(--text-primary);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

button:hover {
  background: var(--twitch-purple-hover);
}

button:active {
  background: var(--twitch-purple-dark);
  transform: scale(0.98);
}

button:disabled {
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.5;
}

/* ===== TWITCH-STYLE BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  background: var(--bg-overlay);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.badge.live {
  background: var(--live-indicator);
  color: white;
  border-color: var(--live-indicator);
  animation: pulse 2s ease-in-out infinite;
}

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

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Apply animations on page load */
header.row {
  animation: fadeIn 0.6s ease-out;
}

.container {
  animation: fadeIn 0.8s ease-out 0.2s both;
}

footer {
  animation: fadeIn 0.8s ease-out 0.4s both;
}

.social {
  animation: slideIn 0.4s ease-out both;
}

.social:nth-child(1) { animation-delay: 0.5s; }
.social:nth-child(2) { animation-delay: 0.6s; }
.social:nth-child(3) { animation-delay: 0.7s; }
.social:nth-child(4) { animation-delay: 0.8s; }

/* ===== TWITCH-STYLE HOVER EFFECTS ===== */
.twitch-hover {
  position: relative;
  overflow: hidden;
}

.twitch-hover::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: var(--hover-overlay);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.twitch-hover:hover::after {
  width: 300px;
  height: 300px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
  .container {
    width: 95%;
  }
}

@media (max-width: 768px) {
  header.row {
    padding: 2rem 1rem;
  }
  
  .theme-toggle {
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
  }
  
  .logo {
    max-width: 80px;
    max-height: 80px;
  }
  
  h1 {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
  }
  
  .social-links {
    gap: 0.75rem;
  }
  
  .social {
    width: 44px;
    height: 44px;
  }
  
  .xmlsoc {
    width: 20px;
    height: 20px;
  }
  
  footer {
    padding: 2rem 1rem 1.5rem;
  }
}

@media (max-width: 480px) {
  header.row {
    padding: 1.5rem 0.75rem;
  }
  
  .container {
    width: 98%;
    margin: 1.5rem auto;
  }
  
  .theme-toggle {
    width: 40px;
    height: 40px;
    font-size: 1.125rem;
  }
  
  .logo {
    max-width: 70px;
    max-height: 70px;
  }
  
  .social-links {
    gap: 0.5rem;
  }
  
  .social {
    width: 40px;
    height: 40px;
  }
  
  .xmlsoc {
    width: 18px;
    height: 18px;
  }
  
  p {
    font-size: 0.875rem;
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --bg-base: #000000;
    --bg-alt: #0a0a0a;
    --text-primary: #ffffff;
    --border-color: #ffffff;
    --twitch-purple: #bf94ff;
  }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

/* ===== CUSTOM SCROLLBAR (Twitch-style) ===== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-input);
  border-radius: 5px;
  border: 2px solid var(--bg-base);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--twitch-purple);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-input) var(--bg-base);
}

/* ===== TEXT SELECTION ===== */
::selection {
  background: var(--twitch-purple);
  color: var(--text-primary);
}

::-moz-selection {
  background: var(--twitch-purple);
  color: var(--text-primary);
}

/* ===== UTILITY CLASSES ===== */
.text-purple {
  color: var(--twitch-purple-light);
}

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

.text-center {
  text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ===== LOADING SPINNER (Twitch-style) ===== */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--bg-alt-2);
  border-top-color: var(--twitch-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
/* ===== BREATHING ANIMATION ===== */
@keyframes breathe {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-8px) scale(1.05);
  }
}

/* ===== H1 TWITCH LINK HOVER ===== */
h1 a {
  display: inline-block;
  transition: all var(--transition-normal);
  color: var(--text-link);
  text-decoration: none;
}

h1 a:hover {
  color: var(--twitch-purple);
  text-shadow: 0 0 20px rgba(145, 71, 255, 0.6);
  animation: breathe 2s ease-in-out infinite;
}

/* ===== SHARE BUTTON ===== */
.share-btn {
  position: absolute;
  bottom: 36rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all var(--transition-normal);
  z-index: 10;
  opacity: 0;
}

.container:hover .share-btn {
  opacity: 1;
}

.share-btn:hover {
  background: var(--twitch-purple);
  border-color: var(--twitch-purple);
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(145, 71, 255, 0.5);
}

.share-btn:active {
  transform: scale(0.95);
}

.share-btn svg {
  width: 20px;
  height: 20px;
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  position: relative;
  background: var(--bg-alt);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(145, 71, 255, 0.3);
  animation: modalSlideIn 0.3s ease-out;
  overflow: hidden;
}

.modal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--twitch-purple), var(--twitch-purple-light));
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color-light);
}

.modal-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-alt-2);
  border-color: var(--twitch-purple);
  color: var(--text-primary);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: 1.5rem;
}

.modal-body p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

.share-input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.share-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg-alt-2);
  border: 2px solid var(--border-color-light);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: "Droid Sans Mono", monospace;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

.share-input:focus {
  outline: none;
  border-color: var(--twitch-purple);
  background: var(--bg-overlay);
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--twitch-purple);
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.copy-btn:hover {
  background: var(--twitch-purple-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(145, 71, 255, 0.4);
}

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

.copy-btn svg {
  width: 16px;
  height: 16px;
}

.copy-success {
  padding: 0.75rem 1rem;
  background: var(--success);
  color: white;
  border-radius: 6px;
  text-align: center;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-10px);
  transition: all var(--transition-normal);
  pointer-events: none;
}

.copy-success.show {
  opacity: 1;
  transform: translateY(0);
}

/* ===== RESPONSIVE MODAL ===== */
@media (max-width: 480px) {
  .modal-content {
    max-width: calc(100% - 2rem);
  }
  
  .modal-header {
    padding: 1rem;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .share-input-group {
    flex-direction: column;
  }
  
  .share-btn {
    width: 44px;
    height: 44px;
    bottom: 0.75rem;
    right: 0.75rem;
  }
  
  .share-btn svg {
    width: 18px;
    height: 18px;
  }
}

