/* /assets/css/style.css */
/* Feuille de style principale — mobile-first */
/* Application GestionChantier */

/* ===================================================
   VARIABLES CSS
   =================================================== */
:root {
    --primary:      #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light:#dbeafe;
    --success:      #16a34a;
    --success-light:#dcfce7;
    --warning:      #d97706;
    --warning-light:#fef3c7;
    --danger:       #dc2626;
    --danger-light: #fee2e2;
    --gray-50:      #f9fafb;
    --gray-100:     #f3f4f6;
    --gray-200:     #e5e7eb;
    --gray-300:     #d1d5db;
    --gray-400:     #9ca3af;
    --gray-500:     #6b7280;
    --gray-600:     #4b5563;
    --gray-700:     #374151;
    --gray-800:     #1f2937;
    --gray-900:     #111827;
    --white:        #ffffff;
    --radius:       8px;
    --radius-lg:    12px;
    --shadow:       0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
    --shadow-md:    0 4px 6px rgba(0,0,0,.1), 0 2px 4px rgba(0,0,0,.06);
    --font:         'Segoe UI', system-ui, -apple-system, sans-serif;
    --header-h:     60px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ===================================================
   HEADER & NAVIGATION
   =================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--gray-900);
    box-shadow: var(--shadow-md);
    height: var(--header-h);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
    white-space: nowrap;
}

.nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--gray-600);
    color: var(--white);
    font-size: 1.3rem;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    cursor: pointer;
}

.main-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--gray-900);
    padding: 1rem;
    gap: .5rem;
    border-top: 1px solid var(--gray-700);
    z-index: 99;
}

.main-nav.open { display: flex; }

.main-nav a, .main-nav .nav-user {
    color: var(--gray-200);
    text-decoration: none;
    padding: .5rem .75rem;
    border-radius: var(--radius);
    font-size: .95rem;
    transition: background .15s;
}

.main-nav a:hover { background: var(--gray-700); text-decoration: none; color: var(--white); }

.nav-user { color: var(--gray-400) !important; font-size: .85rem; }

.btn-logout {
    color: var(--danger) !important;
    border: 1px solid var(--danger) !important;
}
.btn-logout:hover { background: var(--danger) !important; color: var(--white) !important; }

/* ===================================================
   CONTENU PRINCIPAL
   =================================================== */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* ===================================================
   FOOTER
   =================================================== */
.site-footer {
    background: var(--gray-800);
    color: var(--gray-400);
    text-align: center;
    padding: .75rem 1rem;
    font-size: .8rem;
}

/* ===================================================
   TITRES DE PAGE
   =================================================== */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.page-title .subtitle {
    font-size: 1rem;
    font-weight: 400;
    color: var(--gray-500);
}

/* ===================================================
   CARTES
   =================================================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* ===================================================
   GRILLE STATS
   =================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1rem;
    text-align: center;
    border-top: 3px solid var(--primary);
}

.stat-card.green  { border-color: var(--success); }
.stat-card.orange { border-color: var(--warning); }
.stat-card.red    { border-color: var(--danger); }

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.1;
}

.stat-label {
    font-size: .8rem;
    color: var(--gray-500);
    margin-top: .25rem;
}

/* ===================================================
   CHRONO EN COURS
   =================================================== */
.chrono-banner {
    background: linear-gradient(135deg, #1e3a5f 0%, var(--primary) 100%);
    color: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-md);
}

.chrono-banner h2 {
    font-size: 1rem;
    font-weight: 600;
    opacity: .85;
    margin-bottom: .25rem;
}

.chrono-banner .client-name {
    font-size: .9rem;
    opacity: .75;
    margin-bottom: .75rem;
}

.chrono-display {
    font-size: 2.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: .05em;
    margin-bottom: .75rem;
}

.chrono-paused .chrono-display { opacity: .5; }

.chrono-status {
    display: inline-block;
    font-size: .75rem;
    font-weight: 600;
    padding: .2rem .6rem;
    border-radius: 99px;
    background: rgba(255,255,255,.2);
    margin-bottom: 1rem;
}

.chrono-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

/* ===================================================
   BOUTONS
   =================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, transform .1s, box-shadow .15s;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }

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

.btn-success  { background: var(--success); color: var(--white); }
.btn-success:hover { background: #15803d; color: var(--white); }

.btn-warning  { background: var(--warning); color: var(--white); }
.btn-warning:hover { background: #b45309; color: var(--white); }

.btn-danger   { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #b91c1c; color: var(--white); }

.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); color: var(--gray-900); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg { padding: .8rem 1.5rem; font-size: 1.05rem; }
.btn-block { width: 100%; justify-content: center; }

/* ===================================================
   FORMULAIRES
   =================================================== */
.form-group {
    margin-bottom: 1.1rem;
}

.form-label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: .35rem;
}

.form-control {
    width: 100%;
    padding: .6rem .85rem;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: .95rem;
    font-family: var(--font);
    background: var(--white);
    color: var(--gray-900);
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.form-control::placeholder { color: var(--gray-400); }

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

select.form-control {
    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 fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    padding-right: 2.2rem;
}

.form-hint {
    font-size: .78rem;
    color: var(--gray-500);
    margin-top: .25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

/* ===================================================
   ALERTES & MESSAGES
   =================================================== */
.alert {
    padding: .85rem 1.1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .9rem;
    border-left: 4px solid transparent;
}

.alert-success { background: var(--success-light); border-color: var(--success); color: #14532d; }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: #78350f; }
.alert-danger  { background: var(--danger-light);  border-color: var(--danger);  color: #7f1d1d; }
.alert-info    { background: var(--primary-light);  border-color: var(--primary); color: #1e3a8a; }

/* ===================================================
   TABLEAUX
   =================================================== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    background: var(--white);
    margin-bottom: 1.25rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* ===================================================
   BADGES STATUTS
   =================================================== */
.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-planifiée  { background: var(--primary-light);  color: var(--primary-dark); }
.badge-en_cours   { background: var(--warning-light);  color: #92400e; }
.badge-en_pause   { background: var(--gray-200);       color: var(--gray-700); }
.badge-terminée   { background: var(--success-light);  color: #14532d; }
.badge-actif      { background: var(--success-light);  color: #14532d; }
.badge-archivé    { background: var(--gray-200);       color: var(--gray-600); }

/* ===================================================
   LISTE D'INTERVENTIONS
   =================================================== */
.interv-list { list-style: none; }

.interv-item {
    background: var(--white);
    border-radius: var(--radius);
    padding: .85rem 1rem;
    margin-bottom: .5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: .25rem;
    border-left: 3px solid var(--gray-300);
    transition: box-shadow .15s;
}

.interv-item:hover { box-shadow: var(--shadow-md); }
.interv-item.planifiée  { border-color: var(--primary); }
.interv-item.en_cours   { border-color: var(--warning); }
.interv-item.terminée   { border-color: var(--success); }
.interv-item.en_pause   { border-color: var(--gray-400); }

.interv-item-title {
    font-weight: 600;
    color: var(--gray-900);
    font-size: .95rem;
}

.interv-item-meta {
    font-size: .8rem;
    color: var(--gray-500);
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}

/* ===================================================
   PHOTOS GRID
   =================================================== */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: .75rem;
    margin-top: .75rem;
}

.photo-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--gray-200);
    aspect-ratio: 1;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .2s;
}

.photo-item:hover img { transform: scale(1.05); }

.photo-item .photo-actions {
    position: absolute;
    top: .25rem;
    right: .25rem;
    display: none;
    gap: .25rem;
}

.photo-item:hover .photo-actions { display: flex; }

.photo-del-btn {
    background: var(--danger);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    padding: .2rem .4rem;
    font-size: .75rem;
    cursor: pointer;
}

.photo-legende {
    font-size: .75rem;
    color: var(--gray-600);
    padding: .25rem .4rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--white);
}

/* ===================================================
   TÉLÉPHONES DYNAMIQUES
   =================================================== */
.tel-row {
    display: flex;
    gap: .5rem;
    align-items: center;
    margin-bottom: .5rem;
}

.tel-row .form-control { flex: 1; }

.tel-row select { width: 110px; flex-shrink: 0; }

.tel-del-btn {
    background: var(--danger-light);
    color: var(--danger);
    border: none;
    border-radius: var(--radius);
    width: 32px;
    height: 36px;
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
}

/* ===================================================
   PAGINATION
   =================================================== */
.pagination {
    display: flex;
    gap: .3rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1.25rem;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 500;
    border: 1px solid var(--gray-300);
    background: var(--white);
    color: var(--gray-700);
    text-decoration: none;
    transition: background .15s;
}

.pagination a:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.pagination .disabled { opacity: .4; cursor: not-allowed; }

/* ===================================================
   BARRE DE RECHERCHE
   =================================================== */
.search-bar {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.search-bar .form-control { flex: 1; min-width: 180px; }

/* ===================================================
   FICHE CLIENT
   =================================================== */
.client-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.info-block { margin-bottom: .5rem; }
.info-label { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-400); }
.info-value { font-size: .95rem; color: var(--gray-800); margin-top: .1rem; }

/* ===================================================
   LOGIN PAGE
   =================================================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-700) 100%);
    padding: 1rem;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: .5rem;
}

.login-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: .25rem;
}

.login-subtitle {
    text-align: center;
    font-size: .85rem;
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

.remember-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .75rem;
    font-size: .875rem;
    color: var(--gray-600);
}

/* ===================================================
   CALENDRIER
   =================================================== */
.calendar-wrapper {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow);
}

/* ===================================================
   ANIMATION CLIGNOTANT (intervention en cours)
   =================================================== */
@keyframes blink-orange {
    0%, 100% { opacity: 1; }
    50%       { opacity: .3; }
}

.blink { animation: blink-orange 1.5s ease-in-out infinite; }

/* ===================================================
   RESPONSIVE — TABLETTE (≥ 640px)
   =================================================== */
@media (min-width: 640px) {
    .nav-toggle { display: none; }

    .main-nav {
        display: flex;
        flex-direction: row;
        align-items: center;
        position: static;
        border: none;
        padding: 0;
        background: transparent;
        gap: .25rem;
    }

    .stats-grid { grid-template-columns: repeat(4, 1fr); }

    .form-row { grid-template-columns: 1fr 1fr; }

    .client-info-grid { grid-template-columns: 1fr 1fr; }

    .photos-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

    .chrono-display { font-size: 3rem; }
}

/* ===================================================
   RESPONSIVE — DESKTOP (≥ 1024px)
   =================================================== */
@media (min-width: 1024px) {
    .main-content { padding: 2rem 1.5rem; }

    .form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

    .client-info-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ===================================================
   UTILITAIRES
   =================================================== */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--gray-500); font-size: .875rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex  { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none; }
.w-full { width: 100%; }
.font-bold { font-weight: 700; }

/* Séparateur */
hr.divider {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 1.25rem 0;
}

/* Colonne actions dans tableau */
.col-actions {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}
