:root {
  --marjane-blue: #004b93;
  --marjane-blue-dark: #003366;
  --marjane-yellow: #ffc72c;
  --marjane-red: #e60000;
  --marjane-bg: #f4f6f9;
  --card-radius: 12px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--marjane-bg);
  color: #2b2d42;
  min-height: 100vh;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
}

/* Responsive typography */
h1, .h1 {
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  line-height: 1.25;
}

h2, .h2 {
  font-size: clamp(1.2rem, 2.5vw, 1.75rem);
  line-height: 1.3;
}

h3, .h3 {
  font-size: clamp(1.05rem, 2vw, 1.4rem);
  line-height: 1.35;
}

/* Navbar */
.navbar-marjane {
  background-color: var(--marjane-blue);
  box-shadow: 0 4px 12px rgba(0, 51, 102, 0.2);
  border-bottom: 3px solid var(--marjane-yellow);
}

.navbar-marjane .nav-link {
  color: #ffffff;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.navbar-marjane .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.navbar-marjane .nav-link.active {
  background-color: var(--marjane-yellow);
  color: #003366;
  font-weight: 600;
}

.card-custom {
  background: #ffffff;
  border-radius: var(--card-radius);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* Hero Banner */
.hero-banner {
  background: linear-gradient(rgba(0, 75, 147, 0.88), rgba(0, 51, 102, 0.88)), url('marjane_banner.jpg');
  background-size: cover;
  background-position: center;
  color: #ffffff;
  border-radius: var(--card-radius);
  padding: clamp(1.25rem, 3.5vw, 2.5rem) clamp(1rem, 3vw, 2rem);
  box-shadow: 0 6px 20px rgba(0, 51, 102, 0.2);
  border-left: 6px solid var(--marjane-yellow);
}

/* Statistics cards */
.stat-card {
  background: #ffffff;
  border-radius: var(--card-radius);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  padding: 1.15rem;
  transition: transform 0.2s;
  height: 100%;
}

.stat-card:hover {
  transform: translateY(-3px);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.stat-val {
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight: 700;
}

/* Field blocks */
.field-block {
  background: #ffffff;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  transition: all 0.2s;
}

.field-block:focus-within {
  border-color: var(--marjane-blue);
  box-shadow: 0 0 0 3px rgba(0, 75, 147, 0.12);
}

.field-icon {
  display: inline-block;
  margin-bottom: 0.25rem;
  font-size: 1.2rem;
}

.field-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e293b;
  margin-bottom: 0.35rem;
}

.field-divider {
  height: 2px;
  background: linear-gradient(to right, var(--marjane-blue), #cbd5e1);
  margin-bottom: 0.75rem;
  border-radius: 2px;
}

/* Circular Arrow Navigation Buttons */
.btn-arrow-nav {
  width: clamp(52px, 7vw, 65px);
  height: clamp(52px, 7vw, 65px);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.4rem, 2.2vw, 1.8rem);
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease-in-out;
  border: none;
  cursor: pointer;
}

.btn-arrow-nav:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.btn-arrow-left {
  background-color: #ff9f1c;
  color: #ffffff;
}

.btn-arrow-left:hover {
  background-color: #f38b00;
  color: #ffffff;
}

.btn-arrow-right {
  background-color: var(--marjane-blue);
  color: #ffffff;
}

.btn-arrow-right:hover {
  background-color: var(--marjane-blue-dark);
  color: #ffffff;
}

.arrow-label {
  font-weight: 600;
  font-size: 0.85rem;
  margin-top: 0.35rem;
  text-transform: uppercase;
}

/* Badges */
.badge-actif {
  background-color: #d1e7dd;
  color: #0f5132;
  border: 1px solid #badbcc;
  padding: 0.35rem 0.75rem;
  border-radius: 50rem;
  display: inline-block;
  font-weight: 500;
}

.badge-panne {
  background-color: #f8d7da;
  color: var(--marjane-red);
  border: 1px solid #f5c2c7;
  padding: 0.35rem 0.75rem;
  border-radius: 50rem;
  display: inline-block;
  font-weight: 500;
}

.badge-maintenance {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  padding: 0.35rem 0.75rem;
  border-radius: 50rem;
  display: inline-block;
  font-weight: 500;
}

.badge-massira {
  background-color: #e0f2fe;
  color: #0369a1;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  display: inline-block;
}

.badge-menara {
  background-color: #fef3c7;
  color: #92400e;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  display: inline-block;
}

.footer-marjane {
  background-color: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 1.25rem 0;
  margin-top: auto;
  font-size: 0.85rem;
  color: #64748b;
  width: 100%;
}

/* Demo Environment Topbar & Badges */
.demo-topbar {
  background-color: #1a1e24 !important;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.demo-topbar .btn-xs {
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  line-height: 1.3;
  min-height: 36px;
}

.demo-topbar .btn-outline-warning:hover {
  background-color: var(--marjane-yellow);
  color: #000000;
}

/* Responsive Table Wrapper */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

/* Mobile-Friendly Cards for Equipment */
.equipment-card-mobile {
  display: none;
}

@media (max-width: 767.98px) {
  .equipment-table-desktop {
    display: none !important;
  }

  .equipment-card-mobile {
    display: block !important;
  }

  .demo-topbar {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }

  input, select, textarea {
    font-size: 16px !important; /* Prevents auto-zoom on iOS */
    min-height: 44px;
  }

  .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .navbar-nav .nav-link {
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
  }
}

@media (min-width: 768px) {
  .equipment-card-mobile {
    display: none !important;
  }
}

/* Touch target minimum accessibility */
.btn-sm {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Accessible focus styling */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--marjane-yellow);
  outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
