/**
 * Main Stylesheet - Perfectly Aligned Layout & Typography
 * Manacaud Iqrah Islamic Academy
 */

@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Cinzel:wght@500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');
@import url('islamic-theme.css');

/* Universal Box Sizing & Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-primary);
  background-color: var(--color-ivory);
  color: var(--color-charcoal);
  margin: 0;
  padding: 0;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-emerald-deep);
  text-decoration: none;
  transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
}

a:hover {
  color: var(--color-gold);
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-forest-dark);
  margin-top: 0;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.1rem, 4vw, 3.25rem); }
h2 { font-size: clamp(1.65rem, 3vw, 2.35rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.6rem); }
h4 { font-size: 1.2rem; }
h5 { font-size: 1.05rem; }
h6 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; }

p {
  margin-top: 0;
  margin-bottom: 1.25rem;
  color: var(--color-charcoal-light);
}

p:last-child {
  margin-bottom: 0;
}

/* Container & Grid System */
.container {
  width: 100%;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

.container-narrow {
  width: 100%;
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

.container-fluid {
  width: 100%;
  padding-left: 24px;
  padding-right: 24px;
}

.grid {
  display: grid;
  gap: 30px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .grid-2 { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 680px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; gap: 24px; }
  .container, .container-narrow, .container-fluid { padding-left: 18px; padding-right: 18px; }
}

/* Section Spacing & Standard Headers */
.section {
  padding: 84px 0;
  position: relative;
}

.section-sm {
  padding: 52px 0;
}

.section-title-wrap {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 50px;
}

.section-subtitle {
  color: var(--color-gold);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.825rem;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  display: block;
}

/* Islamic Section Dividers */
.section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px auto 16px;
  gap: 14px;
  width: 100%;
  max-width: 280px;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
}

.section-divider.divider-left {
  justify-content: flex-start;
  margin: 12px 0 20px;
}

.section-divider.divider-left::before {
  display: none;
}

.section-divider.divider-left::after {
  flex: 0 0 160px;
  background: linear-gradient(90deg, var(--color-gold), transparent);
}

.section-divider-icon {
  width: 32px;
  height: 16px;
  background-image: url('../images/patterns/arch-ornament.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  flex-shrink: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-base);
  text-align: center;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-emerald-deep);
  color: #ffffff;
  border-color: var(--color-emerald-deep);
  box-shadow: 0 4px 14px rgba(6, 78, 59, 0.25);
}

.btn-primary:hover {
  background: var(--color-forest-dark);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 78, 59, 0.35);
}

.btn-gold {
  background: var(--color-gold);
  color: var(--color-forest-dark);
  border-color: var(--color-gold);
  box-shadow: 0 4px 14px rgba(201, 162, 39, 0.3);
}

.btn-gold:hover {
  background: var(--color-gold-light);
  color: var(--color-forest-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(201, 162, 39, 0.4);
}

.btn-outline-gold {
  background: transparent;
  color: var(--color-gold);
  border-color: var(--color-gold);
}

.btn-outline-gold:hover {
  background: var(--color-gold);
  color: var(--color-forest-dark);
}

.btn-outline-white {
  background: transparent;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.7);
}

.btn-outline-white:hover {
  background: #ffffff;
  color: var(--color-emerald-deep);
  border-color: #ffffff;
}

.btn-sm {
  padding: 7px 16px;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 15px 32px;
  font-size: 1.05rem;
}

/* Card Architecture - Equal Heights */
.card {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(201, 162, 39, 0.45);
}

.card-body {
  padding: 28px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Forms Alignment */
.form-group {
  margin-bottom: 22px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-forest-dark);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  height: 46px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--color-charcoal);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-emerald-deep);
  box-shadow: 0 0 0 3px rgba(6, 78, 59, 0.15);
}

select.form-control {
  cursor: pointer;
  appearance: auto;
}

textarea.form-control {
  height: auto;
  min-height: 120px;
  padding: 12px 16px;
  resize: vertical;
}

.form-text {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 4px;
  display: block;
}

/* Flash Alerts */
.flash-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  border-left: 5px solid transparent;
}

.alert-success {
  background: #E8F5E9;
  color: #1B5E20;
  border-left-color: #2E7D32;
}

.alert-danger {
  background: #FFEBEE;
  color: #B71C1C;
  border-left-color: #C62828;
}

.alert-info {
  background: #E0F2F1;
  color: #004D40;
  border-left-color: var(--color-emerald-deep);
}

.alert-warning {
  background: #FFF8E1;
  color: #F57F17;
  border-left-color: var(--color-gold);
}

.alert-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
}

.alert-close:hover { opacity: 1; }

/* Breadcrumbs */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
  font-size: 0.875rem;
}

.breadcrumb li a {
  color: rgba(255, 255, 255, 0.8);
}

.breadcrumb li a:hover {
  color: var(--color-gold);
}

.breadcrumb li::after {
  content: '/';
  margin-left: 8px;
  color: rgba(255, 255, 255, 0.4);
}

.breadcrumb li:last-child::after {
  content: '';
}

.breadcrumb li.active {
  color: var(--color-gold);
  font-weight: 600;
}

/* Page Banner */
.page-banner {
  background: var(--color-emerald-deep);
  background-image: linear-gradient(135deg, rgba(6, 78, 59, 0.95) 0%, rgba(18, 55, 42, 0.98) 100%), url('../images/patterns/islamic-pattern.svg');
  background-size: auto, 70px 70px;
  padding: 64px 0 68px;
  color: #ffffff;
  position: relative;
  border-bottom: 3px solid var(--color-gold);
}

.page-banner h1 {
  color: #ffffff;
  margin: 0 0 10px 0;
  font-size: clamp(2rem, 3.6vw, 2.75rem);
}

.page-banner p {
  color: rgba(247, 243, 233, 0.92);
  max-width: 740px;
  font-size: 1.05rem;
  line-height: 1.65;
  margin: 0;
}

/* Floating Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-emerald-deep);
  color: var(--color-gold);
  border: 2px solid var(--color-gold);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--transition-base);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--color-gold);
  color: var(--color-forest-dark);
  transform: translateY(-3px);
}
