/* Import Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

* {
  margin: 0;
  padding: 0;
  outline: 0;
  border: 0;
  appearance: none;
  text-decoration: none;
  list-style: none;
  box-sizing: border-box;
}

/* app/static/css/main.css */

/* =================================================================== */
/* GLOBAL SKELETON LOADING & ICON OPTIMIZATION (SOVEREIGN V17.0 - NO LIGATURE FLASH) */
/* =================================================================== */

/* PRIORITÉ ABSOLUE : Annuler le skeleton si les icônes sont prêtes */
html.icons-ready .material-symbols-outlined, 
html.icons-ready .fas, 
html.icons-ready .fab, 
html.icons-ready .far,
html.icons-ready .fa,
html.icons-ready i,
.icons-ready .material-symbols-outlined,
.icons-ready .fas,
.icons-ready .fab {
    color: inherit !important;
    text-indent: 0 !important;
    background: none !important;
    background-image: none !important;
    animation: none !important;
    overflow: visible !important;
    min-width: unset !important;
    min-height: unset !important;
    visibility: visible !important;
    display: inline-flex !important;
    opacity: 1 !important;
}

/* ÉTAT DE CHARGEMENT (SKELETON) - PLUS AGRESSIF POUR ÉVITER LIGATURE FLASH */
html:not(.icons-ready) .material-symbols-outlined, 
html:not(.icons-ready) .fas, 
html:not(.icons-ready) .fab, 
html:not(.icons-ready) .far,
html:not(.icons-ready) .fa,
html:not(.icons-ready) i,
html:not(.icons-ready) [class^="fa-"], 
html:not(.icons-ready) [class*=" fa-"],
html:not(.icons-ready) .skeleton {
    color: transparent !important;
    text-indent: -99999px !important;
    overflow: hidden !important;
    min-width: 24px !important;
    min-height: 24px !important;
    display: inline-flex !important;
    background: #e2e8f0 !important;
    background: linear-gradient(110deg, #eceef1 8%, #f8fafc 18%, #eceef1 33%) !important;
    background-size: 200% 100% !important;
    border-radius: 6px !important;
    animation: skeleton-pulse-dynamic 1.2s ease-in-out infinite !important;
    visibility: visible !important;
    position: relative !important;
}

@keyframes skeleton-pulse-dynamic {
    0% { background-position: 200% 0; opacity: 0.7; }
    50% { opacity: 1; }
    100% { background-position: -200% 0; opacity: 0.7; }
}

/* Parent-based visibility control */
.icon-container.loading .real-content {
    display: none !important;
}

.icon-container:not(.loading) .skeleton-wrapper {
    display: none !important;
}

html.icons-ready .skeleton-wrapper,
html.icons-ready .skeleton,
.icons-ready .skeleton-wrapper,
.icons-ready .skeleton {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

html.icons-ready .real-content,
.icons-ready .real-content {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* LEGACY SUPPORT: Mantain old reveal logic for isolated icons */
.icons-ready .material-symbols-outlined, 
.icons-ready .fas, 
.icons-ready .fab, 
.icons-ready .far,
.icons-ready .fa,
.icons-ready i {
    color: inherit !important;
    text-indent: 0 !important;
    background-color: transparent !important;
    animation: none !important;
    overflow: visible !important;
    min-width: unset !important;
    min-height: unset !important;
}

/* Fallback CSS pour Opera Mini - Si JS ne se charge pas */
@supports not (display: flex) {
    .icon-container .real-content {
        opacity: 1 !important;
        display: block !important;
        visibility: visible !important;
    }
    
    .icon-container .skeleton-wrapper {
        display: none !important;
    }
}

/* Animation CSS-only fallback - Pas besoin de JS */
@keyframes force-icon-reveal {
    0% { opacity: 0; }
    90% { opacity: 0; }
    100% { opacity: 1; }
}

/* Force l'affichage des icônes après 3 secondes même sans JS */
.icon-container .real-content {
    animation: force-icon-reveal 3s forwards;
}

/* Cache le skeleton après l'animation CSS */
.icon-container .skeleton-wrapper {
    animation: skeleton-hide 3s forwards;
}

@keyframes skeleton-hide {
    0% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

/* Préfixes vendeurs pour Flexbox (Opera Mini compatibility) */
.icon-container {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 8px;
    gap: 0.5rem;
}

.skeleton-wrapper {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 8px;
}

/* Global Variables from style.css */
:root {
  --primary-color: #00ffbc; /* Vert Digital - Couleur dominante */
  --primary-hover: #00e6a8;
  --primary-dark: #004d40; /* Émeraude profond pour contrastes */
  --primary-light: rgba(0, 255, 188, 0.1);
  --primary-gradient: linear-gradient(135deg, #00ffbc 0%, #00b386 100%);
  
  --accent-digital: #00ffbc;
  --premium-accent: #D4AF37;
  
  --dark-base: #050505;
  --dark-secondary: #0a0f0d;
  --light-bg: #f8faf9;
  --white-off: #ffffff;
  
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 255, 188, 0.2);
  --glass-shadow: 0 8px 32px 0 rgba(0, 255, 188, 0.1);
  
  --transition-premium: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
  font-family: 'Inter', sans-serif !important;
  background-color: #fff;
  color: var(--dark-base);
  line-height: 1.6;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.wk-body-90 {
  width: min(90%, 1600px);
  margin-left: auto;
  margin-right: auto;
}

.wk-main-full {
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', sans-serif !important;
}

input, button, select, textarea, span, a, p, li, div {
  font-family: 'Inter', sans-serif !important;
}

.btn-hitech {
  background: var(--primary-gradient);
  color: white !important;
  border: none;
  padding: 12px 24px;
  border-radius: 2px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: var(--transition-premium);
  position: relative;
  overflow: hidden;
}

.btn-hitech:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 77, 64, 0.2);
  filter: brightness(1.1);
}

.btn-hitech::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(45deg);
  transition: 0.5s;
}

.btn-hitech:hover::after {
  left: 120%;
}

#public-header .logo a {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -1px;
}

#public-menu-toggle {
  display: none !important;
  cursor: pointer;
  color: var(--primary-color);
  font-size: 2rem;
}

@media screen and (max-width: 992px) {
  #public-menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  #public-header {
    padding: 0 5%;
  }

  nav#public-nav {
    position: fixed;
    top: 70px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 70px);
    background: white;
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 15px rgba(0,0,0,0.05);
    z-index: 999;
    align-items: center;
    justify-content: flex-start;
  }

  nav#public-nav.active {
    left: 0;
  }

  nav#public-nav a {
    width: 100%;
    max-width: 300px;
    text-align: center;
    justify-content: center;
    padding: 1rem;
    font-size: 1.1rem;
    height: auto;
    border-bottom: 1px solid #f1f5f9;
    color: #000000 !important;
  }

  .user-menu {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .user-btn-wrapper {
    justify-content: center;
    width: 100%;
  }
}

nav#public-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 100%;
}

nav#public-nav a {
  font-weight: 500;
  color: var(--dark-color);
  transition: var(--transition-premium, all 0.3s ease);
  display: flex;
  align-items: center;
  height: 100%;
}

nav#public-nav a:hover {
  color: var(--primary-color);
}

@media screen and (max-width: 768px) {
  .hero-section {
    padding: 40px 20px !important;
    text-align: center !important;
  }

  .hero-section h1 {
    font-size: 2.2rem !important;
    line-height: 1.2 !important;
  }

  .hero-section p {
    font-size: 1rem !important;
  }

  .features-grid, 
  .services-grid, 
  .stats-grid {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
  }

  .feature-card, 
  .service-card {
    padding: 1.5rem !important;
  }

  .footer-container {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
  }

  .footer-section {
    width: 100% !important;
    margin: 10px 0 !important;
  }

  .btn {
    padding: 0.5rem 1.2rem !important;
    font-size: 0.85rem !important;
  }

  h1 { font-size: 2rem !important; }
  h2 { font-size: 1.5rem !important; }

  .profile-avatar {
    width: 100px;
    height: 100px;
  }

  .dashboard-stats {
    margin-bottom: 1rem;
  }
}

/* Legacy footer styles disabled - Using unified premium footer from _footer.html */
.footer h5 {
  display: none !important;
}

.footer a {
  display: none !important;
}

/* Profiles */
.profile-header {
  background-color: var(--light-color);
  padding: 2rem 0;
  margin-bottom: 2rem;
}

.profile-avatar {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid white;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Dashboards */
.dashboard-stats {
  background-color: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.dashboard-stats h3 {
  color: var(--secondary-color);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.dashboard-stats .number {
  font-size: 2rem;
  font-weight: 600;
  color: var(--dark-color);
}

/* Responsive */
@media (max-width: 768px) {
  .profile-avatar {
    width: 100px;
    height: 100px;
  }

  .dashboard-stats {
    margin-bottom: 1rem;
  }
}

/* Toast Notifications - Unified style with dashboards */
#toast-container {
  position: fixed;
  top: 1.8rem;
  right: 8rem;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 350px;
}

.toast {
  width: 350px;
  min-height: 75px;
  background-color: white;
  padding: 1.2rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 1rem;
  border-left: 5px solid;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.fade-out {
  opacity: 0;
  transform: translateX(100%);
}

.toast-icon {
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-icon .toast-svg {
  width: 1.8rem; /* 28.8px */
  height: 1.8rem; /* 28.8px */
}

.toast-message {
  flex-grow: 1;
  font-size: 0.95rem;
  color: #677483;
}

.toast-message strong {
  color: #1e0f1c;
  font-weight: 600;
}

.toast-close {
  font-size: 1.5rem;
  color: #677483;
  cursor: pointer;
  background: none;
  border: none;
  transition: color 0.3s ease;
  padding: 0;
  margin: 0;
}

.toast-close:hover {
  color: #1e0f1c;
}

.toast-action {
  margin-top: 8px;
  display: flex;
  justify-content: flex-start;
}

.btn-toast {
  background: #1e0f1c;
  color: white !important;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-toast:hover {
  background: #361a33;
}

/* Toast Colors - Exactly the same as dashboards */
.toast.success {
  border-left-color: #41f1b6;
}
.toast.success .toast-icon {
  color: #41f1b6;
}

.toast.success .toast-icon .toast-svg {
  fill: #41f1b6;
}

.toast.danger {
  border-left-color: #ef4444;
}
.toast.danger .toast-icon {
  color: #ef4444;
}

.toast.danger .toast-icon .toast-svg {
  fill: #ef4444;
}

.toast.warning {
  border-left-color: #ffbb55;
}
.toast.warning .toast-icon {
  color: #ffbb55;
}

.toast.warning .toast-icon .toast-svg {
  fill: #ffbb55;
}

.toast.info {
  border-left-color: #3b8483;
}
.toast.info .toast-icon {
  color: #3b8483;
}

.toast.info .toast-icon .toast-svg {
  fill: #3b8483;
}

/* =================================================================== */
/* MODERN DROPDOWN (SELECT) STYLES */
/* =================================================================== */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: var(--color-white);
  border: 1px solid var(--color-info-light);
  border-radius: var(--border-radius-2);
  padding: 0.8rem 2.5rem 0.8rem 1rem; /* Right padding for arrow */
  font-size: 0.9rem;
  color: var(--color-dark);
  cursor: pointer;
  /* Arrow icon using primary color #014421 */
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23014421' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-light);
  outline: none;
}

select option {
  background-color: var(--color-white);
  color: var(--color-dark);
}

/* For Firefox */
@-moz-document url-prefix() {
  select option:hover {
    background-color: var(--color-dark);
    color: var(--color-white);
  }
}

/* =================================================================== */
/* GLOBAL MODERN SELECT2 STYLING */
/* =================================================================== */
.select2-container {
  width: 100% !important; /* Ensure it takes full width */
}

.select2-container--default .select2-selection--single {
  background-color: var(--color-white);
  border: 1px solid var(--color-info-light);
  border-radius: var(--border-radius-2);
  height: 46px; /* Consistent modern height */
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
}

.select2-container--default .select2-selection--single:focus,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-light);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--color-dark);
  line-height: 46px;
  padding-left: 1rem;
  padding-right: 2rem;
  font-size: 0.95rem;
  width: 100%;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 44px;
  position: absolute;
  top: 1px;
  right: 1px;
  width: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--color-primary) transparent transparent transparent;
  border-width: 6px 5px 0 5px;
  margin-top: 0;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent var(--color-primary) transparent;
  border-width: 0 5px 6px 5px;
}

/* Dropdown Menu */
.select2-dropdown {
  background-color: var(--color-white);
  border: 1px solid var(--color-info-light);
  border-radius: var(--border-radius-2);
  box-shadow: var(--box-shadow);
  overflow: hidden;
  z-index: 9999;
  margin-top: 5px;
}

.select2-search--dropdown {
  padding: 0.5rem;
}

.select2-search--dropdown .select2-search__field {
  border: 1px solid var(--color-info-light);
  border-radius: var(--border-radius-2);
  padding: 0.6rem;
  outline: none;
  font-family: inherit;
}

.select2-search--dropdown .select2-search__field:focus {
  border-color: var(--color-primary);
}

.select2-results__option {
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  color: var(--color-dark);
  transition: background-color 0.2s;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: var(--color-light);
  color: var(--color-dark);
}

/* Scrollbar in Select2 */
.select2-results__options::-webkit-scrollbar {
  width: 6px;
}

.select2-results__options::-webkit-scrollbar-thumb {
  background: var(--color-dark-variant);
  border-radius: 3px;
}

.select2-results__options::-webkit-scrollbar-track {
  background: transparent;
}
/* Page transitions - subtle crossfade between pages.
   Fade-in runs on first paint (CSS animation), fade-out is triggered by
   page-transitions code in main.js which adds .wk-leaving on internal
   link clicks. Opacity only, no transform: animating transform on
   body/main would reparent position:fixed elements mid-animation.
   main.js gates itself on `animation-name: wk-page-fadein`, so pages
   that do not load this stylesheet keep default navigation. */
@keyframes wk-page-fadein {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

body {
  animation: wk-page-fadein 0.28s ease-out;
  transition: opacity 0.14s ease-in;
}

html.wk-leaving body {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  body {
    animation: none;
    transition: none;
  }
}
