/* ============================================
   CSS Variables - Theme Configuration
   ============================================ */
:root {
  /* Colors */
  --color-primary: #1d4ed8;
  --color-primary-hover: #2563eb;
  --color-secondary: #facc15;
  --color-secondary-hover: #fbbf24;
  --color-dark: #020617;
  --color-dark-gray: #0f172a;
  --color-medium-gray: #1f2937;
  --color-light-gray: #f3f4f6;
  --color-text: #111827;
  --color-text-light: #6b7280;
  --color-text-lighter: #9ca3af;
  --color-border: #d1d5db;
  --color-border-light: #e5e7eb;
  --color-light: #e5e7eb;
  --color-success: #22c55e;
  --color-success-bg: #ecfdf3;
  --color-error: #ef4444;
  --color-error-bg: #fef2f2;
  
  /* Border Radius */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-full: 999px;
  
  /* Shadows */
  --shadow-sm: 0 4px 10px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 20px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 12px 30px rgba(15, 23, 42, 0.12);
  --shadow-xl: 0 16px 40px rgba(15, 23, 42, 0.18);
  --shadow-2xl: 0 20px 60px rgba(0, 0, 0, 0.5);
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
}

/* ============================================
   Base Styles
   ============================================ */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--color-light-gray);
  color: var(--color-text);
}

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

a:hover {
  text-decoration: underline;
}

/* ============================================
   Site Header
   ============================================ */
.site-header {
  background: linear-gradient(90deg, var(--color-dark-gray), var(--color-medium-gray));
  color: var(--color-light);
  padding: var(--spacing-sm) var(--spacing-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-lg);
  flex-wrap: wrap; /* allow nav/auth to move onto own row */
}

.logo-area {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  order: 1;
}

.squadron-logo {
  width: 59px;
  height: 59px;
  object-fit: contain;
}

.logo-text .site-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-light);
  display: block;
}

.logo-text .site-subtitle {
  font-size: 0.85rem;
  color: var(--color-text-lighter);
}

/* Main Navigation container – full-width row under logo, wraps to 2 lines */
.main-nav {
  order: 2;
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;         /* allows 2+ rows */
  justify-content: center; /* centre all buttons */
  gap: 0.4rem;
}

/* Main Navigation links */
.main-nav a {
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  color: var(--color-light);
  white-space: nowrap;     /* keep "Cadet Area" etc on one line */
}

.main-nav a.active,
.main-nav a:hover {
  background: var(--color-primary);
  text-decoration: none;
}

/* Auth Links */
.auth-links {
  order: 3;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.85rem;
}

.auth-links .btn-small {
  padding: var(--spacing-xs) 0.8rem;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
  font-weight: 500;
}

.auth-links .btn-small:hover {
  background: var(--color-primary-hover);
  text-decoration: none;
}

.welcome {
  color: #cbd5f5;
}

/* ============================================
   Page Content
   ============================================ */
.page-content {
  max-width: 1100px;
  margin: var(--spacing-lg) auto 2.5rem;
  padding: 0 var(--spacing-md);
}

/* ============================================
   Hero Sections
   ============================================ */
.hero {
  background: white;
  padding: var(--spacing-xl);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  margin-bottom: var(--spacing-lg);
}

.hero h1 {
  margin-top: 0;
}

.hero-home {
  background: radial-gradient(circle at top left, var(--color-primary) 0, var(--color-dark) 55%);
  color: var(--color-light);
  min-height: 220px;
  display: flex;
  align-items: center;
}

.hero-home .hero-content {
  max-width: 540px;
}

.hero-home h1 {
  margin-top: 0;
  margin-bottom: var(--spacing-sm);
}

.hero-home p {
  margin-bottom: var(--spacing-md);
}

.btn-large {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-full);
  background: var(--color-secondary);
  color: var(--color-text);
  font-weight: 600;
}

.btn-large:hover {
  background: var(--color-secondary-hover);
  text-decoration: none;
}

/* ============================================
   Layout Blocks
   ============================================ */
.two-column {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--spacing-lg);
}

.two-column > div {
  background: white;
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* ============================================
   Home Page Photo Strip
   ============================================ */
.home-photos {
  margin: var(--spacing-xl) 0;
}

.home-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--spacing-md);
}

.home-photo-grid img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* ============================================
   Landing Page Images
   ============================================ */
.landing-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--spacing-md);
  margin-top: var(--spacing-lg);
}

.landing-images img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* ============================================
   News Cards & Images
   ============================================ */
.news-card {
  background: white;
  padding: 1.25rem var(--spacing-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  margin-bottom: var(--spacing-md);
}

.news-card h2 {
  margin-top: 0;
}

.news-card .meta {
  font-size: 0.8rem;
  color: var(--color-text-light);
}

.news-images {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
}

.news-images img {
  width: 100%;
  max-width: 300px;
  height: auto;
  border-radius: 0.625rem;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media (max-width: 640px) {
  .news-images img {
    max-width: 100%;
  }
}

/* ============================================
   Gallery
   ============================================ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--spacing-md);
}

.gallery-item {
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform 0.2s;
}

.gallery-item:hover {
  transform: scale(1.02);
}

.gallery-thumb {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.gallery-item figcaption {
  padding: var(--spacing-sm) 0.75rem;
  font-size: 0.85rem;
}

/* Gallery Modal - Full Size Image */
.gallery-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 2rem;
}

.gallery-modal-inner {
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-modal-inner img,
#gallery-modal-img {
  max-width: 90vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2xl);
}

.gallery-modal-close {
  position: absolute;
  top: -12px;
  right: -12px;
  background: #ffffff;
  border-radius: 50%;
  border: none;
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

.gallery-modal-close:hover {
  background: var(--color-light-gray);
}

/* ============================================
   Staff Directory
   ============================================ */
.staff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--spacing-lg);
}

.staff-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  padding: 1.25rem var(--spacing-lg);
  display: flex;
  gap: var(--spacing-md);
}

.staff-photo img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.staff-info h2 {
  margin: 0 0 0.25rem;
}

.staff-role {
  font-weight: 600;
}

.staff-type {
  font-size: 0.85rem;
  color: var(--color-text-light);
}

.staff-contact {
  font-size: 0.85rem;
  margin-top: var(--spacing-sm);
}

/* ============================================
   Admin Dashboard
   ============================================ */
.admin-intro {
  margin-bottom: var(--spacing-lg);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--spacing-lg);
}

.admin-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  padding: 1.25rem var(--spacing-lg);
  font-size: 0.9rem;
}

.admin-card h2 {
  margin-top: 0;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--color-border-light);
  padding: 0.35rem var(--spacing-sm);
  text-align: left;
}

.admin-table th {
  font-weight: 600;
}

.admin-table form {
  display: inline;
}

.admin-table button {
  font-size: 0.8rem;
  padding: 0.2rem var(--spacing-sm);
  border-radius: var(--radius-full);
  border: none;
  background: #b91c1c;
  color: white;
  cursor: pointer;
}

.admin-table button:hover {
  background: #dc2626;
}

.admin-table select {
  font-size: 0.8rem;
}

/* ============================================
   Forms & Alerts
   ============================================ */
.form-card {
  background: white;
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  max-width: 450px;
  box-shadow: var(--shadow-md);
}

.form-card label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.form-card input,
.form-card textarea {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  margin-top: var(--spacing-xs);
  font-family: inherit;
  font-size: 0.9rem;
}

.form-card input:focus,
.form-card textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.form-card button {
  margin-top: 0.75rem;
  padding: 0.45rem var(--spacing-md);
  border-radius: var(--radius-full);
  border: none;
  background: var(--color-primary);
  color: white;
  font-weight: 500;
  cursor: pointer;
}

.form-card button:hover {
  background: var(--color-primary-hover);
}

.alert {
  border-radius: var(--radius-md);
  padding: 0.75rem var(--spacing-md);
  margin-bottom: var(--spacing-md);
  font-size: 0.9rem;
}

.alert-success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success);
}

.alert-error {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error);
}

/* ============================================
   Utility Classes
   ============================================ */
.btn-small {
  display: inline-block;
  padding: var(--spacing-xs) 0.75rem;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
  font-size: 0.85rem;
}

.btn-small:hover {
  background: var(--color-primary-hover);
  text-decoration: none;
}

.hidden {
  display: none;
}

/* File List */
.file-list {
  list-style: none;
  padding-left: 0;
}

.file-list li {
  margin-bottom: 0.4rem;
}

/* Cadet uniform avatars – small and consistent */
.uniform-avatar,
.uniform-image {
  width: 80px;
  height: 80px;
  object-fit: contain;
  display: inline-block;
  margin-top: 0.25rem;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
  background: var(--color-dark);
  color: var(--color-text-lighter);
  padding: var(--spacing-lg) var(--spacing-md);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: var(--spacing-xl);
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.footer-block {
  flex: 1 1 200px;
}

.footer-inner a {
  color: var(--color-light);
}

.footer-social a {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0.4rem;
  color: var(--color-light);
}

.footer-social a:hover,
.footer-affiliation .footer-logo:hover {
  opacity: 1;
}

.social-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 6px;
}

.footer-affiliation p {
  margin-bottom: 0.4rem;
}

.footer-affiliation .footer-logo {
  width: 80px;
  height: auto;
  display: block;
  opacity: 0.95;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: stretch;
  }
  
  .logo-area {
    justify-content: center;
  }
  
  .main-nav {
    justify-content: center;
  }
  
  .auth-links {
    justify-content: center;
  }
  
  .footer-inner {
    flex-direction: column;
  }
}
/* Fix the header logo size */
.site-logo {
    height: 60px;        /* adjust this size if needed */
    width: auto;
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
}

/* Makes title align nicely with the logo */
.site-title-text {
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
}

.staff-availability-tile {
    background: #f5f7fb;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.staff-availability-tile h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.staff-availability-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.availability-day-card {
    flex: 1 1 260px;
    background: #ffffff;
    border-radius: 8px;
    padding: 12px 14px;
    border: 1px solid #dde2f0;
}

.availability-day-card h3 {
    margin: 0 0 4px;
    font-size: 1.1rem;
}

.availability-date {
    margin: 0 0 10px;
    font-size: 0.9rem;
    color: #666;
}

.availability-list {
    margin-bottom: 10px;
}

.availability-list h4 {
    margin: 6px 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.availability-list ul {
    list-style: none;
    padding-left: 0;
    margin: 4px 0 0;
}

.availability-list li {
    font-size: 0.9rem;
    padding: 2px 0;
}

.availability-empty {
    font-size: 0.85rem;
    color: #999;
    margin: 2px 0 0;
}

/* Mobile tidy-up */
@media (max-width: 600px) {
    .staff-availability-grid {
        flex-direction: column;
    }
}
