/* ========================================
   ADMIN AUTHENTICATION & PANEL STYLES
   ======================================== */

/* --- Login Button in Header --- */
.admin-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0.5rem;
  border: 1.5px solid #0a276a;
  border-radius: 6px;
  background: transparent;
  color: #0a276a;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.admin-login-btn:hover {
  background: #0a276a;
  color: #fff;
  border-color: #0a276a;
}

.admin-login-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* When logged in */
.admin-logged-in .admin-login-btn {
  border-color: #4CAF50;
  color: #4CAF50;
}

.admin-logged-in .admin-login-btn:hover {
  background: #4CAF50;
  color: #fff;
}

/* --- Admin Toolbar (shown when logged in) --- */
.admin-toolbar {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  gap: 10px;
  flex-direction: column;
  align-items: flex-end;
}

.admin-toolbar.visible {
  display: flex;
}

.admin-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: 10px;
  background: #0a276a;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(10, 39, 106, 0.3);
  transition: all 0.25s ease;
  text-decoration: none;
}

.admin-toolbar-btn:hover {
  background: #143a8f;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(10, 39, 106, 0.4);
}

.admin-toolbar-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.admin-toolbar-btn.logout-btn {
  background: #dc3545;
  box-shadow: 0 4px 16px rgba(220, 53, 69, 0.3);
}

.admin-toolbar-btn.logout-btn:hover {
  background: #c82333;
  box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

/* --- Login Modal --- */
.login-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  z-index: 10000;
  justify-content: center;
  align-items: center;
}

.login-modal-overlay.active {
  display: flex;
}

.login-modal {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  position: relative;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
  line-height: 1;
  padding: 4px;
  transition: color 0.2s;
}

.login-modal-close:hover {
  color: #111;
}

.login-modal h2 {
  font-family: 'Playfair Display', serif;
  color: #0a276a;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

.login-modal-subtitle {
  text-align: center;
  color: #6b7280;
  font-size: 0.9rem;
  margin-bottom: 1.8rem;
  font-family: 'Inter', sans-serif;
}

.login-form-group {
  margin-bottom: 1.2rem;
}

.login-form-group label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.4rem;
}

.login-form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.login-form-group input:focus {
  outline: none;
  border-color: #0a276a;
  box-shadow: 0 0 0 3px rgba(10, 39, 106, 0.1);
}

.login-error {
  display: none;
  color: #dc3545;
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  margin-bottom: 1rem;
  padding: 0.6rem 0.8rem;
  background: #fff5f5;
  border-radius: 6px;
  border: 1px solid #fee2e2;
}

.login-error.visible {
  display: block;
}

.login-submit-btn {
  width: 100%;
  padding: 0.8rem;
  border: none;
  border-radius: 8px;
  background: #0a276a;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.login-submit-btn:hover {
  background: #143a8f;
}

.login-submit-btn:active {
  transform: scale(0.98);
}

/* ========================================
   ADMIN PANEL PAGE
   ======================================== */

.admin-panel-main {
  padding: 2rem 0 4rem;
  min-height: calc(100vh - 200px);
}

.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e5e7eb;
}

.admin-panel-header h1 {
  font-family: 'Playfair Display', serif;
  color: #0a276a;
  font-size: 2rem;
  margin: 0;
}

.admin-panel-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 4px;
  overflow-x: auto;
}

.admin-tab {
  padding: 0.75rem 1.5rem;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
  white-space: nowrap;
}

.admin-tab:hover {
  color: #0a276a;
}

.admin-tab.active {
  background: #fff;
  color: #0a276a;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.admin-tab-content {
  display: none;
}

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

/* --- Form Styles --- */
.admin-form {
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
  border: 1px solid #e5e7eb;
  max-width: 700px;
}

.admin-form-group {
  margin-bottom: 1.5rem;
}

.admin-form-group label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.4rem;
}

.admin-form-group label .required {
  color: #dc3545;
}

.admin-form-group input[type="text"],
.admin-form-group input[type="date"],
.admin-form-group select,
.admin-form-group textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  background: #fff;
}

.admin-form-group input:focus,
.admin-form-group select:focus,
.admin-form-group textarea:focus {
  outline: none;
  border-color: #0a276a;
  box-shadow: 0 0 0 3px rgba(10, 39, 106, 0.1);
}

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

.admin-form-group small {
  display: block;
  margin-top: 0.3rem;
  color: #9ca3af;
  font-size: 0.78rem;
}

/* File upload */
.admin-file-upload {
  position: relative;
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.admin-file-upload:hover {
  border-color: #0a276a;
  background: #f8faff;
}

.admin-file-upload input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.admin-file-upload-label {
  font-family: 'Inter', sans-serif;
  color: #6b7280;
  font-size: 0.85rem;
}

.admin-file-upload-label svg {
  display: block;
  margin: 0 auto 0.5rem;
  width: 32px;
  height: 32px;
  fill: #9ca3af;
}

.admin-file-upload-label strong {
  color: #0a276a;
}

.admin-file-preview {
  margin-top: 0.75rem;
  display: none;
}

.admin-file-preview.visible {
  display: block;
}

.admin-file-preview img {
  max-width: 200px;
  max-height: 150px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e5e7eb;
}

.admin-file-preview .file-name {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  color: #374151;
  margin-top: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.admin-file-preview .file-name svg {
  width: 14px;
  height: 14px;
  fill: #4CAF50;
}

/* Submit */
.admin-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 2rem;
  border: none;
  border-radius: 8px;
  background: #0a276a;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.admin-submit-btn:hover {
  background: #143a8f;
}

.admin-submit-btn:active {
  transform: scale(0.98);
}

/* Success message */
.admin-success-message {
  display: none;
  padding: 1rem 1.2rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  color: #166534;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  align-items: center;
  gap: 0.5rem;
}

.admin-success-message.visible {
  display: flex;
}

.admin-success-message svg {
  width: 20px;
  height: 20px;
  fill: #166534;
  flex-shrink: 0;
}

/* --- Content List (existing admin items) --- */
.admin-content-list {
  margin-top: 2rem;
}

.admin-content-list h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: #374151;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.admin-content-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border: 1px solid #e5e7eb;
}

.admin-content-item-info {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: #374151;
}

.admin-content-item-info strong {
  color: #0a276a;
}

.admin-content-item-info span {
  color: #9ca3af;
  margin-left: 0.5rem;
  font-size: 0.8rem;
}

.admin-delete-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid #fee2e2;
  background: #fff5f5;
  color: #dc3545;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-delete-btn:hover {
  background: #dc3545;
  color: #fff;
  border-color: #dc3545;
}

/* --- Edit button --- */
.admin-edit-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #0a276a;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-edit-btn:hover {
  background: #0a276a;
  color: #fff;
  border-color: #0a276a;
}

/* --- Content item actions group --- */
.admin-content-item-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

/* --- Badges (Original / Ajouté) --- */
.admin-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
  margin-left: 0.4rem;
}

.admin-badge-original {
  background: #e0e7ff;
  color: #3730a3;
}

.admin-badge-new {
  background: #d1fae5;
  color: #065f46;
}

/* --- Form actions (submit + cancel) --- */
.admin-form-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 0.5rem;
}

.admin-cancel-edit-btn {
  padding: 0.65rem 1.2rem;
  border: 1.5px solid #d1d5db;
  background: #fff;
  color: #6b7280;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-cancel-edit-btn:hover {
  background: #f3f4f6;
  color: #374151;
  border-color: #9ca3af;
}

/* --- No access message --- */
.admin-no-access {
  text-align: center;
  padding: 4rem 2rem;
}

.admin-no-access svg {
  width: 64px;
  height: 64px;
  fill: #d1d5db;
  margin-bottom: 1rem;
}

.admin-no-access h2 {
  font-family: 'Playfair Display', serif;
  color: #374151;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.admin-no-access p {
  color: #6b7280;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .admin-login-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.78rem;
  }

  .admin-toolbar {
    bottom: 16px;
    right: 16px;
  }

  .login-modal {
    padding: 1.8rem;
    margin: 1rem;
  }

  .admin-panel-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-form {
    padding: 1.5rem;
  }

  .admin-panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}
