/* Global Styles */
:root {
  --primary-color: #0d6efd;
  --secondary-color: #6c757d;
  --success-color: #198754;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --info-color: #0dcaf0;
  --light-color: #f8f9fa;
  --dark-color: #212529;
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

* { 
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--dark-color);
  overflow-x: hidden;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Navigation */
.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
}

.navbar-nav .nav-link {
  font-weight: 500;
  transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
  color: var(--warning-color) !important;
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="1" fill="white" opacity="0.1"/><circle cx="10" cy="60" r="1" fill="white" opacity="0.1"/><circle cx="90" cy="40" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.fade-in {
  animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pulse-btn {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(13, 110, 253, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
  }
}

/* Floating Icons */
.game-icons-container {
  position: relative;
  height: 400px;
}

.floating-icon {
  position: absolute;
  animation: float 3s ease-in-out infinite;
  animation-delay: var(--delay);
}

.floating-icon:nth-child(1) {
  top: 20%;
  left: 20%;
}

.floating-icon:nth-child(2) {
  top: 50%;
  right: 20%;
}

.floating-icon:nth-child(3) {
  bottom: 20%;
  left: 50%;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* Game Cards */
.game-card {
  transition: all 0.3s ease;
  border: none;
  border-radius: 15px;
  overflow: hidden;
}

.game-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.game-icon {
  transition: transform 0.3s ease;
}

.game-card:hover .game-icon {
  transform: scale(1.1);
}

/* Game Previews */
.mini-preview {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tic-tac-preview {
  width: 60px;
  height: 60px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  width: 100%;
  height: 100%;
}

.preview-cell {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  color: var(--primary-color);
}

/* Animate X/O appearing step-by-step */
@keyframes showXO {
  0%   { content: ""; }
  10%  { content: "X"; }
  20%  { content: "O"; }
  30%  { content: "X"; }
  40%  { content: "O"; }
  50%  { content: "X"; }
  60%  { content: "O"; }
  70%  { content: "X"; }
  80%  { content: "O"; }
  90%  { content: ""; }
  100% { content: ""; }
}

/* Add animation using ::after */
.preview-cell::after {
  animation: showXO 5s infinite steps(1);
  content: "";
}


.snake-preview {
  width: 60px;
  height: 40px;
  background: #198754;
  border-radius: 5px;
  position: relative;
  overflow: hidden;
}

.snake-body {
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 2px;
  position: absolute;
  top: 16px;
  left: 20px;
  animation: snakeMove 2s infinite;
}

.snake-food {
  width: 6px;
  height: 6px;
  background: #ffc107;
  border-radius: 50%;
  position: absolute;
  top: 17px;
  right: 15px;
  animation: foodPulse 1s infinite;
}

@keyframes snakeMove {
  0%,
  100% {
    left: 20px;
  }
  50% {
    left: 35px;
  }
}

@keyframes foodPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

.rps-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.rps-hands {
  display: flex;
  align-items: center;
  gap: 12px; 
  font-size: 24px; 
}

.rps-hands i {
  color: var(--warning-color);
  font-size: 32px; 
  animation: rockPaperScissors 2s infinite;
}

.rps-hands span {
  font-size: 20px; 
  font-weight: bold;
  color: var(--secondary-color);
}



@keyframes rockPaperScissors {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1) rotate(10deg);
  }
}

/* Feature Items */
.feature-item {
  padding: 2rem;
  transition: transform 0.3s ease;
}

.feature-item:hover {
  transform: translateY(-5px);
}

.feature-item i {
  transition: transform 0.3s ease;
}

.feature-item:hover i {
  transform: scale(1.1);
}

/* Auth Pages */
.auth-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  padding: 2rem 0;
}

.auth-card {
  background: white;
  border-radius: 20px;
  padding: 3rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-icon {
  margin-bottom: 1rem;
}

.form-control {
  border-radius: 10px;
  border: 2px solid #e9ecef;
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-control.is-invalid {
  border-color: var(--danger-color);
}

.btn {
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.demo-account {
  border-left: 4px solid var(--primary-color);
}

/* Dashboard Styles */
.dashboard-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2rem 0;
}

.stats-card {
  border: none;
  border-radius: 15px;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.stats-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

.game-item {
  background: white;
  border-radius: 15px;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.game-item:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

/* Game Pages */
.game-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 2rem 0;
}

.game-board {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

/* Tic Tac Toe */
.tic-tac-toe-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 300px;
  margin: 0 auto;
}

.tic-tac-toe-cell {
  aspect-ratio: 1;
  background: #f8f9fa;
  border: 3px solid #dee2e6;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tic-tac-toe-cell:hover {
  background: #e9ecef;
  border-color: var(--primary-color);
}

.tic-tac-toe-cell.x {
  color: var(--primary-color);
}

.tic-tac-toe-cell.o {
  color: var(--danger-color);
}

.tic-tac-toe-cell.winning {
  background: var(--success-color);
  color: white;
  animation: winningCell 0.5s ease;
}

@keyframes winningCell {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Snake Game */
.snake-game-canvas {
  border: 3px solid var(--primary-color);
  border-radius: 10px;
  background: #f8f9fa;
}

/* Rock Paper Scissors */
.rps-choices {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 2rem 0;
}

.rps-choice {
  width: 100px;
  height: 100px;
  border: 3px solid #dee2e6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
}

.rps-choice:hover {
  border-color: var(--primary-color);
  transform: scale(1.1);
}

.rps-choice.selected {
  border-color: var(--success-color);
  background: var(--success-color);
  color: white;
}

.rps-result {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin: 2rem 0;
}

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

.rps-vs {
  font-size: 2rem;
  font-weight: bold;
  color: var(--secondary-color);
}

/* Leaderboard */
.leaderboard-table {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.leaderboard-table th {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 1rem;
}

.leaderboard-table td {
  padding: 1rem;
  border: none;
  border-bottom: 1px solid #dee2e6;
}

.leaderboard-table tr:hover {
  background: #f8f9fa;
}

.rank-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: black;
}

.rank-1 {
  background: #ffd700;
}
.rank-2 {
  background: #c0c0c0;
}
.rank-3 {
  background: #cd7f32;
}
.rank-other {
  background: var(--secondary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-section {
    text-align: center;
  }

  .hero-content h1 {
    font-size: 2.5rem;
  }

  .game-icons-container {
    height: 200px;
  }

  .floating-icon {
    position: relative;
    display: inline-block;
    margin: 1rem;
  }

  .auth-card {
    padding: 2rem;
    margin: 1rem;
  }

  .rps-choices {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .rps-choice {
    width: 80px;
    height: 80px;
    font-size: 1.5rem;
  }
}

@media (max-width: 576px) {
  .hero-content h1 {
    font-size: 2rem;
  }

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

  .hero-buttons .btn {
    display: block;
    margin: 0.5rem 0;
  }

  .tic-tac-toe-board {
    max-width: 250px;
  }

  .tic-tac-toe-cell {
    font-size: 1.5rem;
  }
}

/* Animations */
.bounce-in {
  animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.slide-in-left {
  animation: slideInLeft 0.6s ease-out;
}

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

.slide-in-right {
  animation: slideInRight 0.6s ease-out;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Success animations */
.confetti {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--primary-color);
  animation: confettiFall 3s linear infinite;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Toast notifications */
.toast {
  border-radius: 10px;
  border: none;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.toast-header {
  border-bottom: none;
  background: var(--primary-color);
  color: white;
}

.toast-body {
  padding: 1rem;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Utility classes */
.text-gradient {
  background: linear-gradient(135deg, var(--primary-color), var(--warning-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.shadow-custom {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.border-gradient {
  border: 2px solid;
  border-image: linear-gradient(135deg, var(--primary-color), var(--warning-color)) 1;
}
