/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Assistant", "Alef", sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
  line-height: 1.6;
  direction: rtl;
}

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

/* Header */
.header {
  text-align: center;
  margin-bottom: 40px;
  color: white;
  position: relative;
}

.logo {
  font-family: "Alef", sans-serif;
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.tagline {
  font-size: 1.2rem;
  opacity: 0.9;
  font-weight: 300;
}

/* Top Right Buttons */
.top-right-buttons {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 10px;
}

.circle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.circle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

/* Modal Styles */
.modal, .select-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.4);
  align-items: center;
  justify-content: center;
}

.modal-content, .select-modal-content {
  background: white;
  border-radius: 20px;
  padding: 30px;
  max-width: 500px;
  max-height: 80vh;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow-y: auto;
  text-align: right;
}

.close {
  position: absolute;
  top: 10px;
  right: 15px;
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: #000;
}

.modal h2, .select-modal h2 {
  margin-bottom: 20px;
  color: #2c3e50;
  text-align: right;
}

.modal h3 {
  margin: 20px 0 10px;
  color: #4facfe;
  text-align: right;
}

.warning {
  font-size: 0.9rem;
  color: #721c24;
  margin-top: 5px;
  text-align: right;
}

/* Select Modal Styles */
.select-trigger {
  width: 100%;
  padding: 15px;
  border: 2px solid #e1e8ed;
  border-radius: 12px;
  font-size: 1rem;
  font-family: "Assistant", sans-serif;
  background: #f8f9fa;
  text-align: right;
  cursor: pointer;
  transition: all 0.3s ease;
}

.select-trigger:hover {
  border-color: #4facfe;
  background: white;
}

.select-option {
  padding: 15px;
  cursor: pointer;
  transition: background 0.3s;
}

.select-option:hover {
  background: #e1e8ed;
}

/* Custom Input Styles */
.custom-input {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  font-size: 1rem;
  font-family: "Assistant", sans-serif;
  background: #f8f9fa;
  text-align: right;
  transition: all 0.3s ease;
}

.custom-input:focus {
  outline: none;
  border-color: #4facfe;
  background: white;
  box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

/* History List */
#historyList {
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background 0.3s;
  text-align: right;
}

.history-item:hover {
  background: #e1e8ed;
}

.history-item p {
  margin: 0;
  font-size: 1rem;
}

/* Cards */
.card {
  background: white;
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-align: right;
}

.step-card {
  transition: all 0.3s ease;
}

.step-header {
  display: flex;
  align-items: center;
  margin-bottom: 25px;
  gap: 15px;
}

.step-number {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.2rem;
}

.step-header h2 {
  font-family: "Alef", sans-serif;
  font-size: 1.8rem;
  color: #2c3e50;
}

/* Form Elements */
.input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-direction: column;
  align-items: flex-start;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 15px;
  border: 2px solid #e1e8ed;
  border-radius: 12px;
  font-size: 1rem;
  font-family: "Assistant", sans-serif;
  transition: all 0.3s ease;
  background: #f8f9fa;
  text-align: right;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #4facfe;
  background: white;
  box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

#scriptContent {
  min-height: 200px;
  font-family: "Courier New", monospace;
  line-height: 1.8;
  text-align: right;
}

/* Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.setting-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #2c3e50;
  text-align: right;
}

/* Buttons */
.btn {
  padding: 15px 30px;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: "Assistant", sans-serif;
  text-decoration: none;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 172, 254, 0.6);
}

.btn-secondary {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  color: #2c3e50;
}

.btn-secondary:hover {
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border: 2px solid #4facfe;
  color: #4facfe;
}

.btn-outline:hover {
  background: #4facfe;
  color: white;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Audio Player */
.audio-player {
  text-align: center;
  margin-bottom: 20px;
}

.audio-placeholder {
  background: #f8f9fa;
  padding: 40px;
  border-radius: 15px;
  color: #6c757d;
  font-style: italic;
  text-align: right;
}

#audioPlayer {
  width: 100%;
  max-width: 500px;
}

.audio-controls {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  flex-direction: row-reverse;
}

/* Status Messages */
.status-message {
  padding: 10px;
  border-radius: 8px;
  margin-top: 10px;
  font-weight: 500;
  text-align: right;
}

.status-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.error-message {
  background: #f8d7da;
  color: #721c24;
  padding: 15px;
  border-radius: 10px;
  margin: 20px 0;
  border: 1px solid #f5c6cb;
  text-align: right;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .logo {
    font-size: 2.5rem;
  }

  .card {
    padding: 20px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .input-group {
    flex-direction: column-reverse;
  }

  .audio-controls {
    flex-direction: column-reverse;
    align-items: center;
  }

  .top-right-buttons {
    top: 5px;
    right: 5px;
    gap: 5px;
  }

  .circle-btn {
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }

  .close {
    top: 5px;
    right: 10px;
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 2rem;
  }

  .step-header {
    flex-direction: column-reverse;
    text-align: center;
    gap: 10px;
  }

  .btn {
    width: 100%;
  }

  .modal-content, .select-modal-content {
    max-width: 90%;
    padding: 20px;
  }
}
