/* ============================================================================
   AsielConnect — global stylesheet
   Plain CSS (no build step / SASS compiler is configured for this app, so
   this file is the single source of truth for styling — it is imported
   directly by assets/app.js via Symfony AssetMapper).
   ============================================================================ */

:root {
  --color-primary: #4a7c7e;
  --color-primary-dark: #3a5f61;
  --color-primary-light: #e8f4f8;
  --color-success: #28a745;
  --color-danger: #dc3545;
  --color-warning: #ffc107;

  --color-text: #333333;
  --color-text-secondary: #555555;
  --color-text-muted: #6b6b6b;
  --color-border: #dddddd;

  --color-bg: #f9f9f9;
  --color-bg-alt: #f5f5f5;
  --color-white: #ffffff;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  --header-height: 68px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);

  /* breakpoints are used only in comments — CSS has no var() in media queries */
}

/* ============================================================================
   Base / reset
   ============================================================================ */

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

* {
  font-family: var(--font-family);
}

html, body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  overflow-x: hidden; /* safety net: nothing should be able to force horizontal scroll on the page */
  min-height: 100vh;
}

img, svg, video, canvas, iframe {
  max-width: 100%;
  height: auto;
}

table {
  max-width: 100%;
}

/* Any inline-styled table (poster dashboard "recent applications") scrolls
   horizontally on narrow screens instead of breaking the page layout. */
table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
}

a {
  color: var(--color-primary);
}

/* ============================================================================
   Accessibility
   ============================================================================ */

/* Hidden until a keyboard user presses Tab, then drops in centred above the header */
.skip-link {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 3000;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--color-primary-dark);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 24px));
  transition: transform 0.2s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translate(-50%, 0);
  box-shadow: 0 6px 20px rgba(31, 61, 62, 0.3);
  outline: 3px solid #fff;
  outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #1a73e8;
  outline-offset: 2px;
}

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

/* Minimum readable/tappable size for form controls; also prevents iOS Safari
   from auto-zooming the page when an input with font-size < 16px is focused. */
input, textarea, select, button {
  font-size: max(16px, 1em);
}

/* ============================================================================
   Site header (see templates/base.html.twig)
   ============================================================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid rgba(74, 124, 126, 0.12);
  transition: box-shadow 0.25s ease, background-color 0.25s ease;
}

/* Set by nav_controller once the page is scrolled */
.site-header.is-scrolled,
.site-header.is-menu-open {
  background-color: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 20px rgba(31, 61, 62, 0.08);
}

.site-header__bar {
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--header-height);
  padding: 0 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}

.site-header__brand strong {
  font-weight: 700;
  color: var(--color-primary);
}

.site-header__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  box-shadow: 0 2px 6px rgba(74, 124, 126, 0.35);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.site-nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.site-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 0.2s, background-color 0.2s;
}

.site-nav__link:hover,
.site-nav__link:focus-visible {
  color: var(--color-primary-dark);
  background-color: var(--color-primary-light);
}

.site-nav__link.is-active {
  color: var(--color-primary-dark);
  background-color: var(--color-primary-light);
  font-weight: 600;
}

/* Icons help recognise links in the phone menu; the desktop bar stays text-only */
.site-nav__icon {
  display: none;
  flex-shrink: 0;
  color: var(--color-primary);
}

.nav-backdrop {
  display: none;
}

html.nav-open {
  overflow: hidden;
}

.site-nav__account {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-nav__email {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-muted);
  font-size: 14px;
}

.site-nav__button {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.site-nav__button--ghost {
  color: var(--color-text);
  border: 1px solid var(--color-border);
  background-color: #fff;
}

.site-nav__button--ghost:hover,
.site-nav__button--ghost:focus-visible {
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
}

.site-nav__button--primary {
  color: #fff;
  border: 1px solid var(--color-primary);
  background-color: var(--color-primary);
}

.site-nav__button--primary:hover,
.site-nav__button--primary:focus-visible {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.donate-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  background: linear-gradient(135deg, #f0706a 0%, #d9435f 100%);
  box-shadow: 0 4px 14px rgba(217, 67, 95, 0.35);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.donate-button:hover,
.donate-button:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 6px 18px rgba(217, 67, 95, 0.45);
}

.donate-button:active {
  transform: translateY(0);
}

.donate-button.is-active {
  box-shadow: 0 0 0 3px rgba(217, 67, 95, 0.25), 0 4px 14px rgba(217, 67, 95, 0.35);
}

.donate-button svg {
  transition: transform 0.2s ease;
}

.donate-button:hover svg {
  transform: scale(1.15);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
}

.nav-toggle:hover {
  background-color: var(--color-primary-light);
}

.nav-toggle__bar {
  display: block;
  height: 2px;
  width: 22px;
  margin: 0 auto;
  background-color: var(--color-text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

main.has-fixed-header {
  padding-top: var(--header-height);
}

/* ============================================================================
   Site footer (see templates/base.html.twig)
   ============================================================================ */

.site-footer {
  background-color: #2d2d2d;
  color: #ccc;
  padding: 40px 20px;
  margin-top: 60px;
}

.site-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px 40px;
  margin-bottom: 40px;
}

.site-footer__heading {
  color: #fff;
  margin: 0 0 15px 0;
  font-size: 16px;
  font-weight: 600;
}

.site-footer__text {
  margin: 0 0 10px 0;
  color: #bbbbbb;
  font-size: 14px;
  line-height: 1.6;
}

.site-footer__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-footer__link {
  color: #bbbbbb;
  text-decoration: none;
  font-size: 14px;
}

.site-footer__link:hover,
.site-footer__link:focus-visible {
  color: #fff;
  text-decoration: underline;
}

.site-footer__link--accent {
  color: #7fb8ba;
  font-weight: 500;
}

.site-footer__bottom {
  border-top: 1px solid #555;
  padding-top: 20px;
  text-align: center;
  color: #aaaaaa;
  font-size: 13px;
}

.site-footer__bottom p {
  margin: 0;
}

/* ============================================================================
   Buttons (shared component classes)
   ============================================================================ */

.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: bold;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.2s, box-shadow 0.2s;
}

.btn--primary { background-color: var(--color-primary); color: #fff; }
.btn--primary:hover { background-color: var(--color-primary-dark); }
.btn--success { background-color: var(--color-success); color: #fff; }
.btn--danger { background-color: var(--color-danger); color: #fff; }
.btn--outline { background-color: transparent; color: var(--color-primary); border: 2px solid var(--color-primary); }
.btn--block { display: block; width: 100%; }
.btn--sm { padding: 8px 16px; font-size: 14px; }

/* ============================================================================
   Dashboard layout classes (used by profile-edit templates and reused by the
   generic overrides below for the many pages still using inline styles)
   ============================================================================ */

.dashboard-container {
  display: flex;
  min-height: calc(100vh - var(--header-height));
}

.sidebar {
  width: 280px;
  flex-shrink: 0;
  background-color: var(--color-bg-alt);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  text-decoration: none;
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  transition: background-color 0.2s, color 0.2s;
  font-size: 14px;
}

.nav-item:hover { background-color: rgba(74, 124, 126, 0.1); }
.nav-item.active { background-color: var(--color-primary); color: #fff; font-weight: 600; }
.nav-item.active:hover { background-color: var(--color-primary-dark); }
.nav-item .icon { font-size: 20px; }

.account-type-selector {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.selector-label {
  display: block;
  font-size: 12px;
  color: var(--color-text-secondary);
  font-weight: bold;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.selector-buttons {
  display: flex;
  gap: 10px;
}

.selector-btn {
  flex: 1;
  padding: 8px;
  border: 2px solid var(--color-border);
  background: #fff;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: bold;
  color: var(--color-text-secondary);
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.selector-btn.active { border-color: var(--color-primary); color: var(--color-primary); }
.selector-btn:hover:not(.disabled) { border-color: var(--color-primary); }
.selector-btn.disabled { opacity: 0.5; cursor: not-allowed; }

.main-content {
  flex: 1;
  min-width: 0; /* allow flex children to shrink below content size instead of overflowing */
  padding: 40px;
}

.profile-card, .form-card {
  background: #fff;
  padding: 30px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.card-title {
  margin: 0 0 20px 0;
  font-size: 24px;
  color: var(--color-text);
  font-weight: 600;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-form label {
  font-weight: bold;
  color: var(--color-text);
  font-size: 14px;
}

.profile-form .required { color: var(--color-danger); }

.profile-form input[type="text"],
.profile-form input[type="email"],
.profile-form input[type="password"],
.profile-form textarea,
.profile-form select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

.profile-form textarea { min-height: 100px; resize: vertical; }
.profile-form small { color: var(--color-text-secondary); font-size: 13px; }

.form-actions {
  display: flex;
  gap: 15px;
  margin-top: 20px;
}

.btn-submit, .btn-secondary {
  padding: 12px 30px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-submit { background-color: var(--color-primary); color: #fff; border: none; }
.btn-submit:hover { background-color: var(--color-primary-dark); }
.btn-secondary { background-color: #fff; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background-color: var(--color-bg-alt); }

.alert-container { margin-bottom: 20px; }
.alert { padding: 15px; border-radius: var(--radius-md); margin-bottom: 10px; }
.alert--error { background-color: #f8d7da; border: 1px solid #f5c6cb; color: #721c24; }
.alert--error strong { display: block; margin-bottom: 10px; }
.alert--error ul { margin: 10px 0 0 0; padding-left: 20px; }
.alert--success { background-color: #d4edda; border: 1px solid #c3e6cb; color: #155724; font-weight: bold; }

.poster-dashboard__container {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-height));
}

/* ============================================================================
   Mobile layout (≤768px)
   ============================================================================ */

@media (max-width: 1200px) {
  .site-nav__email {
    display: none;
  }
}

/* Header collapses into the toggle menu before the links run out of room */
@media (max-width: 1024px) {
  .site-header__bar {
    gap: 10px;
    padding: 0 16px;
  }

  .nav-toggle {
    display: flex;
  }

  .donate-button {
    margin-left: auto;
    padding: 8px 14px;
    font-size: 14px;
  }

  /* Slide-down panel. Kept in the layout (visibility, not display) so it can animate. */
  .site-nav {
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    z-index: 2;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 16px 20px;
    background-color: #fff;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 16px 32px rgba(31, 61, 62, 0.14);
    max-height: calc(100vh - var(--header-height));
    max-height: calc(100dvh - var(--header-height));
    overflow-y: auto;
    overscroll-behavior: contain;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
  }

  .site-nav.is-open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s;
  }

  .nav-backdrop {
    display: block;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    z-index: 1;
    background-color: rgba(20, 40, 41, 0.35);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.22s ease, visibility 0s linear 0.22s;
  }

  .site-header.is-menu-open .nav-backdrop {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.22s ease, visibility 0s;
  }

  .site-nav__links {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    margin: 0;
  }

  .site-nav__link {
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 16px;
    color: var(--color-text);
  }

  .site-nav__icon {
    display: block;
  }

  .site-nav__account {
    flex-wrap: wrap;
    padding-top: 14px;
    border-top: 1px solid var(--color-border);
  }

  .site-nav__email {
    display: block;
    max-width: none;
    flex-basis: 100%;
  }

  .site-nav__account .site-nav__button {
    flex: 1;
    justify-content: center;
    min-height: 48px;
    padding: 12px 16px;
    font-size: 15px;
  }
}

@media (max-width: 768px) {

  .dashboard-container,
  div[style*="display: flex; flex: 1;"],
  div[style*="display: flex; min-height: 100vh"],
  div[style*="display: flex; flex-direction: column; min-height: 100vh"] {
    flex-direction: column !important;
  }

  .sidebar,
  aside[style*="width: 280px"],
  aside.sidebar {
    width: 100% !important;
    box-sizing: border-box;
  }

  /* Decorative hero-image sidebars (home/login/register) — drop them on
     small screens so the actual content isn't pushed below the fold. */
  aside[style*="unsplash"] {
    display: none !important;
  }

  .main-content,
  main[style*="padding: 40px"],
  main.main-content {
    padding: 20px !important;
  }

  /* Any inline multi-column grid collapses to a single column on mobile. */
  [style*="grid-template-columns: repeat(2"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns: 1fr 2fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Large inline headings get out of hand on narrow screens. */
  [style*="font-size: 48px"] { font-size: 32px !important; }
  [style*="font-size: 36px"] { font-size: 26px !important; }
  [style*="font-size: 32px"] { font-size: 24px !important; }
  [style*="font-size: 28px"] { font-size: 22px !important; }

  /* Reduce oversized page padding used throughout the inline-styled pages. */
  [style*="padding: 40px"] { padding: 20px !important; }
  [style*="padding: 60px 40px"] { padding: 32px 20px !important; }

  h1 { font-size: 26px; }
  h2 { font-size: 20px; }
}

@media (max-width: 480px) {
  /* Rows of inline flex:1 buttons (e.g. Accept / Reject / Contact) are too
     cramped on very small phones — let them wrap onto multiple lines instead
     of squeezing or overflowing the viewport. */
  div[style*="display: flex; gap: 10px"] {
    flex-wrap: wrap;
  }

  div[style*="display: flex; gap: 10px"] > button[style*="flex: 1"],
  div[style*="display: flex; gap: 10px"] > a[style*="flex: 1"],
  div[style*="display: flex; gap: 10px"] > form[style*="flex: 1"] {
    flex-basis: 45%;
  }
}

/* ============================================================================
   Contrast touch-ups for common low-contrast inline colors (WCAG AA)
   ============================================================================ */

[style*="color: #999"] { color: var(--color-text-muted) !important; }
[style*="color:#999"] { color: var(--color-text-muted) !important; }
