/* ===== Free Library Styles (Extracted from Canva Design) ===== */

/* Typography */
body {
  font-family: 'Fustat', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Icon Styles */
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
  vertical-align: middle;
  flex-shrink: 0;
}

.icon-sm {
  width: 20px;
  height: 20px;
}

.icon-md {
  width: 24px;
  height: 24px;
}

.icon-lg {
  width: 28px;
  height: 28px;
}

.icon-xl {
  width: 32px;
  height: 32px;
}

/* Section Title Icons */
h3 svg.icon {
  vertical-align: middle;
  margin-bottom: 4px;
}

.playfair {
  font-family: 'Playfair Display', Georgia, serif;
  letter-spacing: -0.02em;
}

/* Premium Card */
.premium-card {
  background: white;
  border-radius: 24px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.07);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

/* Buttons */
.btn-primary {
  background: #086788;
  color: white;
  border: none;
  padding: 20px 48px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 60px;
  cursor: pointer;
  transition: all 0.35s ease;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(8, 103, 136, 0.25);
  text-decoration: none;
}

.btn-primary svg {
  color: white;
  flex-shrink: 0;
}

.btn-primary:hover:not(:disabled):not(.disabled) {
  background: #00A8E8;
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 168, 232, 0.35);
  color: white;
  text-decoration: none;
}

.btn-primary:disabled,
.btn-primary.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary:disabled:hover,
.btn-primary.disabled:hover {
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: transparent;
  color: #086788;
  border: 2.5px solid #086788;
  padding: 18px 48px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 60px;
  cursor: pointer;
  transition: all 0.35s ease;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.btn-secondary svg {
  color: #086788;
  flex-shrink: 0;
}

.btn-secondary:hover {
  background: #086788;
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(8, 103, 136, 0.25);
  text-decoration: none;
}

.btn-secondary:hover svg {
  color: white;
}

/* Soft Blobs (Background Decorations) */
.soft-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
  pointer-events: none;
}

/* Trust Badge */
.trust-badge {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  padding: 14px 28px;
  border-radius: 40px;
  font-size: 15px;
  font-weight: 700;
  color: #086788;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 2px solid rgba(33, 193, 215, 0.2);
}

.trust-badge svg {
  color: #086788;
  flex-shrink: 0;
}

/* Filter Bar */
.filter-bar {
  background: white;
  border-radius: 28px;
  padding: 20px 28px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.07);
  border: 2px solid rgba(33, 193, 215, 0.08);
}

/* Modern Input */
.input-modern {
  border: 2px solid #e5e7eb;
  border-radius: 18px;
  padding: 18px 24px;
  font-size: 16px;
  background: #f8f9fa;
  transition: all 0.3s ease;
  font-weight: 500;
  width: 100%;
}

.input-modern:focus {
  outline: none;
  border-color: #21c1d7;
  background: white;
  box-shadow: 0 0 0 4px rgba(33, 193, 215, 0.1);
}

.input-modern::placeholder {
  color: #999;
}

/* Resource Card */
.resource-card {
  background: white;
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 2px solid transparent;
}

.resource-card:hover {
  border-color: rgba(33, 193, 215, 0.3);
}

.resource-cover {
  width: 100%;
  height: 260px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
}

.resource-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.resource-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
  z-index: 1;
}

/* Badges */
.badge-category {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  background: rgba(33, 193, 215, 0.12);
  color: #086788;
}

.badge-category svg {
  color: #086788;
  flex-shrink: 0;
}

.badge-age {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  background: rgba(102, 102, 102, 0.08);
  color: #666666;
}

.badge-age svg {
  color: #666666;
  flex-shrink: 0;
}

/* Step Container */
.step-container {
  background: white;
  border-radius: 28px;
  padding: 48px 36px;
  text-align: center;
  position: relative;
  border: 2px solid rgba(33, 193, 215, 0.08);
}

.step-icon {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
  background: linear-gradient(135deg, #21c1d7 0%, #00A8E8 100%);
  box-shadow: 0 12px 28px rgba(33, 193, 215, 0.35);
  position: relative;
}

.step-icon svg {
  width: 40px;
  height: 40px;
  stroke: currentColor;
}

.step-icon::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #21c1d7 0%, #00A8E8 100%);
  opacity: 0.15;
  z-index: -1;
}

/* CTA Bullet */
.cta-bullet {
  background: white;
  padding: 24px 28px;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 20px;
  border: 2px solid rgba(33, 193, 215, 0.08);
  transition: all 0.3s ease;
}

.cta-bullet:hover {
  border-color: rgba(33, 193, 215, 0.25);
  transform: translateX(-4px);
}

.cta-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #21c1d7, #00A8E8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(33, 193, 215, 0.3);
}

.cta-icon svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
}

/* Free Library Hero Section */
.free-library-hero {
  background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
  padding: 100px 40px 120px;
  position: relative;
  overflow: hidden;
}

.free-library-section {
  padding: 80px 40px;
}

.free-library-section.bg-light {
  background: #f8f9fa;
}

.free-library-section.bg-white {
  background: #ffffff;
}

.free-library-section.bg-gradient {
  background: linear-gradient(135deg, rgba(33, 193, 215, 0.06) 0%, rgba(8, 103, 136, 0.08) 100%);
  position: relative;
  overflow: hidden;
}

/* Resources Grid */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 32px;
}

/* Steps Grid */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 40px;
}

/* Clear Button */
.btn-clear {
  background: #f8f9fa;
  color: #666666;
  border: 2px solid #e5e7eb;
  padding: 18px 28px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  height: 58px;
}

.btn-clear:hover {
  background: #e5e7eb;
  color: #2a3d44;
}

/* Resource Card Buttons */
.resource-card-btn {
  flex: 1;
  background: #086788;
  color: white;
  border: none;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.resource-card-btn svg {
  color: white;
  flex-shrink: 0;
}

.resource-card-btn:hover:not(:disabled):not(.disabled) {
  background: #00A8E8;
  transform: translateY(-2px);
}

.resource-card-btn:disabled,
.resource-card-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Compact Resource Card Buttons (for AR/EN version buttons) */
.resource-card-btn-compact {
  background: #086788;
  color: white;
  border: none;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  min-height: 44px;
}

.resource-card-btn-compact svg {
  color: white;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.resource-card-btn-compact:hover:not(:disabled):not(.disabled) {
  background: #00A8E8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 168, 232, 0.25);
}

.resource-card-btn-compact:disabled,
.resource-card-btn-compact.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.resource-card-btn-compact:disabled:hover,
.resource-card-btn-compact.disabled:hover {
  transform: none;
  box-shadow: none;
}

.resource-card-link {
  background: transparent;
  color: #086788;
  border: none;
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 0.3s ease;
}

.resource-card-link svg {
  color: #086788;
  flex-shrink: 0;
}

.resource-card-link:hover {
  color: #21c1d7;
}

.resource-card-link:hover svg {
  color: #21c1d7;
}

/* RTL Support */
[dir="rtl"] .free-library-hero,
[dir="rtl"] .free-library-section {
  text-align: right;
}

[dir="rtl"] .cta-bullet {
  flex-direction: row-reverse;
}

[dir="rtl"] .badge-category,
[dir="rtl"] .badge-age {
  direction: rtl;
}

[dir="rtl"] .resource-card-btn,
[dir="rtl"] .resource-card-link {
  direction: rtl;
}

/* FAQ Accordion Styling */
.accordion-item {
  transition: all 0.3s ease;
}

.accordion-button {
  transition: all 0.3s ease;
}

.accordion-button:not(.collapsed) {
  background: #f8f9fa;
  color: #086788;
}

.accordion-button:focus {
  box-shadow: 0 0 0 0.25rem rgba(8, 103, 136, 0.15);
  border-color: transparent;
}

.accordion-button::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23086788'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
  transition: transform 0.3s ease;
}

[dir="rtl"] .accordion-button::after {
  transform: rotate(-90deg);
}

[dir="rtl"] .accordion-button:not(.collapsed)::after {
  transform: rotate(90deg);
}

.accordion-collapse {
  transition: height 0.35s ease;
}

/* Download Buttons Container */
.download-buttons-container {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .download-buttons-container {
    flex-direction: column;
  }
  
  .download-buttons-container > div {
    width: 100%;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .free-library-hero {
    padding: 60px 24px 80px;
  }

  .free-library-section {
    padding: 60px 24px;
  }

  .resource-cover {
    height: 220px;
  }

  .step-container {
    padding: 40px 28px;
  }

  .step-icon {
    width: 76px;
    height: 76px;
  }

  .step-icon svg {
    width: 36px;
    height: 36px;
  }

  .btn-primary,
  .btn-secondary {
    padding: 18px 40px;
    font-size: 16px;
  }

  .resources-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .steps-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  /* Ensure compact buttons don't overflow on mobile */
  .resource-card .resource-card-btn-compact {
    font-size: 12px;
    padding: 10px 10px;
    gap: 4px;
  }

  .resource-card .resource-card-btn-compact svg {
    width: 16px;
    height: 16px;
  }

  .filter-bar {
    padding: 16px 20px;
  }

  .filter-bar form[style*="grid"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .filter-bar form > * {
    width: 100% !important;
  }

  .cta-bullet {
    padding: 20px 24px;
  }

  .cta-bullet:hover {
    transform: translateX(0);
  }

  [dir="rtl"] .cta-bullet:hover {
    transform: translateX(0);
  }
}

@media (max-width: 576px) {
  .free-library-hero {
    padding: 40px 16px 60px;
  }

  .free-library-section {
    padding: 40px 16px;
  }

  .resource-card-btn-compact {
    padding: 10px 12px;
    font-size: 13px;
    min-height: 40px;
    gap: 4px;
  }

  .resource-card-btn-compact span {
    font-size: 12px;
  }

  /* Stack buttons vertically on very small screens if needed */
  .resource-card .resource-card-btn-compact {
    min-width: 0;
  }

  .btn-primary,
  .btn-secondary {
    padding: 16px 32px;
    font-size: 15px;
    width: 100%;
    justify-content: center;
  }

  .trust-badge {
    padding: 12px 20px;
    font-size: 14px;
  }
}

/* Mobile Typography Fix - Prevent Overlapping Text */
@media (max-width: 480px) {
  .free-library-section h3 {
    font-size: clamp(28px, 8vw, 38px) !important;
    line-height: 1.15 !important;
    letter-spacing: -0.01em;
  }

  .free-library-section h3.playfair {
    font-size: clamp(32px, 9vw, 42px) !important;
    line-height: 1.15 !important;
    letter-spacing: -0.01em;
  }

  .free-library-section p {
    font-size: 15px !important;
    line-height: 1.6 !important;
  }

  .step-container h4 {
    font-size: clamp(20px, 6vw, 24px) !important;
    line-height: 1.2 !important;
  }

  .step-container p {
    font-size: 15px !important;
    line-height: 1.6 !important;
  }

  .cta-bullet p {
    font-size: 17px !important;
    line-height: 1.5 !important;
  }
}

/* ===== Free Library Download Modal Styles ===== */
.free-dl-modal {
  padding: 0;
}

#downloadModal .modal-body {
  padding: 20px;
}

#downloadModal .modal-header {
  padding: 15px 20px 0;
}

.free-dl-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.free-dl-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #e7f6fb;
  color: #0f6f86;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.free-dl-title {
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #000;
  margin: 0;
  font-size: 20px;
}

.free-dl-sub {
  color: #6b7b86;
  font-size: 13px;
  margin: 0;
}

.free-dl-card {
  background: #fff;
  border: 1px solid #eef2f5;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.free-dl-label {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
  display: block;
  color: #2a3d44;
}

.free-dl-help {
  display: block;
  margin-top: 6px;
  color: #6b7b86;
  font-size: 12px;
  line-height: 1.4;
}

.free-dl-phone {
  display: flex;
  gap: 10px;
  margin-bottom: 4px;
}

.free-dl-country {
  width: 170px;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 500;
  background: #f8f9fa;
  transition: all 0.3s ease;
}

.free-dl-country:focus {
  outline: none;
  border-color: #21c1d7;
  background: white;
  box-shadow: 0 0 0 4px rgba(33, 193, 215, 0.1);
}

.free-dl-phone-input {
  flex: 1;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 500;
  background: #f8f9fa;
  transition: all 0.3s ease;
}

.free-dl-phone-input:focus {
  outline: none;
  border-color: #21c1d7;
  background: white;
  box-shadow: 0 0 0 4px rgba(33, 193, 215, 0.1);
}

.free-dl-phone-input::placeholder {
  color: #999;
}

.free-dl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.free-dl-consent {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #e7edf1;
}

.free-dl-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0;
  font-size: 13px;
  color: #22313b;
  cursor: pointer;
}

.free-dl-check input[type="checkbox"] {
  margin-top: 3px;
  cursor: pointer;
  flex-shrink: 0;
}

.free-dl-check span {
  line-height: 1.5;
}

/* RTL Support for Modal */
[dir="rtl"] .free-dl-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .free-dl-phone {
  flex-direction: row-reverse;
}

[dir="rtl"] .free-dl-grid {
  direction: rtl;
}

[dir="rtl"] .free-dl-check {
  flex-direction: row-reverse;
}

/* Responsive */
@media (max-width: 576px) {
  .free-dl-country {
    width: 150px;
  }
  
  .free-dl-grid {
    grid-template-columns: 1fr;
  }
  
  .free-dl-header {
    gap: 10px;
  }
  
  .free-dl-icon {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  
  .free-dl-title {
    font-size: 18px;
  }
  
  .free-dl-sub {
    font-size: 12px;
  }
}

/* Mobile compact modal for Quran Kids landing page */
@media (max-width: 768px) {
  /* Make modal card smaller */
  #downloadModal .modal-content,
  #downloadModal .modal-dialog {
    width: calc(100vw - 24px) !important;
    max-width: 420px !important;
    margin: 12px auto !important;
  }

  #downloadModal .modal-body {
    padding: 12px 16px 16px !important;
  }

  #downloadModal .free-dl-card {
    padding: 12px !important;
    border-radius: 12px !important;
  }

  /* Reduce title size */
  #downloadModal .free-dl-title,
  #downloadModal h4 {
    font-size: 18px !important;
    line-height: 1.25 !important;
    margin: 6px 0 10px !important;
  }

  /* Remove/hide description text to shrink */
  #downloadModal .free-dl-sub,
  #downloadModal .modal-subtitle,
  #downloadModal .free-dl-header p {
    display: none !important;
  }

  /* Tighten form spacing */
  #downloadModal .form-group,
  #downloadModal .field {
    margin-bottom: 10px !important;
  }

  #downloadModal input,
  #downloadModal select {
    padding: 12px 12px !important;
    font-size: 14px !important;
  }

  /* Smaller CTA button */
  #downloadModal .btn,
  #downloadModal button[type="submit"] {
    padding: 12px 14px !important;
    font-size: 15px !important;
    border-radius: 12px !important;
  }

  /* Reduce header icon size */
  #downloadModal .free-dl-icon {
    width: 36px !important;
    height: 36px !important;
    font-size: 14px !important;
  }

  /* Reduce header gap */
  #downloadModal .free-dl-header {
    margin-bottom: 10px !important;
    gap: 8px !important;
  }

  /* Reduce modal header padding */
  #downloadModal .modal-header {
    padding: 8px 12px 0 !important;
  }

  /* Compact free-dl-modal container */
  #downloadModal .free-dl-modal {
    padding: 0 !important;
  }
}

