/*
 * components.css
 *
 * Contains styles for reusable UI components across the application,
 * such as cards, buttons, inputs, modals, etc.
 */

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  text-decoration: none;
  font-size: 14px;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.btn:hover::after {
  transform: translateX(100%);
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  color: white;
  box-shadow: 0 4px 14px rgba(30, 64, 175, 0.2);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(30, 64, 175, 0.3);
}
.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.btn-icon {
  width: 44px;
  height: 44px;
  padding: 10px;
  border-radius: 12px;
}

/* Language Button Special Styling */
#lang-btn-text {
  min-width: 24px;
  text-align: center;
  font-weight: 600;
}

/* Small Button Variant for Range Selection */
.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 8px;
  font-weight: 500;
  min-width: 60px;
  height: 36px;
}

/* Tool Button Active State */
.tool-btn.active {
  background: var(--primary-color) !important;
  color: white !important;
}

/* Disabled Button State */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Divider */
.divider-vertical {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 0 4px;
}

/* Input Styles */
.input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  transition: all 0.2s ease;
  font-size: 16px;
}
.input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(30, 64, 175, 0.1);
}
.select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
}

/* Small Input Variant */
.input-sm {
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 8px;
  height: 36px;
}

/* Range Selection Controls */
.range-selection-container {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.range-selection-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.range-selection-controls .range-label {
  font-size: 14px;
  color: var(--text-secondary);
  min-width: 24px;
  text-align: center;
}

.range-selection-controls .input-sm {
  width: 60px;
  text-align: center;
}

/* Color Input Styling */
input[type="color"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0;
  background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 8px;
}

input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 8px;
}

/* Range Slider */
.range-input {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Modal Styles */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.modal.active {
  opacity: 1;
  visibility: visible;
}
.modal-content {
  background: var(--bg-primary);
  border-radius: 20px;
  max-width: 95vw;
  max-height: 95vh;
  width: 1400px;
  height: 800px;
  display: flex;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}
.modal.active .modal-content {
  transform: scale(1);
}

/* Expanded Preview Mode */
.modal-content.expanded-preview {
  width: 95vw;
}

.modal-content.expanded-preview .collapsible-panel {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-content.expanded-preview .verse-panel {
  width: 280px;
  min-width: 280px;
}

.modal-content.expanded-preview .controls-panel {
  width: 320px;
  min-width: 320px;
}

.modal-content.expanded-preview .preview-panel {
  flex: 1;
  max-width: calc(100% - 600px);
}

/* Panel Styles */
.panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}
.panel-header h2 {
  color: var(--text-primary);
}
.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Verse Item Styles */
.verse-item {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
  position: relative;
}
.verse-item:hover {
  border-color: var(--primary-color);
  transform: translateX(-4px);
  box-shadow: var(--shadow-lg);
}
.verse-item.selected {
  border-color: var(--primary-color);
  background: rgba(59, 130, 246, 0.1);
}

/* Surah Card Styles */
.surah-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.surah-card::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--accent-color)
  );
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.surah-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.surah-card:hover::before {
  opacity: 1;
}

.surah-card > * {
  position: relative;
  z-index: 1;
}

.surah-card h3 {
  color: var(--text-primary);
}
.surah-card p,
.surah-card span {
  color: var(--text-secondary);
}

/* Preview Styles */
.preview-container {
  background: radial-gradient(
      circle at 20% 20%,
      rgba(30, 64, 175, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(14, 165, 233, 0.1) 0%,
      transparent 50%
    ),
    var(--bg-tertiary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
#live-preview {
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform-origin: center center;
  transition: transform 0.3s ease, background 0.3s ease;
  position: relative;
}

/* Draggable Cursor */
.draggable-cursor {
  cursor: grab !important;
}
.draggable-cursor:active {
  cursor: grabbing !important;
}

#preview-arabic,
#preview-english {
  transition: color 0.3s ease;
}
.transparent-preview {
  background: linear-gradient(135deg, #1f2937, #374151) !important;
}

/* Color Grid */
.color-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.color-btn {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 3px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.color-btn:hover {
  transform: scale(1.1);
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Control Section */
.control-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  margin-bottom: 20px;
  overflow: hidden;
}
.control-header {
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.control-header h3 {
  color: var(--text-primary);
}
.control-body {
  padding: 20px;
}

/* Toast Notifications */
.toast {
  position: relative;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  animation: slideInRight 0.3s ease-out;
  max-width: 400px;
  min-width: 300px;
  backdrop-filter: blur(10px);
  background: rgba(15, 23, 42, 0.95);
  transition: all 0.3s ease;
}

.toast::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 12px 0 0 12px;
}

.toast.success::before {
  background: var(--success-color);
}
.toast.error::before {
  background: var(--error-color);
}
.toast.warning::before {
  background: var(--warning-color);
}
.toast.info::before {
  background: var(--primary-color);
}

/* Loading Animation */
.loading-spinner {
  border: 3px solid var(--bg-tertiary);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  transition: width 0.3s ease;
  border-radius: 4px;
}

/* Aspect Ratio Buttons */
.radio-item {
  position: relative;
}
.radio-item input[type="radio"] {
  position: absolute;
  opacity: 0;
}
.radio-item input[type="radio"]:checked ~ .aspect-ratio-btn {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}
.aspect-ratio-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 4px;
  background: var(--bg-primary);
  color: var(--text-primary);
  width: 100%;
  height: 100%;
}
.aspect-ratio-btn:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

/* Export Progress Modal */
.export-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.export-modal.active {
  opacity: 1;
  visibility: visible;
}
.export-modal-content {
  background: var(--bg-primary);
  border-radius: 20px;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.export-modal-content h3 {
  color: var(--text-primary);
}

/* Custom Dimension Input */
.dimension-input {
  width: 100px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  text-align: center;
  font-size: 14px;
}
.dimension-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Error Message Styling */
.error-message {
  color: var(--error-color);
  font-size: 12px;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .range-selection-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .range-selection-controls .range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
  }

  .range-selection-controls .input-sm {
    width: 80px;
  }

  .btn-sm {
    width: 100%;
    margin-top: 8px;
  }
}
