/* ==================================================
   Modern Gaming UI Integration
   Combines all modern elements with existing styles
================================================== */

/* ---------- IMPORT EXISTING STYLES ---------- */
@import url('/assets/style.css');
@import url('/assets/style-glass.css');

/* ---------- MODERN HERO SECTION ---------- */
.modern-hero {
  position: relative;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.8) 0%, rgba(2, 6, 23, 0.95) 100%);
  overflow: hidden;
}

.modern-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(600px 300px at 20% 20%, rgba(56, 189, 248, 0.1) 0%, transparent 60%),
    radial-gradient(500px 250px at 80% 80%, rgba(34, 197, 94, 0.08) 0%, transparent 60%);
  z-index: 1;
}

.modern-hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  padding: 0 24px;
}

.modern-hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 900;
  background: linear-gradient(135deg, #38bdf8, #22c55e, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  animation: hero-text-glow 3s ease-in-out infinite alternate;
}

@keyframes hero-text-glow {
  0% { filter: drop-shadow(0 0 20px rgba(56, 189, 248, 0.5)); }
  100% { filter: drop-shadow(0 0 40px rgba(34, 197, 94, 0.7)); }
}

.modern-hero p {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  color: rgba(226, 232, 240, 0.8);
  margin-bottom: 32px;
  line-height: 1.6;
}

/* ---------- MODERN GAME GRID ---------- */
.modern-games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 32px;
  padding: 48px 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.modern-game-card {
  position: relative;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 24px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  cursor: pointer;
  will-change: transform;
  contain: layout style;
}

.modern-game-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(400px 200px at 30% 0%, rgba(168, 85, 247, 0.1), transparent 70%);
  z-index: -1;
  transition: opacity 0.3s ease;
}

.modern-game-card::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, #38bdf8, #22c55e, #a855f7, #ec4899);
  border-radius: 26px;
  opacity: 0;
  z-index: -2;
  transition: opacity 0.3s ease;
}

.modern-game-card:hover::after {
  opacity: 0.3;
}

.modern-game-card:hover {
  transform: translateY(-12px) rotateX(8deg) scale(1.02);
  box-shadow: 
    0 40px 80px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.3);
}

.modern-game-card:hover::before {
  opacity: 0.2;
}

.modern-game-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #38bdf8, #22c55e);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 24px;
  transition: all 0.3s ease;
}

.modern-game-card:hover .modern-game-icon {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
}

.modern-game-title {
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #38bdf8, #22c55e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modern-game-desc {
  color: rgba(226, 232, 240, 0.7);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.modern-game-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: rgba(226, 232, 240, 0.6);
}

.modern-game-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---------- MODERN MODAL ---------- */
.modern-game-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(2, 6, 23, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modern-game-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.modern-game-modal-panel {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  position: relative;
  width: min(1280px, calc(100vw - 40px));
  height: min(92vh, 860px);
  max-width: none;
  max-height: none;
  margin: 20px;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modern-game-modal.is-open .modern-game-modal-panel {
  transform: scale(1);
}

.modern-game-modal-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(800px 400px at 50% 0%, rgba(56, 189, 248, 0.1), transparent 60%);
  pointer-events: none;
  z-index: -1;
}

.modern-game-modal-header {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modern-game-modal-title {
  font-size: 18px;
  font-weight: 900;
  background: linear-gradient(135deg, #38bdf8, #22c55e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modern-game-modal-close {
  background: none;
  border: none;
  color: rgba(226, 232, 240, 0.8);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.modern-game-modal-close:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
}

.modern-game-modal-body {
  background: transparent;
  position: relative;
  height: calc(100% - 68px);
}

.modern-game-iframe-wrapper {
  position: relative;
  background: rgba(2, 6, 23, 0.8);
  border-radius: 16px;
  margin: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
  height: calc(100% - 32px);
}

.modern-game-iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 16px;
}

/* ---------- MODERN CONTROLS ---------- */
.modern-game-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.modern-control-btn {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px 12px;
  color: rgba(226, 232, 240, 0.9);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.modern-control-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  transform: translateY(-1px);
}

/* ---------- FULLSCREEN MODE ---------- */
.modern-game-modal-panel:fullscreen {
  border-radius: 0;
  border: none;
  box-shadow: none;
  margin: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
}

.modern-game-modal-panel:fullscreen .modern-game-iframe-wrapper {
  margin: 0;
  border-radius: 0;
  border: none;
  height: 100vh;
}

.modern-game-modal-panel:fullscreen .modern-game-modal-header {
  border-radius: 0;
  padding: 24px;
}

/* ---------- RESPONSIVE DESIGN ---------- */
@media (max-width: 768px) {
  .modern-games-grid {
    grid-template-columns: 1fr;
    padding: 24px 16px;
    gap: 24px;
  }
  
  .modern-game-modal-panel {
    margin: 8px;
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    border-radius: 20px;
  }
  
  .modern-game-modal-header {
    padding: 16px 20px;
  }
  
  .modern-game-iframe-wrapper {
    margin: 12px;
    height: calc(100% - 24px);
  }
  
  .modern-game-controls {
    top: 12px;
    right: 12px;
    gap: 6px;
  }
  
  .modern-control-btn {
    padding: 6px 10px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .modern-hero h1 {
    font-size: 2rem;
  }
  
  .modern-hero p {
    font-size: 1rem;
  }
  
  .modern-game-card {
    padding: 20px;
  }
  
  .modern-game-icon {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
}

/* ---------- ANIMATIONS ---------- */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modern-game-card {
  animation: slideInUp 0.6s ease-out;
  animation-fill-mode: both;
}

.modern-game-card:nth-child(1) { animation-delay: 0.1s; }
.modern-game-card:nth-child(2) { animation-delay: 0.2s; }
.modern-game-card:nth-child(3) { animation-delay: 0.3s; }
.modern-game-card:nth-child(4) { animation-delay: 0.4s; }

/* ---------- ACCESSIBILITY ---------- */
@media (prefers-reduced-motion: reduce) {
  .modern-game-card,
  .modern-game-modal-panel,
  .modern-control-btn {
    transition: none;
    animation: none;
  }
  
  .modern-hero h1 {
    animation: none;
  }
}

@media (prefers-contrast: high) {
  .modern-game-card,
  .modern-game-modal-panel {
    border-width: 2px;
  }
  
  .modern-control-btn {
    border-width: 2px;
  }
}

/* ---------- PERFORMANCE ---------- */
.modern-game-card,
.modern-game-modal-panel,
.modern-control-btn {
  will-change: transform;
  contain: layout style;
}

.modern-game-iframe {
  will-change: transform;
  contain: strict;
}

/* ---------- LOADING STATES ---------- */
.modern-loading {
  position: relative;
  overflow: hidden;
}

.modern-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.2), transparent);
  animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* ---------- ERROR STATES ---------- */
.modern-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fecaca;
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  margin: 16px 0;
}

/* ---------- SUCCESS STATES ---------- */
.modern-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #bbf7d0;
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  margin: 16px 0;
}

/* ---------- NEON TEXT EFFECTS ---------- */
.neon-text {
  text-shadow: 
    0 0 10px currentColor,
    0 0 20px currentColor,
    0 0 30px currentColor;
  animation: neon-flicker 2s infinite alternate;
}

@keyframes neon-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.neon-cyan { color: #38bdf8; }
.neon-green { color: #22c55e; }
.neon-purple { color: #a855f7; }
.neon-pink { color: #ec4899; }

/* ---------- BUTTON ENHANCEMENTS ---------- */
.modern-btn-primary {
  background: linear-gradient(135deg, #38bdf8, #22c55e);
  border: none;
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.modern-btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.modern-btn-primary:hover::before {
  left: 100%;
}

.modern-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.3);
}

.modern-btn-secondary {
  background: transparent;
  border: 2px solid #38bdf8;
  color: #38bdf8;
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.modern-btn-secondary:hover {
  background: #38bdf8;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.3);
}