:root {
  --primary: #3E89999957;
  --primary-dark: #13a;
  --primary-light: #4caf50;
  --gold: #d4af37;
  --gold-dark: #b8860b;
  --bg-light: #f8f9fa;
  --bg-white: #ffffff;
  --text-dark: #2d3748;
  --text-light: #718096;
  --border-light: #e2e8f0;
  --shadow: 0 50px 25px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.15);
  --radius: 12px;
  --radius-lg: 20px;
}

[data-theme="dark"] {
  --bg-light: #1a202c;
  --bg-white: #2d3748;
  --text-dark: #f7fafc;
  --text-light: #cbd5e0;
  --border-light: #4a5568;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: "Hind Siliguri", sans-serif;
  background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-white) 100%);
  color: var(--text-dark);
  min-height: 100vh;
  transition: all 0.3s ease;
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Header Styles */
.header {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  border-radius: var(--radius-lg);
  padding: 40px;
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ffffff' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
  opacity: 0.1;
}

.logo-container {
  text-align: center;
  color: white;
  position: relative;
  z-index: 2;
}

.logo {
  font-size: 4rem;
  margin-bottom: 15px;
  display: inline-block;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
  font-size: 1.3rem;
  opacity: 0.9;
  font-weight: 300;
  max-width: 600px;
  margin: 0 auto;
}

/* Navigation */
.nav-tabs {
  display: flex;
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 30px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}

.nav-tab {
  flex: 1;
  text-align: center;
  padding: 15px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.3s ease;
  font-weight: 600;
  color: var(--text-light);
}

.nav-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow);
}

.nav-tab:hover:not(.active) {
  background: var(--bg-light);
  color: var(--text-dark);
}

/* Main Card */
.main-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 30px;
  border: 1px solid var(--border-light);
}

/* File Upload - Enhanced */
.file-upload-container {
  border: 3px dashed var(--primary);
  border-radius: var(--radius-lg);
  padding: 60px 40px;
  text-align: center;
  margin: 30px 0;
  background: linear-gradient(135deg, #fff9 0%, #f0fff0 100%);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .file-upload-container {
  background: linear-gradient(135deg, #1e3a1e 0%, #2d4a2d 100%);
}

.file-upload-container:hover {
  border-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.upload-icon {
  font-size: 5rem;
  color: var(--primary);
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 8px rgba(46, 139, 87, 0.3));
}

/* Buttons - Enhanced */
.btn {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: white;
  border: none;
  padding: 18px 35px;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 8px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.btn::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;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 25px rgba(46, 139, 87, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
}

.btn-danger {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
}

.btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn:disabled::before {
  display: none;
}

/* Text Areas - Enhanced */
.text-preview-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin: 40px 0;
}

@media (max-width: 1024px) {
  .text-preview-container {
    grid-template-columns: 1fr;
  }
}

.text-preview {
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 25px;
  background: var(--bg-white);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.text-preview:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.text-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border-light);
}

.text-preview h3 {
  color: var(--primary);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.text-content {
  width: 100%;
  height: 300px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  font-family: "Hind Siliguri", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  resize: none;
  background: var(--bg-light);
  color: var(--text-dark);
  overflow-y: auto;
}

.text-content:focus {
  outline: none;
  border-color: var(--primary);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 30px 0;
  flex-wrap: wrap;
}

/* Reader Modal */
.reader-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.reader-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  height: 85%;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reader-header {
  padding: 20px;
  background: var(--primary);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
}

.reader-body {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  line-height: 2;
  font-size: 18px;
}

.reader-controls {
  padding: 20px;
  background: var(--bg-light);
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: center;
}

/* History Section */
.history-section {
  display: none;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.history-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 25px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
  cursor: pointer;
}

.history-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.history-title {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 1.1rem;
}

.history-date {
  color: var(--text-light);
  font-size: 0.9rem;
}

.history-preview {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Progress Bar - Enhanced */
.progress-container {
  width: 100%;
  background: var(--bg-light);
  border-radius: 50px;
  margin: 25px 0;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar {
  height: 25px;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  border-radius: 50px;
  transition: width 0.4s ease;
  text-align: center;
  color: white;
  font-size: 14px;
  font-weight: 600;
  line-height: 25px;
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Loading Animation - Enhanced */
.loading {
  display: none;
  text-align: center;
  padding: 40px;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--border-light);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

/* Theme Toggle */
.theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 3;
}

/* Dark/Light Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #2196f3;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #ff9800;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* Footer */
.footer {
  text-align: center;
  padding: 40px 0;
  color: var(--text-light);
  border-top: 1px solid var(--border-light);
  margin-top: 50px;
}

/* Responsive */
@media (max-width: 768px) {
  .title {
    font-size: 2.2rem;
  }
  .subtitle {
    font-size: 1.1rem;
  }
  .nav-tabs {
    flex-direction: column;
    gap: 10px;
  }
  .action-buttons {
    flex-direction: column;
    align-items: center;
  }
  .btn {
    width: 100%;
    justify-content: center;
  }
  .reader-content {
    width: 95%;
    height: 90%;
  }
}

/* Utility Classes */
.text-center {
  text-align: center;
}
.mb-20 {
  margin-bottom: 20px;
}
.mb-30 {
  margin-bottom: 30px;
}
.hidden {
  display: none;
}

/* Arabic Text Style */
.arabic-text {
  font-family: "Amiri", serif;
  font-size: 20px;
  line-height: 2.5;
  text-align: right;
  direction: rtl;
}

/* Bangla Text Style */
.bangla-text {
  font-family: "Hind Siliguri", sans-serif;
  font-size: 18px;
  line-height: 1.8;
  text-align: justify;
}

/* File Info */
.file-info {
  background: var(--bg-light);
  padding: 15px;
  border-radius: var(--radius);
  margin: 15px 0;
  border-left: 4px solid var(--primary);
}

.file-name {
  font-weight: 600;
  color: var(--primary);
}

.file-size {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* TTS Controls */
.tts-active {
  background: #dc3545 !important;
}

.tts-active:hover {
  background: #c82333 !important;
}

/* API Status */
.api-status {
  padding: 10px 15px;
  border-radius: var(--radius);
  margin: 10px 0;
  text-align: center;
  font-weight: 600;
}

.api-status.success {
  background: #d4edda;
  color: #155724;
  border-left: 4px solid #28a745;
}

.api-status.error {
  background: #f8d7da;
  color: #721c24;
  border-left: 4px solid #dc3545;
}

.api-status.warning {
  background: #fff3cd;
  color: #856404;
  border-left: 4px solid #ffc107;
}

/* Stop Button Animation */
.stop-pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}
