/* Import Yakout Linotype font */
@font-face {
  font-family: 'Yakout Linotype';
  src: url('../fonts/Yakout Linotype.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  /* Improve font loading performance */
}

/* ================ CORE STYLES ================ */
:root {
  --primary-color: #0d6efd;
  --success-color: #198754;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --text-dark: #333;
  --text-muted: #6c757d;
  --bg-light: #e9ecef;
  --border-radius: 0.5rem;
  --border-radius-lg: 1rem;
  --box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

/* Base Styles */
body {
  background-color: var(--bg-light);
  direction: rtl;
  font-family: 'Noto Naskh Arabic', 'Yakout Linotype', sans-serif;
  text-align: right;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

/* Standardized Container */
.converter-container {
  max-width: 576px;
  margin: 2rem auto;
  background: white;
  padding: 2rem;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow);
}

/* Typography */
h1,
h2,
h3,
h4 {
  color: #2d1e61;
  font-weight: bold;
  margin-bottom: 1rem;
}

h2 {
  font-weight: 600;
  color: var(--primary-color);
}

/* Standardized Card */
.card {
  background: white;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow);
  padding: 1.5rem;
  margin: 1rem 0;
  transition: var(--transition);
}

/* Standardized Form Elements */
.form-control,
.form-select,
input,
select,
textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: var(--border-radius);
  transition: var(--transition);
  font-size: 1rem;
  background-color: #fff;
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
  outline: none;
}

.form-label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

.input-group {
  margin-bottom: 1rem;
  position: relative;
}

/* Standardized Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius);
  font-weight: 600;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1rem;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: #0b5ed7;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

.btn-outline-primary {
  background-color: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-outline-primary:hover,
.btn-outline-primary.active {
  background-color: var(--primary-color);
  color: white;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #5c636a;
}

.btn-success {
  background-color: var(--success-color);
  color: white;
}

.btn-success:hover {
  background-color: #157347;
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background-color: #bb2d3b;
}

.btn-block {
  display: block;
  width: 100%;
}

/* Button Groups */
.btn-group {
  display: flex;
  flex-wrap: wrap;
}

.btn-group .btn {
  flex: 1;
  min-width: 100px;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-4px);
  }

  50% {
    transform: translateX(4px);
  }

  75% {
    transform: translateX(-4px);
  }

  100% {
    transform: translateX(0);
  }
}

/* Results & Feedback */
.result-box {
  background: var(--bg-light);
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.error-message {
  background: #ffebee;
  color: var(--danger-color);
  padding: 0.8rem;
  border-left: 4px solid var(--danger-color);
  border-radius: var(--border-radius);
}

/* Shared result state helpers */
.result-blue {
  background-color: #cce5ff;
  color: #004085;
  border: 1px solid #b3d7ff;
  border-radius: var(--border-radius);
  ;
  padding: 8px;
}

.result-green {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  border-radius: var(--border-radius);
  padding: 8px;
}

.result-orange {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  border-radius: var(--border-radius);
  padding: 8px;
}

.result-red {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: var(--border-radius);
  padding: 8px;
}

.result-red-dark {
  background-color: #f5c6cb;
  color: #491217;
  border: 1px solid #f1b0b7;
  border-radius: var(--border-radius);
  padding: 8px;
}

/* Input validation helpers */
.input-error {
  border: 2px solid var(--danger-color);
  background-color: #fff5f5;
}

.input-error-msg {
  color: var(--danger-color);
  font-size: 0.875rem;
  margin-top: 0.25rem;
  display: block;
}

.fade-out {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fade-in {
  animation: fadeIn 0.6s ease-in-out;
}

/* Utility Classes */
.text-end {
  text-align: right !important;
}

.text-center {
  text-align: center !important;
}

.mb-3 {
  margin-bottom: 1rem !important;
}

.mb-4 {
  margin-bottom: 1.5rem !important;
}

.mt-3 {
  margin-top: 1rem !important;
}

.mt-4 {
  margin-top: 1.5rem !important;
}

.d-flex {
  display: flex !important;
}

.justify-content-between {
  justify-content: space-between !important;
}

.align-items-center {
  align-items: center !important;
}

.w-100 {
  width: 100% !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .converter-container {
    margin: 1rem;
    padding: 1.5rem;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn-group .btn {
    width: 100%;
  }
}

@media (max-width: 576px) {
  .converter-container {
    margin: 0.5rem;
    padding: 1rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .form-control,
  .form-select,
  input,
  select,
  textarea {
    font-size: 0.9rem;
    padding: 0.6rem;
  }

  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
}

/* RTL Specific Styles */
.form-select {
  background-position: left 0.75rem center;
  padding-left: 2.5rem;
  padding-right: 0.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23333' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 1rem;
}

/* Tab Styles */
.tab:not(button) {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: #6c757d;
  color: white;
  font-weight: 600;
  margin: 0.25rem;
  cursor: pointer;
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.tab:not(button):hover,
.tab:not(button).active {
  background-color: var(--primary-color);
}

/* Output Text Styling */
.output-text {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  transition: var(--transition);
}

/* Footer Styles */
footer {
  font-size: 0.875rem;
  text-align: center;
  color: var(--text-muted);
  margin-top: 2rem;
  padding: 1rem;
  border-top: 1px solid #dee2e6;
}

footer a {
  color: var(--primary-color);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.aldayel {
  color: #2563eb9e;
}