/* ============================================================
   Design System & Style CSS - Gestion Heures Enseignants UVCI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* HSL Color Palette - UVCI */
  --hue: 272;
  --primary: HSL(var(--hue), 63%, 28%);
  --primary-hover: HSL(var(--hue), 63%, 20%);
  --primary-light: HSL(var(--hue), 63%, 95%);
  --secondary: HSL(145, 100%, 29%);
  --secondary-hover: HSL(145, 100%, 22%);
  --secondary-light: HSL(145, 100%, 95%);
  
  /* Neutral scale */
  --bg-app: HSL(var(--hue), 10%, 97%);
  --bg-card: HSL(0, 0%, 100%);
  --bg-sidebar: HSL(var(--hue), 63%, 15%);
  --text-main: HSL(var(--hue), 40%, 20%);
  --text-muted: HSL(var(--hue), 20%, 50%);
  --text-light: HSL(var(--hue), 30%, 98%);
  --border: HSL(var(--hue), 20%, 88%);
  
  /* Feedback colors */
  --success: HSL(145, 80%, 38%);
  --success-bg: HSL(145, 80%, 95%);
  --warning: HSL(38, 95%, 48%);
  --warning-bg: HSL(38, 95%, 95%);
  --danger: HSL(358, 85%, 55%);
  --danger-bg: HSL(358, 85%, 96%);
  --info: HSL(200, 80%, 45%);
  --info-bg: HSL(200, 80%, 95%);

  /* Border radius & Shadow */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.08);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Application Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.app-sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 10;
  position: relative;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 3rem;
}

.sidebar-logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.3rem;
  color: white;
  box-shadow: 0 4px 12px rgba(47, 107, 240, 0.3);
}

.sidebar-logo-text {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
}

.sidebar-logo-text span {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-user {
  background: rgba(255, 255, 255, 0.04);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 4px;
  font-weight: 500;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.sidebar-menu-item a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.95rem;
  color: HSL(var(--hue), 20%, 75%);
  transition: var(--transition);
}

.sidebar-menu-item a:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-light);
}

.sidebar-menu-item.active a {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 4px 14px rgba(47, 107, 240, 0.25);
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1.5rem;
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  background-color: rgba(235, 87, 87, 0.1);
  color: #eb5757;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  background-color: #eb5757;
  color: white;
}

/* Main Content Area */
.app-content {
  flex-grow: 1;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 1400px;
  width: 100%;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.content-title h1 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.content-title p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.content-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* Styled Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
  font-size: 0.95rem;
  animation: slideIn 0.3s ease;
}

.alert-success {
  background-color: var(--success-bg);
  color: var(--success);
  border: 1px solid HSL(145, 80%, 90%);
}

.alert-danger {
  background-color: var(--danger-bg);
  color: var(--danger);
  border: 1px solid HSL(358, 85%, 92%);
}

/* Statistics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: HSL(var(--hue), 20%, 80%);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.stat-card.secondary::before {
  background: var(--secondary);
}

.stat-card.success::before {
  background: var(--success);
}

.stat-card.warning::before {
  background: var(--warning);
}

.stat-card.danger::before {
  background: var(--danger);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 0.25rem;
  line-height: 1;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-card.secondary .stat-icon {
  background-color: var(--secondary-light);
  color: var(--secondary);
}

.stat-card.success .stat-icon {
  background-color: var(--success-bg);
  color: var(--success);
}

.stat-card.warning .stat-icon {
  background-color: var(--warning-bg);
  color: var(--warning);
}

/* Cards & Sections */
.section-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* Custom Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(47, 107, 240, 0.2);
}

.btn-secondary {
  background-color: var(--secondary);
  color: white;
}

.btn-secondary:hover {
  background-color: var(--secondary-hover);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.2);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

/* Styled Table */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.925rem;
  background-color: var(--bg-card);
}

.custom-table th {
  background-color: HSL(var(--hue), 30%, 96%);
  color: var(--text-main);
  padding: 1rem;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

.custom-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}

.custom-table tr:last-child td {
  border-bottom: none;
}

.custom-table tr:hover td {
  background-color: HSL(var(--hue), 30%, 98%);
}

/* Badges for status */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.775rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-draft {
  background-color: HSL(var(--hue), 20%, 90%);
  color: var(--text-muted);
}

.badge-pending {
  background-color: var(--warning-bg);
  color: var(--warning);
}

.badge-success {
  background-color: var(--success-bg);
  color: var(--success);
}

.badge-danger {
  background-color: var(--danger-bg);
  color: var(--danger);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control {
  font-family: var(--font-sans);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  color: var(--text-main);
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 107, 240, 0.12);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* Login Page Layout */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, HSL(var(--hue), 50%, 15%), HSL(var(--hue), 60%, 8%));
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  color: white;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header .sidebar-logo {
  justify-content: center;
  margin-bottom: 1rem;
}

.login-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.login-header p {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.login-card .form-control {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
}

.login-card .form-control:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.login-card .form-label {
  color: rgba(255, 255, 255, 0.85);
}

.login-card .btn-primary {
  width: 100%;
  padding: 0.8rem;
  font-size: 1rem;
  margin-top: 1rem;
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Interactive Filter Bar */
.filter-bar {
  background-color: var(--bg-card);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.filter-inputs {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Modal and Comment box */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 480px;
  padding: 2rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
}

/* print styles for PDF outputs */
@media print {
  body {
    background-color: white;
    color: black;
  }
  .app-sidebar,
  .btn,
  .filter-bar,
  .content-actions,
  .alert,
  form {
    display: none !important;
  }
  .app-content {
    padding: 0;
    margin: 0;
    width: 100% !important;
    max-width: 100% !important;
  }
  .section-card {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  .custom-table th {
    background-color: #f1f5f9 !important;
    color: black !important;
    border-bottom: 2px solid #94a3b8 !important;
  }
  .custom-table td {
    border-bottom: 1px solid #e2e8f0 !important;
  }
  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 3px double #0284c7;
    padding-bottom: 1rem;
  }
  .print-footer {
    display: block !important;
    margin-top: 3rem;
    text-align: right;
    font-size: 0.9rem;
  }
}

.print-header,
.print-footer {
  display: none;
}
