:root {
    --primary-color: #B31B1B;
    --secondary-color: #EAEAEA;
    --background-dark: #0F0F0F;
    --background-light: #1A1A1A;
    --text-muted: #888888;
    --success-color: #00a676;
}

* {
    box-sizing: border-box;
}

/* ---------------------------------------------------- */
/* GLOBAL & LAYOUT */
/* ---------------------------------------------------- */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-dark);
    color: var(--secondary-color);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.header {
    background-color: var(--primary-color);
    color: var(--background-dark);
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    text-align: center;
}

h1 {
    color: var(--background-dark);
}

.main-content {
    display: flex;
    max-width: 1600px;
    margin: 30px auto;
    gap: 30px;
    padding: 0 20px;
}

/* ---------------------------------------------------- */
/* CONFIGURATION SECTIONS */
/* ---------------------------------------------------- */
#config-sections {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.category-title {
    color: var(--secondary-color);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 5px;
    margin-bottom: 20px;
    display: block;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 12px 48px 12px 12px;
    border-radius: 6px;
    transition: background-color 180ms ease, color 180ms ease;
}

/* Style the wrapping details so the summary looks like the previous H2/title */
details.category-section {
    margin-bottom: 12px;
}

/* Remove default triangle marker for summary to keep a clean look */
.category-title::-webkit-details-marker {
    display: none;
}
.category-title::marker {
    content: none;
}

/* Add a chevron icon to the summary via a pseudo-element */
.category-title {
    position: relative;
    padding-right: 36px;
}

.category-title::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--secondary-color);
    border-bottom: 2px solid var(--secondary-color);
    transform: translateY(-50%) rotate(-45deg);
    transition: transform 180ms ease, border-color 180ms ease;
    pointer-events: none;
}

details[open] .category-title::after {
    transform: translateY(-50%) rotate(45deg);
}

details.category-section summary.category-title::before {
    content: "Click to expand";
    position: absolute;
    right: 34px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.78rem;
    color: var(--text-muted);
    pointer-events: none;
}

details[open].category-section summary.category-title::before {
    content: "Click to collapse";
    color: var(--primary-color);
}

details.category-section summary.category-title:hover,
details.category-section summary.category-title:focus {
    background-color: rgba(179,27,27,0.06);
    border-bottom-color: rgba(179,27,27,0.85);
}

details.category-section summary.category-title:focus {
    outline: 3px solid rgba(179,27,27,0.12);
    outline-offset: 2px;
}

details[open] .category-title::after {
    border-color: var(--primary-color);
    transform: translateY(-50%) rotate(45deg);
}

details.category-section summary.category-title {
    display: block;
    padding: 12px 12px 12px 0;
    margin: 0 0 12px 0;
}

details.category-section summary::-webkit-details-marker { display: none; }

.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.item-card {
    background-color: var(--background-light);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.item-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    border-color: var(--primary-color);
}

.item-card:focus {
    outline: 3px solid rgba(179,27,27,0.18);
    outline-offset: 2px;
}

.item-card.selected {
    border: 3px solid var(--primary-color);
    box-shadow: 0 0 8px rgba(179, 27, 27, 0.6);
    background-color: #252525;
}

.item-card.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
    border-color: #333;
    box-shadow: none;
    transform: none;
}

.card-name {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--secondary-color);
}

.card-price {
    color: var(--primary-color);
    font-size: 1.3em;
    margin-top: 10px;
    font-weight: 700;
}

.card-image-container {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    image-rendering: -webkit-optimize-contrast;
}

/* ---------------------------------------------------- */
/* WELCOME MODAL */
/* ---------------------------------------------------- */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.visible {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background-color: var(--background-light);
    color: var(--secondary-color);
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease-out;
    border: 1px solid var(--primary-color);
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

.modal-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
}

.modal-content h2 {
    color: var(--primary-color);
    margin-top: 0;
    border-bottom: 2px solid #333;
    padding-bottom: 10px;
}

.modal-content .disclaimer {
    margin: 20px 0;
    padding: 15px;
    background-color: #222;
    border-left: 5px solid var(--primary-color);
    text-align: left;
}

.modal-content ul {
    list-style: disc;
    padding-left: 20px;
}

.modal-content li {
    margin-bottom: 5px;
    font-size: 0.9em;
    color: var(--text-muted);
}

#close-modal-btn {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    margin-top: 20px;
    transition: background-color 0.2s;
    width: 100%;
}

#close-modal-btn:hover {
    background-color: #e33030;
}

/* ---------------------------------------------------- */
/* SUMMARY PANEL (ASIDE) - STICKY FOR DESKTOP */
/* ---------------------------------------------------- */
#summary-panel {
    position: sticky;
    top: 20px;
    width: 300px;
    min-width: 300px;
    background-color: var(--background-light);
    color: var(--secondary-color);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    height: fit-content;
    border: 1px solid #333;
}

#selection-details p {
    margin: 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px dotted #444;
}

#selection-details strong {
    color: var(--primary-color);
}

.accessory-item-summary {
    font-size: 0.9em;
    font-style: italic;
    margin: 5px 0;
    padding: 0;
    border: none !important;
    color: var(--text-muted);
}

.total-price-box {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #333;
    text-align: right;
}

.total-price {
    font-size: 2em;
    font-weight: bold;
    color: var(--success-color);
}

#summary-panel button {
    width: 100%;
    padding: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    margin-top: 15px;
    transition: background-color 0.2s;
}

#summary-panel button:hover {
    background-color: #e33030;
}

.card-link {
    display: inline-block;
    background-color: var(--primary-color);
    color: white !important;
    text-decoration: none;
    font-size: 0.8em;
    font-weight: 600;
    padding: 6px 10px;
    margin-top: 10px;
    border-radius: 4px;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.card-link:hover {
    background-color: #e33030;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.card-link:active {
    background-color: #991616;
    transform: translateY(0);
}

/* ---------------------------------------------------- */
/* SEARCH BAR */
/* ---------------------------------------------------- */

#search-bar-container {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--background-light);
    padding: 15px 20px 15px 20px;
    border-bottom: 1px solid #333;
    margin-bottom: 20px;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

#product-search {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #555;
    border-radius: 6px;
    background-color: var(--background-light);
    color: var(--secondary-color);
    font-size: 1.1em;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#product-search:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(179, 27, 27, 0.5);
    outline: none;
}

/* ---------------------------------------------------- */
/* FOOTER */
/* ---------------------------------------------------- */
.site-footer {
    background: linear-gradient(180deg, #0b0b0b 0%, #111111 100%);
    border-top: 1px solid #222;
    color: var(--secondary-color);
    padding: 26px 20px;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.footer-brand h3 {
    margin: 0 0 6px 0;
    color: var(--secondary-color);
    font-size: 1.25rem;
}

.footer-tagline {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

.footer-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.15s, transform 0.12s;
    background: transparent;
}

.footer-link:hover {
    background: rgba(179, 27, 27, 0.12);
    transform: translateY(-2px);
}

.footer-legal {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.socials {
    display: flex;
    gap: 8px;
}

.social-link {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: transform 0.12s, box-shadow 0.12s;
}

.social-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(179, 27, 27, 0.18);
}

.copyright {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ---------------------------------------------------- */
/* RESPONSIVE DESIGN  */
/* ---------------------------------------------------- */
@media (max-width: 1200px) {
    .card-container {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 18px;
    }

    .item-card {
        padding: 12px;
    }

    .card-image-container {
        width: 72px;
        height: 72px;
    }
}

@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
        gap: 18px;
        margin: 18px auto;
        padding: 0;
    }

    #summary-panel {
        position: static;
        order: -1;
        width: calc(100% - 20px);
        min-width: unset;
        margin: 0 10px;
        padding: 14px;
        border-radius: 8px;
    }

    #config-sections {
        padding: 0 10px 20px 10px;
    }

    .item-card {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .card-image-container {
        width: 100%;
        height: 160px;
        border-radius: 6px;
        background-color: #fff;
        display: block;
        padding: 8px;
    }

    .item-image {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center;
        display: block;
        max-width: 100%;
        max-height: 100%;
        background-color: transparent;
    }

    .card-text-content {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .card-price {
        margin-top: 0;
        font-size: 1.1em;
    }

    .card-container {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 14px;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .footer-legal {
        align-items: flex-start;
        text-align: left;
    }

    #search-bar-container {
        padding: 12px 10px;
        position: sticky;
        top: env(safe-area-inset-top, 0);
        z-index: 20;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .card-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .card-image-container {
        height: 140px;
        padding: 8px;
        background-color: #fff;
    }

    .modal-content {
        padding: 18px;
        width: 94%;
        max-width: 420px;
    }

    #summary-panel {
        width: calc(100% - 20px);
        padding: 12px;
    }
}