/* ============================================================
   Administration des Sinistres — Wireframe Prototype Styles
   Functionality-first: clean, readable, functional UI
   ============================================================ */

:root {
  --primary: #2c5f8a;
  --primary-dark: #1d4060;
  --primary-light: #e8f0f7;
  --danger: #c0392b;
  --danger-light: #fdecea;
  --success: #27ae60;
  --success-light: #eafaf1;
  --warning: #f39c12;
  --warning-light: #fef9e7;
  --info: #2980b9;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;
  --border-radius: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --font-mono: 'Consolas', 'Monaco', monospace;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-100);
  line-height: 1.5;
}

/* ---- LAYOUT ---- */
.app-header {
  background: var(--primary-dark);
  color: white;
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  box-shadow: var(--shadow-md);
  z-index: 100;
}

.app-header h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.app-header .subtitle {
  font-size: 11px;
  opacity: 0.7;
  margin-left: 12px;
}

.lang-select {
  padding: 5px 10px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--border-radius);
  background: rgba(255,255,255,0.1);
  color: white;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.lang-select:hover {
  background: rgba(255,255,255,0.2);
}

.lang-select option {
  background: var(--primary-dark);
  color: white;
}

/* ---- NAVIGATION ---- */
.nav-bar {
  background: var(--primary);
  display: flex;
  padding: 0 24px;
  gap: 2px;
  box-shadow: var(--shadow);
}

.nav-tab {
  padding: 10px 20px;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: transparent;
  transition: all 0.15s;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.nav-tab:hover {
  color: white;
  background: rgba(255,255,255,0.08);
}

.nav-tab.active {
  color: white;
  border-bottom-color: white;
  background: rgba(255,255,255,0.1);
}

/* ---- MAIN CONTENT ---- */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px;
}

.module-view { display: none; }
.module-view.active { display: block; }

/* ---- PANELS / SECTIONS ---- */
.panel {
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.panel-header {
  background: var(--gray-200);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-body { padding: 16px; }

/* ---- FORMS ---- */
.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  min-width: 180px;
}

.form-group.wide { flex: 1; min-width: 300px; }

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-group label .required { color: var(--danger); }

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  padding: 7px 10px;
  border: 1px solid var(--gray-400);
  border-radius: var(--border-radius);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s;
  background: white;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(44,95,138,0.15);
}

input:read-only, input:disabled, select:disabled {
  background: var(--gray-200);
  color: var(--gray-600);
  cursor: not-allowed;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.checkbox-group label {
  font-size: 13px;
  font-weight: normal;
  color: var(--gray-700);
  text-transform: none;
  cursor: pointer;
}

/* ---- BUTTONS ---- */
.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.btn {
  padding: 7px 16px;
  border: 1px solid var(--gray-400);
  border-radius: var(--border-radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: white;
  color: var(--gray-700);
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.btn:hover:not(:disabled) { background: var(--gray-200); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: #a93226; }

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}
.btn-success:hover:not(:disabled) { background: #1e8449; }

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

.btn-group {
  display: inline-flex;
  gap: 0;
}

.btn-group .btn {
  border-radius: 0;
}
.btn-group .btn:first-child { border-radius: var(--border-radius) 0 0 var(--border-radius); }
.btn-group .btn:last-child { border-radius: 0 var(--border-radius) var(--border-radius) 0; }
.btn-group .btn + .btn { border-left: none; }
.btn-group .btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ---- DATA TABLE ---- */
.table-container {
  overflow-x: auto;
  margin-top: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--gray-200);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--gray-700);
  border-bottom: 2px solid var(--gray-300);
  white-space: nowrap;
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
}

thead th:hover { background: var(--gray-300); }

tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}

tbody tr:hover { background: var(--primary-light); }
tbody tr.selected { background: #d4e6f5; }

tbody td input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.table-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-500);
  font-style: italic;
}

/* ---- PAGINATION ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 12px;
  color: var(--gray-600);
}

.pagination .page-info { font-weight: 500; }

.pagination .page-controls {
  display: flex;
  gap: 4px;
}

/* ---- MODAL / POPUP ---- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

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

.modal {
  background: white;
  border-radius: 6px;
  width: 90%;
  max-width: 650px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.modal-header {
  padding: 14px 20px;
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 14px;
  border-radius: 6px 6px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.8;
  line-height: 1;
}
.modal-close:hover { opacity: 1; }

.modal-body { padding: 20px; }

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--gray-300);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---- BADGES & TAGS ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-info { background: #dbeafe; color: #1e40af; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ---- STATUS / MESSAGES ---- */
.alert {
  padding: 10px 14px;
  border-radius: var(--border-radius);
  margin-bottom: 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #b3d1e8; }
.alert-success { background: var(--success-light); color: #1a7a42; border: 1px solid #a3d9b1; }
.alert-warning { background: var(--warning-light); color: #7d5a04; border: 1px solid #f5d78e; }
.alert-danger { background: var(--danger-light); color: #8a2318; border: 1px solid #f5c6cb; }

/* ---- ASSUMPTION COMMENTS (visible in UI for wireframe) ---- */
.assumption-note {
  background: #fff8e1;
  border-left: 3px solid var(--warning);
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 12px;
  color: var(--gray-700);
}

.assumption-note::before {
  content: "ASSUMPTION: ";
  font-weight: 700;
  color: var(--warning);
}

.todo-note {
  background: #e8f0fe;
  border-left: 3px solid var(--info);
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 12px;
  color: var(--gray-700);
}

.todo-note::before {
  content: "TODO: ";
  font-weight: 700;
  color: var(--info);
}

/* ---- UTILITIES ---- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.flex-spacer { flex: 1; }

/* ---- AUTOCOMPLETE DROPDOWN ---- */
.autocomplete-wrap {
  position: relative;
}

.autocomplete-wrap input {
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%236c757d' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
}

.autocomplete-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  background: white;
  border: 1px solid var(--primary);
  border-top: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  max-height: 220px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.autocomplete-dropdown.open {
  display: block;
}

.autocomplete-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--gray-800);
  border-bottom: 1px solid var(--gray-200);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.autocomplete-item .match {
  font-weight: 700;
  color: var(--primary);
}

.autocomplete-empty {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--gray-500);
  font-style: italic;
}

/* ---- CHECKBOX LIST (single-select checkbox groups) ---- */
.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0;
}

.checkbox-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: normal;
  color: var(--gray-700);
  cursor: pointer;
  padding: 3px 0;
  text-transform: none;
  letter-spacing: 0;
}

.checkbox-list-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .form-row { flex-direction: column; }
  .form-group { min-width: 100%; }
  .nav-bar { overflow-x: auto; }
  .main-content { padding: 12px; }
}

/* ================================================================
   LOGIN OVERLAY
   ================================================================ */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: linear-gradient(135deg, #0f2236 0%, #1d4060 50%, #2c5f8a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-fade-out {
  animation: loginFadeOut 0.35s ease forwards;
}

@keyframes loginFadeOut {
  to { opacity: 0; transform: scale(1.03); }
}

.login-card {
  background: white;
  border-radius: 10px;
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  animation: loginSlideIn 0.3s ease;
  text-align: center;
}

@keyframes loginSlideIn {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-logo {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

.login-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 28px;
}

.login-form {
  text-align: left;
}

.login-field {
  margin-bottom: 18px;
}

.login-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.login-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-400);
  border-radius: var(--border-radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--gray-900);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(44,95,138,0.18);
}

.login-pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-pw-wrap .login-input {
  padding-right: 42px;
}

.login-toggle-pw {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.login-toggle-pw:hover { opacity: 1; }

.login-error {
  background: var(--danger-light);
  border: 1px solid #f5c6cb;
  color: #8a2318;
  border-radius: var(--border-radius);
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

.login-submit-btn {
  width: 100%;
  padding: 11px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
  letter-spacing: 0.3px;
}

.login-submit-btn:hover:not(:disabled) { background: var(--primary-dark); }

.login-submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.login-footer-note {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 20px;
  text-align: center;
}

/* Logout button in header */
.header-logout-btn {
  padding: 5px 12px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--border-radius);
  background: rgba(255,255,255,0.1);
  color: white;
  font-size: 12px;
  cursor: pointer;
  margin-left: 10px;
  transition: background 0.15s;
  white-space: nowrap;
}

.header-logout-btn:hover { background: rgba(255,255,255,0.2); }

/* Responsive login */
@media (max-width: 480px) {
  .login-card { padding: 28px 20px 24px; }
  .login-title { font-size: 15px; }
}
