/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Noto Nastaliq Urdu", Arial, sans-serif;
  line-height: 1.6;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  direction: ltr; /* Override for interface */
}

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

/* Header */
header {
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

header h1 {
  font-size: 2.5rem;
  color: #333;
  margin-bottom: 10px;
  font-weight: 700;
}

header p {
  color: #666;
  font-size: 1.1rem;
}

/* Main content layout */
.main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Controls panel */
.controls-panel {
  background: rgba(255, 255, 255, 0.95);
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  max-height: 80vh;
  overflow-y: auto;
}

.control-section {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.control-section:last-child {
  border-bottom: none;
}

.control-section h3 {
  font-size: 1.3rem;
  color: #333;
  margin-bottom: 15px;
  font-weight: 600;
}

.form-row {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}

.form-row label {
  min-width: 120px;
  font-weight: 500;
  color: #555;
}

/* Form inputs */
input[type="number"],
input[type="range"],
input[type="color"],
select,
textarea {
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="number"],
select {
  flex: 1;
  max-width: 120px;
}

input[type="range"] {
  flex: 1;
  max-width: 150px;
}

input[type="color"] {
  width: 50px;
  height: 35px;
  border-radius: 8px;
  cursor: pointer;
}

textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  font-family: "Noto Nastaliq Urdu", Arial, sans-serif;
  direction: rtl;
  text-align: right;
  line-height: 1.8;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Range input styling */
input[type="range"] {
  -webkit-appearance: none;
  height: 6px;
  background: #ddd;
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: #667eea;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #667eea;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Template buttons */
.text-templates {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.text-templates small {
  color: #666;
  margin-right: 10px;
  font-weight: 500;
}

.template-btn {
  background: #f8f9fa;
  border: 1px solid #ddd;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  margin: 2px;
  cursor: pointer;
  color: #555;
  transition: all 0.2s;
}

.template-btn:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
}
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn.primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn.secondary {
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
}

.btn.secondary:hover {
  background: #667eea;
  color: white;
  transform: translateY(-2px);
}

.export-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.quality-info {
  color: #666;
  font-style: italic;
}

/* Preview panel */
.preview-panel {
  background: rgba(255, 255, 255, 0.95);
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.card-preview {
  border: 2px dashed #ddd;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
  background: #f9f9f9;
  min-height: 300px;
  max-width: 100%;
  overflow: hidden;
}

.preview-placeholder {
  color: #999;
  font-size: 18px;
  text-align: center;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
}

.preview-placeholder.error {
  color: #f44336;
  font-weight: 500;
  background: rgba(244, 67, 54, 0.1);
  border: 2px dashed #f44336;
  border-radius: 8px;
  margin: 10px;
}

.preview-placeholder.error::before {
  content: "⚠️";
  font-size: 24px;
  margin-bottom: 8px;
}

.card-preview img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.preview-info {
  color: #666;
  font-weight: 500;
  font-size: 14px;
}

/* Footer */
.footer {
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 15px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.footer p {
  color: #666;
  margin: 0;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  color: white;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

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

/* Responsive design */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .controls-panel {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  header h1 {
    font-size: 2rem;
  }

  .controls-panel,
  .preview-panel {
    padding: 20px;
  }

  .form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .form-row label {
    min-width: auto;
    margin-bottom: 5px;
  }

  input[type="number"],
  select {
    max-width: none;
  }

  .export-buttons {
    flex-direction: column;
  }
}

/* Scrollbar styling */
.controls-panel::-webkit-scrollbar {
  width: 8px;
}

.controls-panel::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.controls-panel::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.controls-panel::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Value display styling */
#fontSizeValue,
#lineSpacingValue {
  min-width: 50px;
  color: #667eea;
  font-weight: 600;
  font-size: 13px;
}
