/* ============================================
   UTTOPSIS - Styles globaux intranet
   Base CSS : reset, typographie, utilitaires
   ============================================ */

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* --- Typographie de base --- */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--gray-900);
  background: var(--gray-100);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  font-weight: 600;
  color: var(--gray-900);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
  margin-bottom: 0.75rem;
}

/* --- Liens --- */
a {
  color: var(--uttop-blue-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--uttop-blue);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--uttop-blue-light);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* --- Images & media --- */
img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

/* --- Formulaires --- */
input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

input[type="text"],
input[type="email"],
input[type="search"],
input[type="password"],
input[type="url"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--gray-900);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--uttop-blue-light);
  box-shadow: 0 0 0 3px rgba(0, 116, 183, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--gray-500);
}

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

/* --- Listes --- */
ul, ol {
  list-style: none;
}

/* --- Tableaux --- */
table {
  border-collapse: collapse;
  width: 100%;
}

/* --- Utilitaires Flexbox --- */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* --- Utilitaires Grid --- */
.grid {
  display: grid;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

/* --- Utilitaires espacement --- */
.m-0  { margin: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.p-2  { padding: var(--space-2); }
.p-4  { padding: var(--space-4); }

/* --- Utilitaires texte --- */
.text-sm    { font-size: 0.875rem; }
.text-xs    { font-size: 0.75rem; }
.text-lg    { font-size: 1.125rem; }
.text-muted { color: var(--gray-600); }
.text-center { text-align: center; }
.font-bold  { font-weight: 700; }
.font-medium { font-weight: 500; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Utilitaires visuels --- */
.rounded     { border-radius: var(--radius-md); }
.rounded-lg  { border-radius: var(--radius-lg); }
.rounded-xl  { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }
.shadow      { box-shadow: var(--shadow); }
.shadow-md   { box-shadow: var(--shadow-md); }
.shadow-lg   { box-shadow: var(--shadow-lg); }

/* --- Transitions globales --- */
.transition {
  transition: all var(--transition);
}

.transition-fast {
  transition: all var(--transition-fast);
}

/* --- Accessibilite : reduced motion --- */
@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;
  }
}

/* --- Accessibilite : focus visible --- */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--uttop-blue-light);
  outline-offset: 2px;
}

/* --- Conteneur principal --- */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
  padding: var(--space-4);
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* --- Responsive mobile-first breakpoints --- */
/* Tablette : >= 768px */
@media (min-width: 768px) {
  .app-main {
    padding: var(--space-6);
  }
}

/* Desktop : >= 1024px */
@media (min-width: 1024px) {
  .app-main {
    padding: var(--space-8);
  }
}

/* Large desktop : >= 1280px */
@media (min-width: 1280px) {
  .app-main {
    padding: var(--space-8) var(--space-12);
  }
}

/* --- Scrollbar personnalisee --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-500);
}

/* --- Selection texte --- */
::selection {
  background: rgba(0, 79, 120, 0.2);
  color: var(--gray-900);
}
