/* CAG Equip - Design CSS selon document PDF */

:root {
    --color-dark: #1a2d3e;
    --color-medium: #5f7f99;
    --color-light: #dbe5ec;
    --color-white: #ffffff;
    --color-border: #e0e0e0;
    --font-primary: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --spacing: 1rem;
}

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

html, body {
    font-family: var(--font-primary);
    font-size: 12pt;
    color: var(--color-dark);
    background-color: var(--color-white);
    line-height: 1.6;
}

/* ========== HEADER & NAVIGATION ========== */

.topbar {
    background-color: var(--color-light);
    padding: 0.5rem 0;
    font-size: 11pt;
    border-bottom: 1px solid var(--color-border);
}

.topbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.topbar span {
    color: var(--color-medium);
}

.site-header {
    background-color: var(--color-white);
    border-bottom: 2px solid var(--color-dark);
    padding: 1.5rem 0;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-size: 24pt;
    font-weight: bold;
    color: var(--color-dark);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand span {
    font-size: 10pt;
    font-weight: normal;
    color: var(--color-medium);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav a {
    color: var(--color-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 12pt;
    transition: color 0.3s;
}

.nav a:hover {
    color: var(--color-medium);
}

.nav .btn-admin {
    background-color: var(--color-medium);
    color: var(--color-white);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 11pt;
}

.nav .btn-admin:hover {
    background-color: var(--color-dark);
}

/* ========== CONTAINER & LAYOUT ========== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

main {
    min-height: calc(100vh - 300px);
    padding: 2rem 0;
}

/* ========== CAROUSEL / SLIDER ========== */

.carousel {
    width: 100%;
    height: 260px;
    background-color: var(--color-light);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.carousel img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.carousel img.active {
    display: block;
}

/* ========== GRID LAYOUTS ========== */

.grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Level 1: 3 colonnes max */
.grid-level1 {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    grid-auto-rows: auto;
}

/* Level 2 & 3: 4 colonnes max */
.grid-level2,
.grid-level3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Level 4: Options */
.grid-options {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ========== CARDS ========== */

.card {
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow 0.3s, transform 0.3s;
    cursor: pointer;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.card img {
    width: 100%;
    height: auto;
    display: block;
}

.card-body {
    padding: 1rem;
}

.card-body h3 {
    font-size: 14pt;
    font-weight: bold;
    color: var(--color-dark);
    margin-bottom: 0.5rem;
}

.card-body p {
    font-size: 12pt;
    color: var(--color-medium);
    margin-bottom: 0.5rem;
}

.card-body .price {
    font-size: 13pt;
    font-weight: bold;
    color: var(--color-dark);
}

/* ========== BUTTONS ========== */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--color-medium);
    color: var(--color-white);
    text-decoration: none;
    border: none;
    border-radius: 4px;
    font-size: 12pt;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
    text-align: center;
}

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

.btn.secondary {
    background-color: var(--color-light);
    color: var(--color-dark);
    border: 1px solid var(--color-border);
}

.btn.secondary:hover {
    background-color: var(--color-border);
}

.btn.danger {
    background-color: #d32f2f;
}

.btn.danger:hover {
    background-color: #b71c1c;
}

/* ========== PRODUCT DETAIL PAGE ========== */

.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.product-image {
    width: 100%;
    max-width: 500px;
    height: 500px;
    background-color: var(--color-light);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-info h1 {
    font-size: 18pt;
    font-weight: bold;
    color: var(--color-dark);
    margin-bottom: 0.5rem;
}

.product-info .model {
    font-size: 13pt;
    color: var(--color-medium);
    margin-bottom: 1rem;
}

.product-info .price {
    font-size: 16pt;
    font-weight: bold;
    color: var(--color-dark);
    margin-bottom: 1rem;
}

.product-info .description {
    font-size: 12pt;
    color: var(--color-dark);
    margin-bottom: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
}

/* ========== GALLERY ========== */

.gallery {
    margin-bottom: 2rem;
}

.gallery h3 {
    font-size: 14pt;
    font-weight: bold;
    color: var(--color-dark);
    margin-bottom: 1rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    max-height: 600px;
    overflow-y: auto;
}

.gallery-item {
    width: 150px;
    height: 150px;
    background-color: var(--color-light);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s;
}

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

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========== DOCUMENTS / PRICE LIST ========== */

.documents {
    margin-bottom: 2rem;
}

.documents h3 {
    font-size: 14pt;
    font-weight: bold;
    color: var(--color-dark);
    margin-bottom: 1rem;
}

.documents-list {
    max-height: 400px;
    overflow-y: auto;
}

.document-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

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

.document-item a {
    color: var(--color-medium);
    text-decoration: none;
    font-size: 12pt;
}

.document-item a:hover {
    text-decoration: underline;
    color: var(--color-dark);
}

/* ========== OPTIONS TABLE ========== */

.options-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}

.options-table thead {
    background-color: var(--color-light);
}

.options-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: bold;
    color: var(--color-dark);
    font-size: 12pt;
    border-bottom: 2px solid var(--color-border);
}

.options-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 12pt;
}

.options-table tbody tr:hover {
    background-color: var(--color-light);
}

.option-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

/* ========== FORMS ========== */

.form-card {
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.field label {
    font-size: 12pt;
    font-weight: 500;
    color: var(--color-dark);
    margin-bottom: 0.5rem;
}

.field input,
.field select,
.field textarea {
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: var(--font-primary);
    font-size: 12pt;
    color: var(--color-dark);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--color-medium);
    box-shadow: 0 0 0 3px rgba(95, 127, 153, 0.1);
}

.field textarea {
    resize: vertical;
    min-height: 120px;
}

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

.flash {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    font-size: 12pt;
}

.flash.success {
    background-color: #c8e6c9;
    color: #2e7d32;
    border-left: 4px solid #2e7d32;
}

.flash.error {
    background-color: #ffcdd2;
    color: #c62828;
    border-left: 4px solid #c62828;
}

/* ========== ADMIN LAYOUT ========== */

.admin-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 0;
    min-height: calc(100vh - 200px);
}

.admin-sidebar {
    background-color: var(--color-dark);
    color: var(--color-white);
    padding: 1.5rem;
    border-right: 1px solid var(--color-border);
}

.admin-sidebar h2 {
    font-size: 16pt;
    margin-bottom: 0.5rem;
}

.admin-sidebar p {
    font-size: 11pt;
    color: var(--color-light);
    margin-bottom: 1.5rem;
}

.admin-sidebar a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--color-light);
    text-decoration: none;
    font-size: 12pt;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.admin-sidebar a:hover {
    background-color: var(--color-medium);
}

.admin-main {
    padding: 1.5rem;
    background-color: #f5f5f5;
}

.admin-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    background-color: var(--color-white);
    padding: 1rem;
    border-radius: 4px;
}

.admin-top h1 {
    font-size: 18pt;
    color: var(--color-dark);
}

.admin-top .meta {
    font-size: 11pt;
    color: var(--color-medium);
}

/* ========== TABLES ========== */

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    overflow: hidden;
}

.table thead {
    background-color: var(--color-light);
}

.table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: bold;
    color: var(--color-dark);
    font-size: 12pt;
    border-bottom: 2px solid var(--color-border);
}

.table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 12pt;
}

.table tbody tr:hover {
    background-color: var(--color-light);
}

/* ========== FOOTER ========== */

footer {
    background-color: var(--color-dark);
    color: var(--color-light);
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
    font-size: 11pt;
}

footer a {
    color: var(--color-light);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

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

@media (max-width: 768px) {
    .site-header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .nav a {
        width: 100%;
        padding: 0.5rem;
        text-align: center;
    }

    .product-detail {
        grid-template-columns: 1fr;
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        display: flex;
        gap: 1rem;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }

    .admin-sidebar a {
        margin-bottom: 0;
    }

    .grid-level1 {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .grid-level2,
    .grid-level3 {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .carousel {
        height: 180px;
    }

    .grid-level1 {
        grid-template-columns: 1fr;
    }

    .grid-level2,
    .grid-level3 {
        grid-template-columns: repeat(2, 1fr);
    }

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