/* common.css - Charte graphique BIA Pro */

/* POLICES */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&family=Proxima+Nova:wght@400;600&display=swap');

/* VARIABLES BIA PRO */
:root {
  /* Couleurs principales */
  --color-primary: #1E98CF;
  --color-primary-dark: #033860;
  --color-secondary: #FF6B00;
  --color-secondary-dark: #e05f00;
  --color-white: #FFFFFF;
  --color-gray: #CFCFCF;
  --color-gray-dark: #666;
  
  /* Backgrounds */
  --color-bg: #f8f9fa;
  --color-bg-card: #FFFFFF;
  
  /* Texte */
  --color-text: #033860;
  --color-text-muted: #666;
  
  /* Bordures */
  --color-border: #e5e7eb;
  --color-border-light: #f0f0f0;
  
  /* Ombres */
  --shadow-sm: 0 4px 12px rgba(3, 56, 96, 0.15);
  --shadow-md: 0 6px 20px rgba(3, 56, 96, 0.18);
  --shadow-lg: 0 12px 40px rgba(3, 56, 96, 0.22);
  
  /* Polices */
  --font-body: 'Proxima Nova', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Source Sans Pro', sans-serif;
}

/* RESET */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* LAYOUT GLOBAL */
body {
  font-family: var(--font-body);
  background: #f5f5f5;
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Fond blanc quand connecté */
body.logged-in {
  background: #ffffff;
}

/* TYPOGRAPHIE */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-primary);
}

h1 { font-size: 2em; }
h2 { font-size: 1.5em; }
h3 { font-size: 1.25em; }

/* BOUTONS */
.btn {
  display: inline-block;
  font-family: var(--font-heading);
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-size: 14px;
  text-align: center;
}

.btn-primary {
  background: var(--color-secondary);
  color: var(--color-white);
  border: none;
}

.btn-primary:hover {
  background: var(--color-secondary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.3);
}

.btn-secondary {
  background: var(--color-secondary);
  color: var(--color-white);
}

.btn-secondary:hover {
  background: var(--color-secondary-dark);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.btn-ghost:hover {
  background: var(--color-primary);
  color: var(--color-white);
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-outline:hover {
  background: var(--color-bg);
  border-color: var(--color-primary);
}

.btn.small {
  padding: 6px 16px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* CARTES */
.card, .panel {
  background: var(--color-bg-card);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

/* Cards grises quand connecté */
body.logged-in .card,
body.logged-in .panel {
  background: #f5f5f5;
}

.card-header {
  margin-bottom: 20px;
}

.card-title {
  font-size: 1.5em;
  margin-bottom: 8px;
  color: var(--color-primary);
}

.card-subtitle {
  color: var(--color-text-muted);
  font-size: 14px;
}

/* FORMULAIRES */
.form-block {
  margin-bottom: 20px;
}

.form-row {
  margin-bottom: 16px;
}

.form-label, label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
  font-size: 14px;
}

.input, input[type="text"], 
input[type="email"], 
input[type="password"],
input[type="number"],
select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.input:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30, 152, 207, 0.1);
}

.input:disabled, input:disabled, select:disabled {
  background: var(--color-bg);
  cursor: not-allowed;
}

/* TABLEAUX */
table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--color-bg);
}

th {
  font-family: var(--font-heading);
  font-weight: 600;
  text-align: left;
  padding: 12px;
  color: var(--color-primary-dark);
  font-size: 13px;
  border-bottom: 2px solid var(--color-border);
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 14px;
}

tbody tr:hover td {
  background: #fff5f0;
}

/* MESSAGES */
.messages {
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
}

.messages.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.messages.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.messages.info {
  background: #fff5f0;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

/* UTILITAIRES */
.hidden {
  display: none !important;
}

.text-muted, .muted {
  color: var(--color-text-muted);
}

.text-center {
  text-align: center;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

/* MODALES */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
  background: rgba(3, 56, 96, 0.4);
}

.modal-dialog {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.30);
  width: min(920px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-dialog-wide {
  max-width: 1200px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
  font-family: var(--font-heading);
}

.modal-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--color-text-muted);
}

.modal-body {
  padding: 20px;
  overflow: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* HEADER/TOPBAR */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--color-border);
}

.topbar-left h1, .page-title {
  font-size: 1.8em;
  margin-bottom: 4px;
  color: var(--color-primary);
}

.topbar-subtitle {
  color: var(--color-text-muted);
  font-size: 14px;
}

/* LOGO */
.logo {
  max-width: 150px;
  height: auto;
}

.logo-container {
  text-align: center;
  padding: 20px 0;
}

/* Logo en haut à gauche pour l'espace connecté */
.logo-header {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 30;
}

.logo-header .logo {
  max-width: 100px;
}

/* COMPARAISON DE BILANS (Medical Record) */
.mr-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.mr-user-name {
  font-size: 18px;
  font-weight: 600;
}

.mr-controls {
  display: flex;
  gap: 12px;
}

.mr-control-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
}

.mr-control-block label {
  font-size: 12px;
  color: var(--color-text-muted);
}

.mr-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mr-column {
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  padding: 12px 14px;
  overflow: auto;
}

.mr-column-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}


.app {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.main {
    width: 100%;
    max-width: 1120px;
    margin: 32px auto 40px;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Panel login spécifique */
.login-panel {
    max-width: 420px;
    margin: 40px auto 24px;
    background: var(--color-bg-card);
    border-radius: 14px;
    padding: 28px 32px 26px;
    box-shadow: var(--shadow-md);
}

.login-panel h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-primary);
    margin: 0 0 4px;
}

.login-panel p {
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 0 0 16px;
}

.login-panel .form-block {
    margin-bottom: 20px;
}

.login-panel label {
    display: block;
    margin-bottom: 8px;
}

.login-panel input {
    margin-bottom: 20px;
}

.login-panel button {
    margin-top: 8px;
}

/* Groupe recherche texte */
.search-group {
    flex: 1 1 260px;
}

.search-wrapper {
    display: flex;
    gap: 8px;
}

.search-wrapper input[type='text'] {
    flex: 1;
}

/* Responsive */
@media (max-width: 900px) {
    .filters-row {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .main {
        margin-top: 16px;
    }

    .login-panel {
        margin-top: 40px;
        padding: 18px 18px 16px;
    }
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  table {
    font-size: 12px;
  }
  
  th, td {
    padding: 8px;
  }
}

@media (max-width: 900px) {
  .mr-columns {
    grid-template-columns: 1fr;
  }

  .mr-header {
    flex-direction: column;
    gap: 12px;
  }

  .mr-controls {
    flex-direction: column;
    width: 100%;
  }

  .mr-control-block {
    width: 100%;
  }
}
