/**
 * Main Stylesheet
 * Styles généraux pour le système de projets Excel
 * Inspiré de verify-elaoumrani
 */

/* ========================================
   RESET & BASE STYLES
   ======================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  font-weight: var(--font-regular);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  line-height: var(--leading-normal);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* ========================================
   ANIMATED MESH GRADIENT BACKGROUND
   ======================================== */

.background-gradient {
  position: fixed;
  inset: 0;
  z-index: var(--z-background);
  overflow: hidden;
  background: var(--bg-primary);
}

.background-gradient::before,
.background-gradient::after {
  content: "";
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  animation: float 12s ease-in-out infinite;
}

.background-gradient::before {
  background: radial-gradient(
    circle,
    var(--gradient-1) 0%,
    var(--gradient-2) 50%,
    transparent 100%
  );
  top: -250px;
  left: -250px;
  animation-delay: 0s;
}

.background-gradient::after {
  background: radial-gradient(
    circle,
    var(--gradient-3) 0%,
    var(--gradient-4) 50%,
    transparent 100%
  );
  bottom: -250px;
  right: -250px;
  animation-delay: -10s;
}

.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  animation: float 15s ease-in-out infinite;
}

.gradient-orb-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--gradient-5) 0%, transparent 70%);
  top: 20%;
  right: 10%;
  animation-delay: -5s;
}

.gradient-orb-2 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, var(--gradient-6) 0%, transparent 70%);
  bottom: 30%;
  left: 15%;
  animation-delay: -15s;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(50px, -50px) scale(1.1);
  }
  50% {
    transform: translate(-30px, 50px) scale(0.9);
  }
  75% {
    transform: translate(40px, 30px) scale(1.05);
  }
}

/* ========================================
   LAYOUT
   ======================================== */

.main-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--spacing-xl) var(--spacing-md);
  position: relative;
  z-index: var(--z-base);
}

/* ========================================
   HEADER / LOGO SECTION
   ======================================== */

.page-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
  width: 100%;
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.logo-text {
  font-family: var(--font-logo);
  font-size: var(--text-5xl);
  font-weight: var(--font-regular);
  background: linear-gradient(
    135deg,
    var(--text-primary),
    var(--text-secondary)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  font-weight: var(--font-regular);
  margin-top: var(--spacing-sm);
}

/* ========================================
   FOOTER
   ======================================== */

.page-footer {
  margin-top: var(--spacing-xl);
  padding: var(--spacing-lg) 0;
  text-align: center;
  width: 100%;
  border-top: 1px solid var(--glass-border);
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
}

.footer-contact {
  font-size: var(--text-base);
  color: var(--text-secondary);
}

.footer-email {
  color: var(--accent-info-light);
  text-decoration: none;
  transition: color var(--transition-base);
  font-weight: var(--font-medium);
}

.footer-email:hover {
  color: var(--accent-info);
  text-decoration: underline;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

/* Icon utilities */
.icon-left {
  margin-right: var(--spacing-xs);
}

.icon-right {
  margin-left: var(--spacing-xs);
}

/* ========================================
   LOADING SPINNER
   ======================================== */

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--glass-border);
  border-top-color: var(--accent-info);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================
   ALERT TOAST ANIMATIONS
   ======================================== */

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

.alert-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  min-width: 320px;
  max-width: 480px;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

.alert-toast-message {
  flex: 1;
}

.alert-toast-close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.alert-toast-close:hover {
  opacity: 1;
}

.alert-toast-success {
  background: var(--accent-success);
  color: var(--text-primary);
}

.alert-toast-error {
  background: var(--accent-error);
  color: var(--text-primary);
}

.alert-toast-warning {
  background: var(--accent-warning);
  color: var(--text-primary);
}

.alert-toast-info {
  background: var(--accent-info);
  color: var(--text-primary);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablets */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  .main-wrapper {
    padding: var(--spacing-lg) var(--spacing-sm);
  }

  .logo-text {
    font-size: var(--text-3xl);
  }
}

/* Mobile */
@media (max-width: 480px) {
  html {
    font-size: 13px;
  }

  .logo-text {
    font-size: var(--text-2xl);
  }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus styles */
*:focus-visible {
  outline: 2px solid var(--accent-info);
  outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--accent-info);
  color: var(--text-primary);
  padding: var(--spacing-sm) var(--spacing-md);
  text-decoration: none;
  z-index: 9999;
}

.skip-to-content:focus {
  top: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --glass-border: rgba(255, 255, 255, 0.3);
    --text-secondary: #cccccc;
  }
}

/* ============================================
  INFO CARDS - BRANCHE
============================================ */

.branch-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-md, 20px);
  margin-top: var(--spacing-md, 20px);
  animation: slideDown 0.5s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.info-card {
  display: flex;
  gap: 15px;
  padding: 20px;
  border-radius: 12px;
  border: 2px solid;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

/* Card Icons */
.card-icon {
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  flex-shrink: 0;
}

.card-content {
  flex: 1;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 10px 0;
  opacity: 0.9;
}

.card-value {
  font-size: 15px;
  margin: 5px 0;
  line-height: 1.5;
}

.card-value strong {
  font-weight: 700;
  font-size: 17px;
}

.card-time {
  font-size: 14px;
  margin: 2px 0 10px 0;
  opacity: 0.8;
}

.card-warning {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
  margin-top: 8px;
}

/* Deadline Card - Rouge */
.deadline-card {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}

.deadline-card .card-icon {
  color: #ef4444;
}

.deadline-card .card-title,
.deadline-card .card-value,
.deadline-card .card-time {
  color: rgba(255, 255, 255, 0.9);
}

/* Grade Card - Bleu */
.grade-card {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.08);
}

.grade-card .card-icon {
  color: #3b82f6;
}

.grade-card .card-title,
.grade-card .card-value {
  color: rgba(255, 255, 255, 0.9);
}

.grade-card .card-value strong {
  color: #60a5fa;
}

.grade-card .card-warning {
  color: #fbbf24;
}

.grade-card .card-warning i {
  color: #f59e0b;
}

/* Teacher Card - Vert */
.teacher-card {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}

.teacher-card .card-icon {
  color: #10b981;
}

.teacher-card .card-title,
.teacher-card .card-value {
  color: rgba(255, 255, 255, 0.9);
}

.teacher-card .card-link {
  color: #10b981;
}

.teacher-card .card-link:hover {
  color: #34d399;
  transform: translateX(3px);
}

/* Countdown */
.countdown {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.15);
  border-radius: 6px;
}

.countdown i {
  color: #ef4444;
  font-size: 14px;
}

.countdown-value {
  font-weight: 700;
  color: #ef4444;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
  .branch-info {
    grid-template-columns: 1fr;
  }

  .info-card {
    padding: 16px;
  }

  .card-icon {
    font-size: 28px;
    width: 40px;
  }
}
