/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-blue: #3498db;
  --primary-blue-dark: #2980b9;
  --secondary-purple: #8e44ad;
  --success-green: #27ae60;
  --success-green-light: #2ecc71;
  --error-red: #e74c3c;
  --warning-orange: #f39c12;
  --neutral-gray: #95a5a6;
  --neutral-gray-dark: #7f8c8d;
  --text-dark: #2c3e50;
  --text-light: #7f8c8d;
  --background-light: #fafbfc;
  --background-white: #ffffff;
  --border-light: #e1e8ed;
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-medium: rgba(0, 0, 0, 0.15);
  --border-radius: 12px;
  --border-radius-large: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--border-radius-large);
  box-shadow: 0 20px 40px var(--shadow-light);
  padding: 40px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Header styles */
header {
  text-align: center;
  margin-bottom: 50px;
}

header h1 {
  color: var(--text-dark);
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 15px;
  background: linear-gradient(45deg, var(--primary-blue), var(--secondary-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 4px var(--shadow-light);
}

header p {
  color: var(--text-light);
  font-size: 1.2rem;
  font-weight: 500;
}

/* Main converter section */
.converter-section {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 40px;
  align-items: start;
  margin-bottom: 40px;
}

.input-section,
.output-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Font selector styles */
.font-selector {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.font-selector label {
  color: var(--text-dark);
  font-weight: 600;
  font-size: 1.1rem;
  min-width: 60px;
}

.font-dropdown {
  flex: 1;
  padding: 15px 20px;
  border: 2px solid var(--border-light);
  border-radius: var(--border-radius);
  background: var(--background-white);
  font-size: 1rem;
  color: var(--text-dark);
  transition: var(--transition);
  cursor: pointer;
  font-weight: 500;
}

.font-dropdown:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
  transform: translateY(-1px);
}

.font-dropdown:hover {
  border-color: var(--primary-blue);
}

/* Textarea wrapper and styles */
.textarea-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

textarea {
  width: 100%;
  min-height: 200px;
  padding: 25px;
  border: 2px solid var(--border-light);
  border-radius: var(--border-radius);
  font-size: 1.1rem;
  font-family: 'Noto Sans Gujarati', 'Shruti', sans-serif;
  line-height: 1.8;
  resize: vertical;
  transition: var(--transition);
  background: var(--background-light);
  color: var(--text-dark);
  font-weight: 400;
}

textarea:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
  background: var(--background-white);
  transform: translateY(-1px);
}

textarea[readonly] {
  background: #f8f9fa;
  cursor: default;
  border-style: dashed;
}

textarea::placeholder {
  color: var(--text-light);
  font-style: italic;
}

/* Textarea footer */
.textarea-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 5px;
}

.character-count {
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Conversion controls */
.conversion-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  justify-content: center;
  padding: 30px 0;
}

.convert-btn {
  background: linear-gradient(45deg, var(--primary-blue), var(--primary-blue-dark));
  color: white;
  border: none;
  padding: 18px 30px;
  border-radius: var(--border-radius);
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.convert-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

.convert-btn:active {
  transform: translateY(-1px);
}

.convert-btn.loading {
  background: var(--neutral-gray);
  cursor: not-allowed;
  pointer-events: none;
}

.convert-btn.loading .convert-icon {
  animation: pulse 1.5s ease-in-out infinite;
}

.convert-icon {
  font-size: 1.4rem;
  transition: var(--transition);
}

.swap-btn {
  background: var(--neutral-gray);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1.2rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.swap-btn:hover {
  background: var(--neutral-gray-dark);
  transform: scale(1.1) rotate(180deg);
}

.batch-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.action-btn {
  background: var(--background-white);
  border: 2px solid var(--border-light);
  padding: 8px 12px;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dark);
}

.action-btn:hover {
  border-color: var(--primary-blue);
  background: var(--primary-blue);
  color: white;
  transform: translateY(-2px);
}

.copy-btn {
  background: linear-gradient(45deg, var(--success-green), var(--success-green-light));
  color: white;
  border: none;
}

.copy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.copy-btn.copied {
  background: var(--success-green-light);
  animation: success-pulse 0.6s ease-in-out;
}

.clear-btn:hover {
  background: var(--error-red);
  border-color: var(--error-red);
}

.paste-btn:hover {
  background: var(--warning-orange);
  border-color: var(--warning-orange);
}

.undo-btn:hover {
  background: var(--secondary-purple);
  border-color: var(--secondary-purple);
}

/* Info section */
.info-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25px 30px;
  background: linear-gradient(45deg, #f8f9fa, #e9ecef);
  border-radius: var(--border-radius);
  margin-bottom: 30px;
  border: 1px solid var(--border-light);
}

.status-area {
  display: flex;
  align-items: center;
  gap: 15px;
}

.status {
  font-weight: 600;
  font-size: 1rem;
  min-height: 20px;
  transition: var(--transition);
}

.status.success {
  color: var(--success-green);
}

.status.error {
  color: var(--error-red);
}

.status.warning {
  color: var(--warning-orange);
}

.loading-indicator {
  display: none;
  align-items: center;
  gap: 10px;
  color: var(--primary-blue);
  font-weight: 500;
}

.loading-indicator.active {
  display: flex;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-light);
  border-top: 2px solid var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.conversion-stats {
  display: flex;
  gap: 25px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 2px;
}

.stat-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
}

/* Footer */
footer {
  text-align: center;
  color: var(--text-light);
  font-size: 0.95rem;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

/* Animations */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes success-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes slideIn {
  from { 
      opacity: 0;
      transform: translateY(-10px);
  }
  to { 
      opacity: 1;
      transform: translateY(0);
  }
}

.conversion-success {
  animation: slideIn 0.5s ease-out;
  background: linear-gradient(45deg, #d4edda, #c3e6cb) !important;
  border-color: var(--success-green) !important;
}

/* Font-specific styles */
.kap127 {
  font-family: 'Kap127', monospace;
}

.akashganga {
  font-family: 'Akashganga', serif;
}

.ghanshyam {
  font-family: 'Ghanshyam', serif;
}

.amrit {
  font-family: 'Amrit', serif;
}

.shruti {
  font-family: 'Shruti', serif;
}

/* Responsive design */
@media (max-width: 1024px) {
  .converter-section {
      grid-template-columns: 1fr;
      gap: 30px;
  }
  
  .conversion-controls {
      flex-direction: row;
      justify-content: center;
      padding: 20px 0;
  }
  
  .info-section {
      flex-direction: column;
      gap: 20px;
      text-align: center;
  }
  
  .conversion-stats {
      justify-content: center;
  }
}

@media (max-width: 768px) {
  .container {
      padding: 25px 20px;
  }
  
  header h1 {
      font-size: 2.2rem;
  }
  
  .conversion-controls {
      flex-direction: column;
      gap: 15px;
  }
  
  .batch-actions {
      flex-direction: row;
      justify-content: center;
  }
  
  textarea {
      font-size: 1rem;
      padding: 20px;
      min-height: 150px;
  }
  
  .font-selector {
      flex-direction: column;
      align-items: stretch;
      gap: 8px;
  }
  
  .font-selector label {
      min-width: auto;
  }
}

@media (max-width: 480px) {
  .container {
      padding: 20px 15px;
  }
  
  header h1 {
      font-size: 1.8rem;
  }
  
  .conversion-stats {
      flex-direction: column;
      gap: 15px;
  }
  
  .textarea-footer {
      flex-direction: column;
      gap: 10px;
      align-items: stretch;
  }
  
  .action-btn {
      justify-content: center;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  * {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
      --border-light: #000000;
      --text-light: #000000;
      --background-light: #ffffff;
  }
}

/* Print styles */
@media print {
  body {
      background: white;
      color: black;
  }
  
  .container {
      box-shadow: none;
      border: 1px solid black;
  }
  
  .conversion-controls,
  .batch-actions,
  footer {
      display: none;
  }
}
