/* ============================================
   COLOR PALETTE - ANAC Mauritanie
   ============================================ */
:root {
  --primary-blue: #2B5A8E;
  --primary-blue-dark: #1e3f63;
  --primary-blue-light: #3d6fa8;
  --gold: #D4AF37;
  --gold-dark: #b8941f;
  --green: #006B3F;
  --red: #C8102E;
  --overlay-dark: rgba(0, 0, 0, 0.75);
  --overlay-light: rgba(255, 255, 255, 0.95);
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  line-height: 1.6;
  color: #2d3748;
  background-image: url('./assets/ANAC-logo.png');
  background-size: 400px auto;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgba(43, 90, 142, 0.92) 0%, 
    rgba(30, 63, 99, 0.95) 100%);
  z-index: -1;
}

body::after {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 420px;
  height: 420px;
  background-image: url('./assets/ANAC-logo.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  position: relative;
}

.table-section {
  position: relative;
}

/* ============================================
   HEADER STYLES
   ============================================ */
header {
  margin-bottom: 30px;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.logo {
  height: 60px;
  width: auto;
  object-fit: contain;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1 {
  text-align: center;
  color: #2d3748;
  margin-bottom: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

h2 {
  margin-bottom: 20px;
  color: #2d3748;
  font-size: 22px;
  font-weight: 600;
}

/* ============================================
   FILTERS SECTION
   ============================================ */
.filters {
  background: #f7fafc;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 25px;
  border: 1px solid #e2e8f0;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 15px;
  align-items: end;
}

.filter-row:last-child {
  margin-bottom: 0;
}

.filter-group {
  flex: 1;
  min-width: 200px;
}

.filter-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group input,
.filter-group select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: white;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(43, 90, 142, 0.15);
  transform: translateY(-1px);
}

.filter-group input::placeholder {
  color: #a0aec0;
}

/* ============================================
   BUTTONS
   ============================================ */
.button-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.actions {
  margin-bottom: 20px;
  text-align: center;
}

.actions .button-group {
  justify-content: center;
}

button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  color: white;
  position: relative;
  overflow: hidden;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-blue-light) 0%, var(--primary-blue) 100%);
}

.btn-success {
  background: linear-gradient(135deg, var(--green) 0%, #005030 100%);
}

.btn-success:hover {
  background: linear-gradient(135deg, #005030 0%, #004025 100%);
}

.btn-secondary {
  background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

.btn-warning {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: var(--primary-blue-dark);
}

.btn-warning:hover {
  background: linear-gradient(135deg, var(--gold-dark) 0%, #9a7a15 100%);
}

.btn-active {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: var(--primary-blue-dark);
}

/* ============================================
   TABLE
   ============================================ */
.table-wrapper {
  overflow: visible;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  background: white;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 14px;
}

thead {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
  color: white;
}

th {
  padding: 14px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

td {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}

tbody tr {
  transition: all 0.2s ease;
  cursor: pointer;
}

tbody tr:hover {
  background: #f7fafc;
  transform: scale(1.01);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

tfoot {
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  color: white;
  font-weight: 700;
}

tfoot td {
  padding: 14px 12px;
  border-bottom: none;
  font-size: 15px;
}

.delete-btn {
  background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

.delete-btn:hover {
  background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(245, 101, 101, 0.3);
}

/* ============================================
   MODAL
   ============================================ */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease-out;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* ============================================
   FORMS
   ============================================ */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group .field-hint {
  display: block;
  font-size: 11px;
  color: #718096;
  margin-top: 4px;
  font-style: italic;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: white;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(43, 90, 142, 0.15);
  transform: translateY(-1px);
}

.form-group input::placeholder {
  color: #a0aec0;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 25px;
}

.modal-buttons button {
  flex: 1;
  padding: 12px 20px;
  font-size: 15px;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #718096;
}

.empty-state p {
  font-size: 18px;
  margin-bottom: 10px;
  font-weight: 500;
}

.empty-state small {
  font-size: 14px;
  color: #a0aec0;
}

/* ============================================
   NOTIFICATIONS
   ============================================ */
#notificationContainer {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  pointer-events: none;
}

.notification {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-bottom: 10px;
  animation: slideInRight 0.3s ease-out;
  pointer-events: all;
  font-weight: 500;
  max-width: 300px;
}

.notification.error {
  background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
}

.notification.warning {
  background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
}

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

/* ============================================
   LOADING STATES
   ============================================ */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  .container {
    padding: 20px;
    border-radius: 12px;
  }
  
  h1 {
    font-size: 22px;
    margin-bottom: 20px;
  }
  
  .filter-row {
    flex-direction: column;
    gap: 10px;
  }
  
  .filter-group {
    width: 100%;
    min-width: auto;
  }
  
  .button-group {
    flex-direction: column;
    gap: 8px;
  }
  
  button {
    padding: 12px 16px;
    font-size: 14px;
    width: 100%;
  }
  
  .actions .button-group {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .actions button {
    width: auto;
    flex: 1;
    min-width: 150px;
  }
  
  table {
    font-size: 12px;
  }
  
  th, td {
    padding: 8px 6px;
  }
  
  th {
    font-size: 11px;
  }
  
  .modal-content {
    padding: 20px;
    width: 95%;
    margin: 10px;
  }
  
  .modal-buttons {
    flex-direction: column;
  }
  
  .delete-btn {
    padding: 8px 10px;
    font-size: 11px;
  }
  
  #notificationContainer {
    top: 10px;
    right: 10px;
    left: 10px;
  }
  
  .notification {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 15px;
  }
  
  h1 {
    font-size: 20px;
  }
  
  .filters {
    padding: 15px;
  }
  
  .filter-group input,
  .filter-group select,
  .form-group input,
  .form-group select {
    padding: 10px 12px;
  }
  
  th, td {
    padding: 6px 4px;
    font-size: 11px;
  }
  
  .empty-state {
    padding: 40px 15px;
  }
  
  .empty-state p {
    font-size: 16px;
  }
}

/* ============================================
   ACCESSIBILITY & INTERACTION
   ============================================ */
button:focus,
input:focus,
select:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

button:focus:not(:focus-visible) {
  outline: none;
}

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

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  body {
    background: white !important;
    background-image: none !important;
    padding: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body::before {
    display: none !important;
  }

  body::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    background-image: url('./assets/ANAC-logo.png') !important;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.10;
    pointer-events: none;
    z-index: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .container {
    box-shadow: none !important;
    background: transparent !important;
    padding: 20px;
  }

  .filters-section,
  .actions-section,
  .modal {
    display: none !important;
  }

  .table-wrapper {
    box-shadow: none !important;
    background: transparent !important;
    overflow: visible !important;
  }

  table {
    background: transparent !important;
    font-size: 12px;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    border: none !important;
  }

  thead, tfoot, tbody, tr, td, th {
    background: transparent !important;
    background-color: transparent !important;
    color: black !important;
    border: none !important;
    box-shadow: none !important;
  }

  * {
    border-color: transparent !important;
  }

  tbody tr {
    background: transparent !important;
  }
  
  .delete-btn,
  .actions-cell,
  th:last-child {
    display: none;
  }
}

/* ============================================
   AUTHENTICATION MODAL STYLES
   ============================================ */
.auth-modal .modal-content {
  max-width: 400px;
}

.auth-modal h2 {
  color: #2d3748;
  margin-bottom: 10px;
}

.auth-modal p {
  color: #718096;
  margin-bottom: 20px;
  font-size: 14px;
}

.auth-modal .password-input {
  font-family: monospace;
  font-size: 16px;
  letter-spacing: 2px;
}

.auth-modal .password-input:focus {
  letter-spacing: 1px;
}

/* ============================================
   ACTIONS MENU STYLES
   ============================================ */
.actions-cell {
  position: relative;
  text-align: center;
  overflow: visible;
}

.actions-wrapper {
  position: relative;
  display: inline-block;
}

.actions-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  color: #4a5568;
  transition: all 0.2s ease;
  line-height: 1;
}

.actions-btn:hover {
  background: #f7fafc;
  color: #2d3748;
}

.actions-btn:active {
  transform: scale(0.95);
}

.actions-menu {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  top: calc(100% + 4px);
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  min-width: 160px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.actions-menu.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

.action-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  color: #2d3748;
  transition: background 0.2s ease;
}

.action-item:first-child {
  border-radius: 8px 8px 0 0;
}

.action-item:last-child {
  border-radius: 0 0 8px 8px;
}

.action-item:hover {
  background: #f7fafc;
}

.action-item.action-delete:hover {
  background: #fff5f5;
  color: #e53e3e;
}

.action-icon {
  font-size: 16px;
  display: inline-block;
  width: 20px;
  text-align: center;
}

/* Remove old delete button styles */
.delete-btn {
  display: none;
}
