:root {
  --primary-color: #DC143C;
  --secondary-color: #B01030;
  --success-color: #16a34a;
  --danger-color: #dc2626;
  --warning-color: #ea580c;
  --bg-color: #f8fafc;
  --text-color: #1e293b;
  --border-color: #e2e8f0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: var(--primary-color);
  color: white;
  padding: 0.75rem 0;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
}

.header-left {
  flex: 0 0 auto;
}

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

.header-right {
  flex: 0 0 auto;
}

.menu-hamburger {
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.menu-hamburger:hover {
  opacity: 0.8;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-logo-icon {
  position: relative;
  font-size: 2.5rem;
  filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
  display: inline-block;
  width: 3rem;
  height: 2.5rem;
}

.app-logo-house {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 2.5rem;
}

.app-logo-search {
  position: absolute;
  right: -0.3rem;
  bottom: -0.6rem;
  font-size: 2.5rem;
  filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.4));
}

.app-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.lang-selector {
  position: relative;
}

.lang-flag {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lang-flag:hover {
  opacity: 0.8;
}

.lang-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  padding: 1.5rem;
  z-index: 2000;
  display: none;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.lang-popup.active {
  display: block;
}

.lang-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1999;
  display: none;
}

.lang-popup-overlay.active {
  display: block;
}

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

.lang-popup-header h3 {
  margin: 0;
  color: var(--text-color);
  font-size: 1.25rem;
}

.lang-popup-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-color);
  padding: 0.25rem;
  line-height: 1;
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.lang-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.lang-item:hover {
  border-color: var(--primary-color);
  background: rgba(220, 20, 60, 0.05);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.lang-item.active {
  border-color: var(--primary-color);
  background: rgba(220, 20, 60, 0.1);
}

.lang-item-flag {
  font-size: 2rem;
  flex-shrink: 0;
}

.lang-item-name {
  font-weight: 500;
  color: var(--text-color);
}

/* Sliding Menu */
.sliding-menu {
  position: fixed;
  top: 0;
  left: -300px;
  width: 300px;
  height: 100vh;
  background: white;
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  transition: left 0.3s ease-in-out;
  overflow-y: auto;
}

.sliding-menu.open {
  left: 0;
}

.sliding-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2999;
  display: none;
}

.sliding-menu-overlay.active {
  display: block;
}

.sliding-menu-header {
  background: var(--primary-color);
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sliding-menu-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.sliding-menu-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.75rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.sliding-menu-content {
  padding: 0;
}

.sliding-menu-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sliding-menu-content li {
  border-bottom: 1px solid var(--border-color);
}

.sliding-menu-content li:last-child {
  border-bottom: none;
}

.sliding-menu-content a {
  display: block;
  padding: 1rem 1.5rem;
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}

.sliding-menu-content a:hover {
  background: rgba(220, 20, 60, 0.05);
  color: var(--primary-color);
  padding-left: 2rem;
}

.sliding-menu-content a.active {
  background: rgba(220, 20, 60, 0.1);
  color: var(--primary-color);
  border-left: 4px solid var(--primary-color);
}

.sliding-menu-footer {
  padding: 1.5rem;
  border-top: 2px solid var(--border-color);
  margin-top: 1rem;
}

/* Main content */
main {
  padding: 2rem 0;
  min-height: calc(100vh - 200px);
}

/* Cards */
.card {
  background: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-color);
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
}

/* Multi-select departments */
.departements-select {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  padding: 0.5rem;
  background: white;
}

.departement-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 0.25rem;
  transition: background 0.2s;
  cursor: pointer;
}

.departement-item:hover {
  background: var(--bg-color);
}

.departement-item input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

.departement-item label {
  cursor: pointer;
  margin: 0;
  flex: 1;
  font-weight: normal;
}

.departement-code {
  font-weight: 600;
  color: var(--primary-color);
  min-width: 2.5rem;
}

.selected-departements {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.selected-dep-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: rgba(220, 20, 60, 0.1);
  border: 1px solid var(--primary-color);
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
}

.selected-dep-tag button {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

.departements-search {
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  width: 100%;
  font-size: 0.9rem;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

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

.btn-primary:hover {
  background: var(--secondary-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

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

.btn-secondary:hover {
  background: #cbd5e1;
}

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

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

.btn-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

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

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* Search results */
.search-result {
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  transition: box-shadow 0.2s;
}

.search-result:hover {
  box-shadow: var(--shadow);
}

.search-result-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.75rem;
}

.search-result-title {
  font-weight: 600;
  font-size: 1.1rem;
}

.search-result-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #64748b;
}

/* Messages */
.message-item {
  padding: 1rem;
  border-left: 4px solid var(--primary-color);
  background: var(--bg-color);
  margin-bottom: 1rem;
  border-radius: 0.375rem;
}

.message-item.unread {
  background: #eff6ff;
  border-left-color: var(--warning-color);
}

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

.message-subject {
  font-weight: 600;
  font-size: 1.05rem;
}

.message-date {
  color: #64748b;
  font-size: 0.85rem;
}

.message-body {
  margin-top: 0.75rem;
  line-height: 1.6;
}

.message-links {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.message-links a {
  color: var(--primary-color);
  display: block;
  margin-bottom: 0.25rem;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: #64748b;
}

/* Error messages */
.error {
  background: #fee2e2;
  color: #991b1b;
  padding: 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--danger-color);
}

.success {
  background: #dcfce7;
  color: #166534;
  padding: 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--success-color);
}

/* Responsive */
@media (max-width: 768px) {
  .app-logo h1 {
    font-size: 1.2rem;
  }

  .app-logo-icon {
    font-size: 2rem;
  }

  .menu-hamburger,
  .lang-flag {
    font-size: 1.75rem;
  }

  .lang-grid {
    grid-template-columns: 1fr;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn-group .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .app-logo h1 {
    font-size: 1rem;
  }

  .app-logo-icon {
    font-size: 1.75rem;
  }

  .menu-hamburger,
  .lang-flag {
    font-size: 1.5rem;
    padding: 0.25rem;
  }

  .sliding-menu {
    width: 280px;
    left: -280px;
  }
}

/* Home page hero */
.hero {
  text-align: center;
  padding: 3rem 0;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(30, 64, 175, 0.05));
  border-radius: 0.5rem;
  margin-bottom: 2rem;
}

.hero h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.hero p {
  font-size: 1.125rem;
  color: #64748b;
  margin-bottom: 2rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.feature-card {
  text-align: center;
  padding: 2rem;
  background: white;
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: #64748b;
}

/* Contact Confirmation Popup */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.popup-card {
  background: white;
  border-radius: 8px;
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}
