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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f8f9fc;
  line-height: 1.6;
}

/* Messages d'alerte */
.alert {
  padding: 15px 20px;
  margin-bottom: 20px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Navigation par onglets */
.admin-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
  border-bottom: 2px solid #e3e6f0;
  padding-bottom: 0;
}

.tab-btn {
  padding: 12px 20px;
  background: none;
  border: none;
  color: #5a5c69;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: #4e73df;
  border-bottom-color: #4e73df;
}

.tab-btn.active {
  color: #4e73df;
  border-bottom-color: #4e73df;
  background: rgba(78, 115, 223, 0.1);
}

/* Contenu des onglets */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.admin-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.admin-header .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-title h1 {
  font-size: 24px;
  margin-bottom: 5px;
}

.admin-title p {
  opacity: 0.9;
  font-size: 14px;
}

.admin-actions {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  transition: all 0.3s;
}

.btn-primary {
  background: #4e73df;
  color: white;
}

.btn-secondary {
  background: #858796;
  color: white;
}

.btn-success {
  background: #1cc88a;
  color: white;
}

.btn-danger {
  background: #e74a3b;
  color: white;
}

.btn-warning {
  background: #f6c23e;
  color: white;
}

.btn:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.stat-card .icon {
  font-size: 30px;
  margin-bottom: 10px;
}

.stat-card .number {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 5px;
}

.stat-card.total .icon {
  color: #4e73df;
}

.stat-card.unread .icon {
  color: #e74a3b;
}

.stat-card.week .icon {
  color: #1cc88a;
}

.stat-card.today .icon {
  color: #f6c23e;
}

.filters {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.filters-row {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.filters input,
.filters select {
  padding: 8px 12px;
  border: 2px solid #e1e5e9;
  border-radius: 5px;
  font-size: 14px;
}

.filters input:focus,
.filters select:focus {
  outline: none;
  border-color: #4e73df;
}

.messages-table {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e3e6f0;
}

.table th {
  background: #f8f9fc;
  font-weight: 600;
  color: #5a5c69;
}

.table tr:hover {
  background: #f8f9fc;
}

.message-preview {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.status-unread {
  background: #fee;
  color: #c33;
}

.status-read {
  background: #efe;
  color: #3c3;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.pagination a,
.pagination span {
  padding: 8px 12px;
  text-decoration: none;
  border-radius: 5px;
  border: 1px solid #e1e5e9;
}

.pagination a:hover {
  background: #f8f9fc;
}

.pagination .current {
  background: #4e73df;
  color: white;
  border-color: #4e73df;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 30px;
  border-radius: 10px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e3e6f0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #858796;
}

.message-details {
  line-height: 1.8;
}

.message-details .field {
  margin-bottom: 15px;
}

.message-details .label {
  font-weight: 600;
  color: #5a5c69;
  display: block;
  margin-bottom: 5px;
}

.message-details .value {
  color: #333;
}

.message-text {
  background: #f8f9fc;
  padding: 15px;
  border-radius: 5px;
  border-left: 4px solid #4e73df;
  white-space: pre-wrap;
  word-wrap: break-word;
}

@media (max-width: 768px) {
  .filters-row {
    flex-direction: column;
    align-items: stretch;
  }

  .table-responsive {
    overflow-x: auto;
  }

  .admin-header .container {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .admin-actions {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* Styles spécifiques au cache */
.cache-actions-panel {
  background: white;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.cache-actions-panel h3 {
  margin-bottom: 20px;
  color: #5a5c69;
  font-size: 18px;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.cache-details {
  background: white;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.cache-details h3 {
  margin-bottom: 20px;
  color: #5a5c69;
  font-size: 18px;
}

.cache-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.info-card {
  background: #f8f9fc;
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid #4e73df;
}

.info-card h4 {
  color: #5a5c69;
  margin-bottom: 10px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-card p,
.info-card ul {
  color: #858796;
  font-size: 14px;
  margin: 0;
}

.info-card ul {
  list-style-type: none;
  padding: 0;
}

.info-card li {
  padding: 2px 0;
}

.cache-empty {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.cache-empty h3 {
  color: #5a5c69;
  margin-bottom: 10px;
}

.cache-empty p {
  color: #858796;
  max-width: 400px;
  margin: 0 auto;
}

/* États du cache dans les statistiques */
.stat-card.cache-active {
  border-left: 4px solid #1cc88a;
}

.stat-card.cache-inactive {
  border-left: 4px solid #e74a3b;
}

.stat-card.cache-valid {
  border-left: 4px solid #1cc88a;
}

.stat-card.cache-expired {
  border-left: 4px solid #f6c23e;
}

/* Section titres */
#cache-section h2 {
  margin-bottom: 30px;
  color: #5a5c69;
  font-size: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Styles pour la page de connexion */
.login-page {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  background: white;
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-header h1 {
  color: #333;
  margin-bottom: 10px;
  font-size: 24px;
}

.login-header p {
  color: #666;
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-weight: 500;
  font-size: 14px;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s;
  font-family: inherit;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-btn,
.back-btn {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-btn:hover,
.back-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.login-btn:active {
  transform: translateY(0);
}

.error {
  background: #fee;
  color: #c33;
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 20px;
  text-align: center;
  border: 1px solid #fcc;
  font-size: 14px;
}

/* Footer */
footer {
  text-align: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.8);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
}
