/* ==================== Font Face ==================== */
@font-face {
  font-family: 'IRANSans';
  src: url('./gpt/Iran Sans/iran-sans.eot');
  src: url('./gpt/Iran Sans/iran-sans.eot?#iefix') format('embedded-opentype'),
       url('./gpt/Iran Sans/iran-sans.woff') format('woff'),
       url('./gpt/Iran Sans/iran-sans.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* ==================== CSS Variables ==================== */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-tertiary: #adb5bd;
  --border-color: #dee2e6;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
  --accent-primary: #3498db;
  --accent-secondary: #2ecc71;
  --accent-gradient: linear-gradient(135deg, #3498db 0%, #2ecc71 100%);
  --loader-border: rgba(0, 0, 0, 0.1);
  --loader-top: #3498db;
}

[data-theme="dark"] {
  --bg-primary: #0a0a0f;
  --bg-secondary: #13131a;
  --bg-tertiary: #1a1a24;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --accent-primary: #8b5cf6;
  --accent-secondary: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
  --loader-border: rgba(255, 255, 255, 0.1);
  --loader-top: #8b5cf6;
}

/* ==================== Global Styles ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'IRANSans', Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-primary);
  color: var(--text-primary);
  flex-direction: column;
  transition: background 0.3s ease, color 0.3s ease;
  direction: rtl;
}

/* ==================== Theme Toggle ==================== */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: 50px;
  padding: 8px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  -webkit-user-select: none;
  user-select: none;
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.theme-toggle-icon {
  font-size: 20px;
  transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-toggle-icon {
  transform: rotate(20deg);
}

.theme-toggle-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ==================== Loader ==================== */
.loader-container {
  position: relative;
  width: 150px;
  height: 150px;
  margin-bottom: 30px;
}

.spinner {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 5px solid var(--loader-border);
  border-top: 5px solid var(--loader-top);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  top: 0;
  left: 0;
}

.logo {
  width: 100px;
  height: 100px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==================== Progress Bar ==================== */
.progress-container {
  width: 300px;
  height: 25px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 30px;
  display: none;
  box-shadow: var(--shadow-sm);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  text-align: center;
  line-height: 25px;
  color: white;
  font-weight: bold;
  transition: width 0.2s;
}

/* ==================== Content Box ==================== */
.content-box {
  display: none;
  width: 360px;
  padding: 60px 30px 30px 30px;
  border: 2px solid var(--border-color);
  border-radius: 16px;
  background: var(--bg-secondary);
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  transition: all 0.3s ease;
}

.content-box h2 {
  color: var(--text-primary);
  margin-bottom: 20px;
  font-size: 24px;
}

.content-box p {
  color: var(--text-secondary);
  margin-top: 15px;
  font-size: 14px;
  line-height: 1.6;
}

/* ==================== Floating Logo ==================== */
.box-logo {
  width: 80px;
  height: 80px;
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  animation: float 2s ease-in-out infinite;
  filter: drop-shadow(var(--shadow-sm));
}

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

/* ==================== Buttons ==================== */
.content-box button {
  display: block;
  width: 85%;
  margin: 12px auto;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  transition: all 0.3s ease;
  font-family: 'IRANSans', Arial, sans-serif;
}

.content-box button:hover {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.content-box button:active {
  transform: translateY(0);
}

/* ==================== Music Card ==================== */
.music-card {
  display: flex;
  align-items: center;
  cursor: pointer;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  transition: all 0.3s ease;
  margin: 20px auto 0 auto;
  width: 90%;
  background: var(--bg-tertiary);
  direction: rtl;
}

.music-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-primary);
}

.music-card img {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  margin-left: 15px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.music-info {
  flex-grow: 1;
  text-align: right;
}

.music-info div:first-child {
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.music-info div:last-child {
  font-size: 14px;
  color: var(--text-secondary);
}

.music-controls {
  font-size: 20px;
  display: flex;
  gap: 5px;
  opacity: 0.7;
  transition: opacity 0.3s;
}

.music-card:hover .music-controls {
  opacity: 1;
}

/* ==================== Responsive Design ==================== */

/* Large Desktop (1200px and up) */
@media (min-width: 1200px) {
  .content-box {
    width: 420px;
    padding: 70px 40px 40px 40px;
  }
  
  .box-logo {
    width: 100px;
    height: 100px;
    top: -50px;
  }
}

/* Tablet (768px to 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
  .content-box {
    width: 380px;
    padding: 60px 30px 30px 30px;
  }
  
  .progress-container {
    width: 350px;
  }
  
  .loader-container {
    width: 140px;
    height: 140px;
  }
  
  .logo {
    width: 90px;
    height: 90px;
  }
}

/* Small Tablet (481px to 767px) */
@media (min-width: 481px) and (max-width: 767px) {
  .content-box {
    width: 90%;
    max-width: 400px;
    padding: 55px 25px 25px 25px;
  }
  
  .content-box h2 {
    font-size: 22px;
  }
  
  .content-box button {
    width: 90%;
    padding: 12px;
    font-size: 15px;
  }
  
  .music-card {
    width: 92%;
  }
  
  .progress-container {
    width: 280px;
  }
  
  .theme-toggle {
    top: 15px;
    left: 15px;
  }
}

/* Mobile (320px to 480px) */
@media (max-width: 480px) {
  body {
    font-size: 14px;
  }
  
  .content-box {
    width: 92%;
    max-width: 340px;
    padding: 50px 18px 20px 18px;
    border-width: 1px;
  }
  
  .content-box h2 {
    font-size: 20px;
    margin-bottom: 15px;
  }
  
  .content-box p {
    font-size: 13px;
  }
  
  .content-box button {
    width: 95%;
    padding: 12px;
    font-size: 14px;
    margin: 10px auto;
    min-height: 44px; /* Touch-friendly */
  }
  
  .box-logo {
    width: 70px;
    height: 70px;
    top: -35px;
  }
  
  .music-card {
    width: 95%;
    padding: 10px;
    flex-direction: row;
    min-height: 70px; /* Touch-friendly */
  }
  
  .music-card img {
    width: 50px;
    height: 50px;
    margin-left: 10px;
  }
  
  .music-info div:first-child {
    font-size: 14px;
  }
  
  .music-info div:last-child {
    font-size: 12px;
  }
  
  .music-controls {
    font-size: 18px;
  }
  
  .progress-container {
    width: 90%;
    max-width: 280px;
    height: 22px;
  }
  
  .progress-bar {
    font-size: 13px;
    line-height: 22px;
  }
  
  .loader-container {
    width: 120px;
    height: 120px;
    margin-bottom: 25px;
  }
  
  .logo {
    width: 80px;
    height: 80px;
  }
  
  .spinner {
    border-width: 4px;
  }
  
  .theme-toggle {
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    min-height: 44px; /* Touch-friendly */
  }
  
  .theme-toggle-text {
    display: none;
  }
  
  .theme-toggle-icon {
    font-size: 22px;
  }
}

/* Extra Small Mobile (below 360px) */
@media (max-width: 359px) {
  .content-box {
    width: 95%;
    padding: 45px 15px 18px 15px;
  }
  
  .content-box h2 {
    font-size: 18px;
  }
  
  .content-box button {
    font-size: 13px;
    padding: 10px;
  }
  
  .music-card img {
    width: 45px;
    height: 45px;
  }
  
  .box-logo {
    width: 60px;
    height: 60px;
    top: -30px;
  }
}

/* Landscape Orientation on Mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .loader-container {
    width: 100px;
    height: 100px;
    margin-bottom: 15px;
  }
  
  .logo {
    width: 70px;
    height: 70px;
  }
  
  .progress-container {
    margin-bottom: 15px;
  }
  
  .content-box {
    padding: 40px 20px 15px 20px;
  }
  
  .box-logo {
    width: 60px;
    height: 60px;
    top: -30px;
  }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .box-logo,
  .logo {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}