/* Arabic Calligraphy Generator - WordPress Plugin Styles */
/* Matching the exact React app design */

.arabic-calligraphy-container {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #fafafa;
  min-height: 100vh;
  color: #374151;
  line-height: 1.5;
}

.calligraphy-wrapper {
  max-width: 100%;
  padding: 0.75rem;
}

/* Header */
.calligraphy-header {
  background: linear-gradient(135deg, #FF8C00 0%, #32CD32 100%);
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.title-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.main-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.title-icon {
  font-size: 1.75rem;
}

.subtitle {
  margin: 0;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

.export-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.export-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  min-height: 2.75rem;
  touch-action: manipulation;
}

.export-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.export-btn:active {
  transform: translateY(0);
}

.btn-icon {
  font-size: 0.875rem;
}

/* Main Content Layout */
.main-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 1024px) {
  .main-content {
    grid-template-columns: 5fr 7fr;
  }
}

/* Control Sections */
.control-section {
  background: white;
  border-radius: 1rem;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.section-title {
  background: linear-gradient(135deg, #FF8C00 0%, #32CD32 100%);
  color: white;
  padding: 0.875rem 1rem;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.section-content {
  padding: 1rem;
}

.section-footer {
  margin-top: 0.5rem;
  display: flex;
  justify-content: flex-end;
}

/* Text Input */
.text-input {
  width: 100%;
  height: 6rem;
  border-radius: 1rem;
  border: 1px solid #d1d5db;
  padding: 0.75rem;
  font-size: 0.875rem;
  background: #fafafa;
  color: #374151;
  resize: vertical;
  font-family: "Aref Ruqaa", Arial, sans-serif;
  font-weight: 700;
  direction: rtl;
  unicode-bidi: bidi-override;
}

.text-input:focus {
  outline: none;
  ring: 2px;
  ring-color: #FF8C00;
  border-color: #FF8C00;
}

.reset-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #6b7280;
  cursor: pointer;
  min-height: 2.25rem;
  touch-action: manipulation;
  transition: all 0.2s ease;
}

.reset-btn:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}

/* Control Grid */
.control-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .control-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.control-item {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.control-item.full-width {
  grid-column: 1 / -1;
}

.control-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  margin: 0;
}

/* Form Controls */
.font-select, .number-input {
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid #FF8C00;
  padding: 0.375rem 0.75rem;
  background: linear-gradient(to right, #FFF3E0, #F0FFF0);
  font-size: 0.75rem;
  min-height: 2rem;
  font-weight: 500;
  color: #1f2937;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.font-select:focus, .number-input:focus {
  outline: none;
  border-color: #32CD32;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.range-input {
  width: 100%;
  height: 0.375rem;
  background: #e5e7eb;
  border-radius: 0.25rem;
  appearance: none;
  cursor: pointer;
}

.range-input::-webkit-slider-thumb {
  appearance: none;
  width: 1rem;
  height: 1rem;
  background: linear-gradient(135deg, #FF8C00, #32CD32);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.range-input::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  background: linear-gradient(135deg, #FF8C00, #32CD32);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-value {
  font-size: 0.625rem;
  color: #6b7280;
  text-align: center;
}

.color-input {
  width: 100%;
  height: 2.5rem;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
  cursor: pointer;
}

.file-input {
  width: 100%;
  padding: 0.5rem;
  border: 2px dashed #d1d5db;
  border-radius: 0.5rem;
  background: #f9fafb;
  cursor: pointer;
  font-size: 0.75rem;
}

/* Toggle Controls */
.toggle-group {
  display: flex;
  gap: 0.25rem;
  background: #f3f4f6;
  border-radius: 0.5rem;
  padding: 0.25rem;
}

.toggle-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 2rem;
}

.toggle-btn.active {
  background: linear-gradient(135deg, #FF8C00, #32CD32);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-control {
  display: flex;
  align-items: center;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
}

.toggle-label input[type="checkbox"] {
  display: none;
}

.toggle-slider {
  width: 2.5rem;
  height: 1.25rem;
  background: #d1d5db;
  border-radius: 1rem;
  position: relative;
  transition: background 0.2s ease;
}

.toggle-slider::after {
  content: '';
  width: 1rem;
  height: 1rem;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider {
  background: linear-gradient(135deg, #FF8C00, #32CD32);
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider::after {
  transform: translateX(1.25rem);
}

/* Alignment Buttons */
.alignment-buttons {
  display: flex;
  gap: 0.25rem;
}

.align-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 0.75rem;
  cursor: pointer;
  min-height: 2.75rem;
  touch-action: manipulation;
  transition: all 0.2s ease;
}

.align-btn.active {
  background: linear-gradient(135deg, #FF8C00, #32CD32);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.align-btn:hover:not(.active) {
  background: #e5e7eb;
  border-color: #9ca3af;
}

.align-icon {
  font-size: 0.875rem;
}

.align-text {
  font-weight: 500;
}

/* Preview Panel */
.preview-panel {
  background: white;
  border-radius: 1rem;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

.preview-container {
  width: 100%;
  aspect-ratio: 4/3;
  min-height: 18.75rem;
  background: #FF8C00;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.preview-text {
  width: calc(100% - 5rem);
  max-width: 95%;
  text-align: center;
  direction: rtl;
  unicode-bidi: bidi-override;
  font-family: "Aref Ruqaa", Arial, sans-serif;
  font-weight: 700;
  font-size: 120px;
  line-height: 1.05;
  letter-spacing: -0.6px;
  color: transparent;
  background: linear-gradient(75deg, #FFFFFF, #32CD32);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: 1.5px #111827;
  text-shadow: 8px 8px 4px rgba(0, 0, 0, 0.3);
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.625rem;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .calligraphy-wrapper {
    padding: 0.5rem;
  }
  
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .main-title {
    font-size: 1.25rem;
  }
  
  .export-buttons {
    width: 100%;
    justify-content: center;
  }
  
  .preview-text {
    font-size: 60px;
    padding: 0.5rem;
  }
  
  .control-grid {
    grid-template-columns: 1fr;
  }
  
  .alignment-buttons {
    flex-direction: column;
  }
  
  .align-btn {
    min-height: 3rem;
  }
}

@media (max-width: 480px) {
  .preview-text {
    font-size: 40px;
  }
  
  .export-btn {
    font-size: 0.6875rem;
    padding: 0.4375rem 0.625rem;
  }
}

/* Ensure no horizontal scrolling */
.arabic-calligraphy-container * {
  max-width: 100%;
  box-sizing: border-box;
}

/* Loading animation for fonts */
@keyframes fontLoad {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

.preview-text {
  animation: fontLoad 0.3s ease-in-out;
}