/* 
===========================================
CORE STYLES - Optimized and organized version
===========================================
*/

/* Base reset and box model */
*, *::before, *::after {
  box-sizing: border-box;
}

/* 1. Variables and Root Typography */
:root {
    --font-min: 0.875rem;   /* 14px */
    --font-max: 1.125rem;   /* 18px */
    --primary: #4AB0FF;
    --secondary: #A0E9FD;
    --accent-er: #FFAB91;
    --accent-wd: #4AB0FF;
    --accent-bu: #FFC107;
    --bg: #F5F7FA;
    
    /* Adding transitions as variables for consistency */
    --transition-standard: all 0.2s ease-in-out;
    --box-shadow-card: 0 8px 20px rgba(0,0,0,0.05);
    --box-shadow-card-hover: 0 12px 24px rgba(0,0,0,0.1);
}

/* Font optimization - Preloaded in critical CSS */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400;
  font-display: swap; /* Ensure text remains visible during loading */
  src: url(../vendor/fonts/nunito.woff2) format('woff2');
}

/* Fluid typography base */
html {
  font-size: clamp(var(--font-min), 1.2vw + 0.5rem, var(--font-max));
}

body {
  background: var(--bg);
  font-family: 'Nunito', sans-serif;
  margin: 0;
  padding: 0;
}

/* 2. Navbar styling - Core styles preserved, some moved to critical CSS */
/* Class modification pattern: .custom-navbar is parent class for better scoping */
.navbar {
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.navbar-brand {
  font-size: 1.5rem;
  padding: 0.5rem 0;
}

.nav-link {
  font-size: 1.125rem;
  padding: 0.75rem 1rem;
  transition: var(--transition-standard);
  position: relative;
}

/* Active link preserved exactly as original */
.active-link {
  background-color: rgba(74, 176, 255, 0.1);
  font-weight: 500;
  position: relative;
}

/* Mobile navbar styles preserved */
@media (max-width: 991.98px) {
  .navbar .nav-link {
    padding: 0.75rem;
    margin: 0.25rem 0;
  }
  
  .navbar-nav .nav-item {
    margin-bottom: 0.5rem;
  }
  
  .dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  }
}

/* 3. Card styles - All preserved exactly as original */
.card {
  background: #fff;
  border: none;
  border-radius: 1rem;
  box-shadow: var(--box-shadow-card);
  transition: transform .2s ease, box-shadow .2s ease;
  min-height: 120px;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--box-shadow-card-hover);
}

/* Preserved exactly as original */
.wd-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(237, 242, 251, 0.85), rgba(247, 250, 255, 0.95)) !important;
}

/* 4. Card header styling - Preserved exactly */
.card-header {
  padding: 0.75rem 1.25rem;
  border-bottom: none;
  color: #fff;
  font-weight: 600;
  border-radius: 2rem;
  cursor: pointer;
  text-align: center;
}

.card-header a {
  color: inherit;
  text-decoration: none;
  display: block;
  width: 100%;
  height: 100%;
}

/* Color classes preserved with !important as they need to override Bootstrap */
.bg-er { background-color: var(--accent-er) !important; }
.bg-wd { background-color: var(--accent-wd) !important; }
.bg-bu { background-color: var(--accent-bu) !important; }

/* 5. Card body and text - Base styles */
.card-body {
  padding: 1.25rem;
}

.card-title {
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: clamp(1.125rem, 3vw + 0.25rem, 1.5rem);
}

.card-text {
  color: #555;
  line-height: 1.4;
  font-size: clamp(0.875rem, 2vw + 0.25rem, 1rem);
}

/* 6. Link areas - Preserved exactly */
.card .stretched-link {
  z-index: 1;
  display: block;
  padding: 0.5rem;
}

/* 7. Mobile adjustments - Preserved exactly */
@media (max-width: 575.98px) {
  body {
    font-size: 16px;
  }

  .navbar-brand {
    font-size: 1.75rem;
  }

  .nav-link {
    font-size: 1.25rem;
  }

  .card {
    padding: 1rem;
    min-height: 140px;
  }

  .card-title {
    font-size: 1.25rem;
  }

  .card-text {
    font-size: 1rem;
  }
}

/* 8. Bottom navigation - Preserved exactly */
.bottom-nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  background: transparent;
  border-top: 1px solid #e2e2e2;
  display: flex;
  justify-content: space-around;
  padding: 0.5rem 0;
}

.bottom-nav .nav-link {
  text-align: center;
  font-size: 1rem;
  color: #333;
}

/* 9. Form styling - Optimized with fewer !important tags */
/* Form control styles - Keeping necessary !important tags for Bootstrap override */
.custom-form .form-control {
  height: auto !important; /* Still need this to override Bootstrap */
  padding: 0.375rem 0.75rem;
  line-height: normal;
}

/* Combined selectors for better organization */
.input-group .form-control,
.form-floating .form-control {
  height: auto !important; /* Still need this to override Bootstrap */
}

/* Special padding for floating controls */
@media (min-width: 576px) {
  .form-floating > .form-control {
    padding-top: 2.5rem;
  }
  
  .form-floating > .form-control[type="date"],
  .form-floating > .form-control[type="datetime-local"],
  .form-floating > .form-control[type="time"] {
    padding-top: 2.25rem;
    font-size: 1rem;
  }
}

/* Mobile form adjustments - Preserved with !important where necessary */
@media (max-width: 575.98px) {
  .form-floating > .form-control {
    padding-top: 2.25rem !important;
    font-size: 1rem;
  }

  .form-floating > .form-control[type="date"],
  .form-floating > .form-control[type="datetime-local"],
  .form-floating > .form-control[type="time"] {
    padding-top: 2.75rem !important;
    font-size: 1.1rem;
  }
  
  .table-responsive-custom {
    overflow-x: auto;
    width: 100%;
  }
}

/* 10. Table styles - Preserved exactly as original */
td, th {
  word-break: break-all;
  overflow-wrap: anywhere;
}

.table-responsive-custom {
  overflow-x: auto;
  width: 100%;
}
