/* app/static/css/custom.css */
/* v7 - Explicit navbar top: 0, removed main margin-top, rely on body padding */

/* --- Reset --- */
html, body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    width: 100%;
}

/* --- Root Variables --- */
:root {
  --navbar-height: px; /* Not defined bcs defining it completely adds a useless blank space, keep it like this no value works :/ */
  /* ... other variables ... */
  --primary-color: #0d6efd;
  --success-color: #198754;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --info-color: #0dcaf0;
  --secondary-color: #6c757d;
  --light-bg: #f8f9fa;
  --border-color: #dee2e6;
  --border-radius: 0.375rem;
  --body-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  font-family: var(--body-font);
  background-color: var(--light-bg);
  /* Primary mechanism for offset */
  padding-top: var(--navbar-height);
}

/* --- Navbar --- */
/* app/static/css/custom.css */

.navbar.sticky-top {
    /* ... your existing styles ... */
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    z-index: 1030;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
    border-bottom: 1px solid var(--border-color);
    /* Add this line */
    margin: 0;
 }
.navbar .navbar-nav .nav-link { padding-left: 1rem; padding-right: 1rem; }
.navbar .navbar-brand { font-weight: 500; }
.navbar .nav-item .nav-link.active { font-weight: 500; }


/* --- Sticky Alert Banner --- */
.alert.sticky-top {
    /* Keep previous styles, ensure 'top' is correct */
    position: sticky; /* Also make banner sticky */
    top: var(--navbar-height); /* Stick below navbar */
    z-index: 1029; /* Below navbar */
    /* ... rest of banner styles ... */
    border-radius: 0;
    margin-bottom: 0 !important;
    min-height: 50px;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

/* --- Main Content Area --- */
main.container {
  /* REMOVED margin-top !important; */
  /* Add padding back since container padding was removed before */
  padding: 1.5rem; /* Add padding for content inside */
  margin-bottom: 2rem !important;
  background-color: #ffffff;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}

/* --- Cards --- */
/* If using card inside main container, remove its border/shadow */
main.container > .card {
  margin-bottom: 0 !important;
  border: none;
  box-shadow: none;
  /* Remove padding from main.container if applying here */
  /* padding: 1.5rem; */
  border-radius: 0; /* No radius if it fills container */
}
/* ... rest of card styles ... */
.card-header {
    background-color: var(--light-bg);
    font-weight: 600;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}
main.container > .card > .card-header {
    border-radius: 0; /* Remove radius if card fills container */
}
.card-body { padding: 1.5rem; }
.card-body.p-0 { padding: 0 !important; }


/* --- Tables --- */
/* Keep all previous table fixes including .col-lots */
/* ... */
.table { margin-bottom: 0; }
.table th {
  font-weight: 600; color: var(--secondary-color); background-color: #fdfdff;
  border-bottom: 2px solid var(--border-color); border-top: none; padding: 0.9rem 1rem;
  vertical-align: middle; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.5px;
}
.table td {
    padding: 0.9rem 1rem; vertical-align: top; border-top: 1px solid var(--border-color);
    word-wrap: break-word; overflow-wrap: break-word; line-height: 1.4;
}
.table-hover > tbody > tr:hover > * { background-color: #f0f5ff; }
.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: rgba(0,0,0,0.015); }
.table-responsive { overflow-x: auto; }

/* Column Specific Styling */
.table .col-id { width: 5%; white-space: nowrap; text-align: center; vertical-align: middle;}
.table .col-acheteur { width: 15%; font-size: 0.9rem; }
.table .col-objet { width: 20%; font-size: 0.9rem; }
.table .col-type { width: 8%; font-size: 0.9rem; text-align: center;}

/* Force Wrapping for Lots Column (Simplest Content) */
.table .col-lots { width: 25%; max-width: 350px; }
.table .col-lots td {
    white-space: normal !important; word-wrap: break-word !important; overflow-wrap: anywhere !important;
    text-align: left !important; vertical-align: top !important; font-size: 0.85rem; line-height: 1.4 !important;
}
.table .col-lots td small {
    display: inline; white-space: normal !important; word-wrap: break-word !important;
    overflow-wrap: anywhere !important; line-height: 1.4 !important;
}

.table .col-visite { width: 20%; font-size: 0.85rem; line-height: 1.4; }
.table .col-visite strong { display: block; margin-bottom: 0.25rem; }
.table .col-visite small { color: var(--secondary-color); display: block; }
.table .col-date-limite { width: 10%; font-size: 0.9rem; text-align: center; }
.table .col-statut { width: 10%; text-align: center; vertical-align: middle;}
.table .col-date-traitement { width: 10%; font-size: 0.9rem; text-align: center; vertical-align: middle;}
.table .col-action { width: 15%; text-align: center; vertical-align: middle;}

/* Status Badge Redesign */
.table .badge {
    display: inline-block; padding: 0.4em 0.7em; font-size: 0.75rem; font-weight: 600;
    line-height: 1; text-align: center; white-space: nowrap; vertical-align: baseline;
    border-radius: var(--border-radius); text-transform: uppercase; letter-spacing: 0.5px; min-width: 110px;
}
.badge.bg-success { background-color: #d1e7dd !important; color: #0a3622 !important; border: 1px solid #a3cfbb; }
.badge.bg-warning { background-color: #fff3cd !important; color: #664d03 !important; border: 1px solid #ffda6a; }
.badge.bg-danger { background-color: #f8d7da !important; color: #58151c !important; border: 1px solid #f1aeb5; }
.badge.bg-info { background-color: #cff4fc !important; color: #055160 !important; border: 1px solid #9eeaf9; }
.badge.bg-primary { background-color: #cfe2ff !important; color: #052c65 !important; border: 1px solid #a9c9fe; }
.badge.bg-secondary { background-color: #e2e3e5 !important; color: #41464b !important; border: 1px solid #c6c8ca; }


/* --- Forms / Buttons / Alerts / Footer --- */
.form-label { font-weight: 500; }
.btn { border-radius: var(--border-radius); font-weight: 500; margin-bottom: 0.5rem; }
.btn-sm { font-size: 0.8rem; padding: 0.35rem 0.7rem; }
.alert { border-radius: var(--border-radius); }
footer { background-color: #343a40; color: rgba(255, 255, 255, 0.7); padding: 1.5rem 0; margin-top: 3rem; }

/* --- Responsive Adjustments --- */
/* Keep the previous @media block */
@media (max-width: 768px) {
  body { padding-top: var(--navbar-height); } /* Keep padding on mobile */
  main.container { padding: 0; border: none; box-shadow: none; margin-top: 0 !important; }
  main.container > .card { border-radius: 0; }
  .card-header { padding: 0.75rem 1rem; }
  .card-body { padding: 1rem; }
  .card-body.p-0 { padding: 0 !important; }

  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { margin-bottom: 1.5rem; border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 0.5rem; background-color: #fff; }
  .table td {
    text-align: right; padding: 0.5rem 0.75rem !important; padding-left: 45% !important; position: relative;
    border: none; border-bottom: 1px dashed var(--light-gray); white-space: normal !important;
    word-wrap: break-word; overflow-wrap: break-word; display: flex; justify-content: flex-end;
    align-items: center; min-height: 40px;
  }
   .table tr td:last-child { border-bottom: none; }
  .table td::before {
    content: attr(data-label); position: absolute; left: 0.75rem; width: 40%; padding-right: 0.75rem;
    font-weight: 600; text-align: left; white-space: nowrap; color: var(--secondary-color);
    font-size: 0.8rem; top: 50%; transform: translateY(-50%);
  }
  .table .col-lots td { text-align: right; }
  .table .col-lots td::before { text-align: left;}
  .table .col-visite { width: 100%; }
  .table .col-action { text-align: center; padding-left: 0.75rem !important; }
  .table .col-action::before { display: none; }
  .table .col-action .btn, .table .col-action form { display: block; width: 100%; margin-bottom: 0.5rem; margin-right: 0;}
  .table .col-action .btn:last-child, .table .col-action form:last-child { margin-bottom: 0; }
}