/**
 * Styles principaux du site Oldtimer Inventory
 * Layout en 3 zones : header, sidebar, content
 */

/* ========================================================================
   RESET ET BASE
   ======================================================================== */

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

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--c-text);
    background-color: var(--c-bg);
}

/* ========================================================================
   LAYOUT PRINCIPAL - 3 ZONES
   ======================================================================== */

html, body {
    height: 100%;
}

/* Classe pour activer le mode "scroll indépendant" sur les pages avec sidebar */
body.fixed-layout {
    overflow: hidden;
}

body.fixed-layout .site-container {
    height: 100vh;
}

.site-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Minimum hauteur de la fenêtre */
}

/* Zone header (bandeau supérieur) */
.site-header {
    flex-shrink: 0; /* Ne rétrécit jamais */
    background: var(--c-dark);
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

/* Zone contenu (sidebar + main content) */
.site-body {
    display: flex;
    flex: 1; /* Prend tout l'espace disponible entre header et footer */
    overflow: hidden; /* Empêche le scroll du conteneur parent */
    min-height: 0; /* Important pour le fonctionnement du flex */
}

/* Sidebar (arborescence véhicules) */
.site-sidebar {
    width: 300px;
    background: #fff;
    border-right: 1px solid #ddd;
    overflow-y: auto; /* Scroll vertical indépendant */
    overflow-x: hidden; /* Pas de scroll horizontal */
    flex-shrink: 0; /* Ne rétrécit jamais */
}

/* Contenu principal */
.site-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto; /* Scroll vertical indépendant */
    overflow-x: hidden; /* Pas de scroll horizontal */
}

/* Footer */
.site-footer {
    flex-shrink: 0; /* Ne rétrécit jamais */
    background: var(--c-dark);
    color: white;
    padding: 8px 20px;
    text-align: center;
    font-size: 0.85rem;
}

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

.site-footer .footer-content p {
    margin: 0;
}

/* ========================================================================
   TYPOGRAPHIE
   ======================================================================== */

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: var(--c-primary);
    text-decoration: none;
    transition: color 0.3s;
}

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

/* ========================================================================
   MESSAGES FLASH
   ======================================================================== */

.flash-message {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-weight: 500;
}

.flash-success {
    background: var(--c-ok-bg);
    color: var(--c-ok-fg);
    border: 1px solid #c3e6cb;
}

.flash-error {
    background: var(--c-err-bg);
    color: var(--c-danger);
    border: 1px solid #f5c6cb;
}

.flash-info {
    background: var(--c-inf-bg);
    color: var(--c-inf-fg);
    border: 1px solid #bee5eb;
}

.flash-warning {
    background: var(--c-wrn-bg);
    color: var(--c-wrn-fg);
    border: 1px solid #ffeaa7;
}

/* ========================================================================
   BOUTONS
   ======================================================================== */

.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary,
a.btn-primary {
    background: var(--c-primary);
    color: white !important;
}

.btn-primary:hover,
a.btn-primary:hover {
    background: var(--c-primary-d);
    color: white !important;
    text-decoration: none;
}

.btn-success,
a.btn-success {
    background: var(--c-primary);
    color: white !important;
}

.btn-success:hover,
a.btn-success:hover {
    background: var(--c-primary-d);
    color: white !important;
    text-decoration: none;
}

/* Boutons de la sidebar : garder le style vert */
.sidebar-btn-create,
a.sidebar-btn-create {
    background: var(--c-success) !important;
    color: white !important;
}

.sidebar-btn-create:hover,
a.sidebar-btn-create:hover {
    background: var(--c-success-d) !important;
    color: white !important;
    text-decoration: none;
}

.btn-danger,
a.btn-danger {
    background: var(--c-danger);
    color: white !important;
}

.btn-danger:hover,
a.btn-danger:hover {
    background: var(--c-danger-d);
    color: white !important;
    text-decoration: none;
}

.btn-secondary,
a.btn-secondary {
    background: var(--c-secondary);
    color: white !important;
}

.btn-secondary:hover,
a.btn-secondary:hover {
    background: var(--c-meta);
    color: white !important;
    text-decoration: none;
}

.btn-warning,
a.btn-warning {
    background: var(--c-warning);
    color: white !important;
}

.btn-warning:hover,
a.btn-warning:hover {
    background: var(--c-warning-d);
    color: white !important;
    text-decoration: none;
}

.btn-map,
a.btn-map {
    background: var(--c-grad);
    color: white !important;
    font-size: 1.1rem;
    padding: 12px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transition: all 0.3s;
}

.btn-map:hover,
a.btn-map:hover {
    background: var(--c-grad-d);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    color: white !important;
    text-decoration: none;
}

/* ========================================================================
   FORMULAIRES
   ======================================================================== */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--c-label);
}

.form-control {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

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

select.form-control {
    cursor: pointer;
}

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

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 0.875rem;
    color: var(--c-muted);
}

/* ========================================================================
   CARTES (CARDS)
   ======================================================================== */

.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--c-dark);
}

.card-subtitle {
    font-size: 1rem;
    color: var(--c-muted);
    margin-bottom: 15px;
}

.card-content {
    margin-bottom: 15px;
}

.card-footer {
    border-top: 1px solid #eee;
    padding-top: 15px;
    margin-top: 15px;
}

/* ========================================================================
   GRILLE
   ======================================================================== */

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col {
    padding: 0 15px;
}

.col-1 { flex: 0 0 8.333%; max-width: 8.333%; }
.col-2 { flex: 0 0 16.666%; max-width: 16.666%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-8 { flex: 0 0 66.666%; max-width: 66.666%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

/* ========================================================================
   UTILITAIRES
   ======================================================================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* ========================================================================
   PAGINATION
   ======================================================================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 30px 0;
    padding: 20px 0;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: white;
    color: var(--c-dark);
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pagination-btn:hover:not(.disabled):not(.pagination-active) {
    background: var(--c-primary);
    color: white;
    border-color: var(--c-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
    text-decoration: none;
}

.pagination-btn.pagination-active {
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-d) 100%);
    color: white;
    border-color: var(--c-primary-d);
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.4);
    cursor: default;
}

.pagination-btn.disabled {
    background: var(--c-bg);
    color: var(--c-faint);
    border-color: #e0e0e0;
    cursor: not-allowed;
    opacity: 0.6;
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    color: var(--c-meta);
    font-weight: 700;
}

.pagination-prev,
.pagination-next {
    font-weight: 600;
    padding: 0 12px;
}

/* ========================================================================
   RESPONSIVE
   ======================================================================== */

@media (max-width: 768px) {
    .site-body {
        flex-direction: column;
    }

    .site-sidebar {
        width: 100%;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    .site-content {
        padding: 15px;
    }

    [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ========================================================================
   FOOTER - LIENS LÉGAUX
   ======================================================================== */

.footer-legal-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 8px 0;
}

.footer-legal-links a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.footer-legal-links a:hover {
    color: white;
    text-decoration: underline;
}

.footer-sep {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
}

.footer-version {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 4px;
}

/* ========================================================================
   PAGES LÉGALES
   ======================================================================== */

.legal-page h1 {
    color: var(--c-dark);
    margin-bottom: 5px;
}

.legal-update {
    color: var(--c-meta);
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.legal-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}

.legal-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.legal-section h2 {
    color: var(--c-dark);
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.legal-section p,
.legal-section li {
    color: var(--c-label);
    line-height: 1.7;
}

.legal-section ul {
    padding-left: 20px;
    margin: 10px 0;
}

.legal-section a {
    color: var(--c-primary);
}

.legal-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 0.9rem;
}

.legal-table th {
    background: var(--c-dark);
    color: white;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
}

.legal-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    color: var(--c-label);
    vertical-align: top;
}

.legal-table tbody tr:nth-child(even) {
    background: var(--c-bg-neutral);
}

.contact-form .form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}
