/* --- Cookie Consent Styling --- */

    /* ===== Base popup (card layout - default) ===== */
    .cookie-consent-popup {
        position: fixed;
        bottom: 20px;
        right: 20px;
        background-color: var(--cookie-bg, #ffffff);
        color: var(--cookie-text, #333333);
        padding: 25px;
        border-radius: 8px;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
        z-index: 10000;
        max-width: 420px;
        line-height: 1.5;
        border: 1px solid #eee;
    }

    /* ===== Bar layout ===== */
    .cookie-consent-popup.cookie-layout-bar {
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
        border-radius: 0;
        padding: 14px 30px;
        border: none;
        border-top: 1px solid rgba(0,0,0,.1);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    }
    .cookie-layout-bar .cookie-popup-content {
        display: flex;
        align-items: center;
        gap: 20px;
        max-width: 1400px;
        margin: 0 auto;
        flex-wrap: wrap;
    }
    .cookie-layout-bar .cookie-popup-content h4 {
        display: none;
    }
    .cookie-layout-bar .cookie-popup-content p {
        margin: 0;
        flex: 1;
        min-width: 200px;
        font-size: .875rem;
    }
    .cookie-layout-bar .cookie-popup-actions {
        margin-bottom: 0;
        flex-shrink: 0;
    }
    .cookie-layout-bar .cookie-popup-links {
        width: 100%;
        text-align: center;
        margin-top: 4px;
    }

    /* ===== Modal layout ===== */
    .cookie-consent-popup.cookie-layout-modal {
        inset: 0;
        max-width: 100%;
        border-radius: 0;
        padding: 0;
        border: none;
        background: rgba(0, 0, 0, 0.5);
        box-shadow: none;
        align-items: center;
        justify-content: center;
    }
    .cookie-layout-modal .cookie-popup-content {
        background: var(--cookie-bg, #ffffff);
        color: var(--cookie-text, #333333);
        padding: 30px 35px;
        border-radius: 12px;
        max-width: 520px;
        width: 90%;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
        text-align: center;
    }
    .cookie-layout-modal .cookie-popup-actions {
        justify-content: center;
    }

    /* ===== Popup content ===== */
    .cookie-popup-content h4 {
        margin-top: 0;
        margin-bottom: 10px;
        font-size: 1.1rem;
        font-weight: 600;
    }

    .cookie-popup-content p {
        margin-bottom: 20px;
    }

    .cookie-popup-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 15px;
    }

    .cookie-btn {
        padding: 10px 18px;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        font-size: 0.875rem;
        font-weight: 500;
        transition: background-color 0.2s ease, color 0.2s ease, opacity .2s;
        text-decoration: none;
        display: inline-block;
        text-align: center;
    }
    .cookie-btn:hover { opacity: .88; }

    .cookie-btn-accept {
        background-color: var(--cookie-btn-accept, #4CAF50);
        color: white;
    }

    .cookie-btn-reject {
        background-color: var(--cookie-btn-reject, #f44336);
        color: white;
    }

    .cookie-btn-manage {
        background-color: #e0e0e0;
        color: #333;
        border: 1px solid #ccc;
    }
    .cookie-btn-manage:hover {
        background-color: #d5d5d5;
    }

    .cookie-popup-links {
        font-size: 0.8rem;
    }
    .cookie-popup-links a {
        color: var(--cookie-text, #555);
        text-decoration: underline;
        margin-right: 15px;
        opacity: .7;
    }
    .cookie-popup-links a:hover {
        opacity: 1;
    }

    /* ===== Preferences Modal ===== */
    .cookie-preferences-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.6);
        z-index: 10001;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
        overflow-y: auto;
    }

    .cookie-preferences-modal .modal-content {
        background-color: #ffffff;
        color: #333;
        padding: 30px;
        border-radius: 8px;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
        max-width: 650px;
        width: 100%;
        position: relative;
        max-height: 90vh;
        display: flex;
        flex-direction: column;
    }

    .cookie-preferences-modal .modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #eee;
        padding-bottom: 15px;
        margin-bottom: 20px;
    }

    .cookie-preferences-modal .modal-header h3 {
        margin: 0;
        font-size: 1.4rem;
        font-weight: 600;
    }

    .cookie-preferences-modal .modal-close-btn {
        background: none;
        border: none;
        font-size: 2rem;
        font-weight: bold;
        color: #888;
        cursor: pointer;
        line-height: 1;
        padding: 0 5px;
    }
    .modal-close-btn:hover {
        color: #333;
    }

    .cookie-preferences-modal .modal-body {
        margin-bottom: 20px;
        overflow-y: auto;
        flex-grow: 1;
    }
    .cookie-preferences-modal .modal-body > p {
        margin-bottom: 25px;
        font-size: 0.95rem;
    }

    .cookie-category {
        margin-bottom: 20px;
        padding: 15px;
        border: 1px solid #e0e0e0;
        border-radius: 5px;
        background-color: #f9f9f9;
    }

    .cookie-category .category-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
    }

    .cookie-category h4 {
        margin: 0;
        font-size: 1.1rem;
        font-weight: 500;
    }

    .cookie-category p {
        color: #555;
        margin-bottom: 0;
    }

    /* Toggle Switch Styling */
    .switch {
        position: relative;
        display: inline-block;
        width: 50px;
        height: 24px;
        flex-shrink: 0;
    }
    .switch input { opacity: 0; width: 0; height: 0; }
    .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
    .slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; }
    input:checked + .slider { background-color: #4CAF50; }
    input:focus + .slider { box-shadow: 0 0 1px #4CAF50; }
    input:checked + .slider:before { transform: translateX(26px); }
    .slider.round { border-radius: 24px; }
    .slider.round:before { border-radius: 50%; }
    .switch.always-on input:disabled + .slider { background-color: #8fcc91; cursor: not-allowed; }
    .switch.always-on input:disabled + .slider:before { background-color: #e0e0e0; }

    /* Cookie Details Table */
    .cookie-details {
        margin-top: 15px;
        padding-top: 10px;
        border-top: 1px dashed #ddd;
    }
    .cookie-details h5 {
        margin-bottom: 8px;
        color: #666;
        font-weight: 500;
    }
    .cookie-details table {
        width: 100%;
        border-collapse: collapse;
    }
    .cookie-details th, .cookie-details td {
        border: 1px solid #eee;
        padding: 6px 10px;
        text-align: left;
        vertical-align: top;
    }
    .cookie-details th {
        background-color: #f5f5f5;
        font-weight: 500;
    }

    .cookie-preferences-modal .modal-footer {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 10px;
        border-top: 1px solid #eee;
        padding-top: 20px;
        margin-top: auto;
        flex-shrink: 0;
    }

    /* ===== Font inheritance ===== */
    .cookie-consent-popup,
    .cookie-preferences-modal {
        font-family: inherit;
        font-size: 0.9rem;
    }

    .cookie-consent-popup *,
    .cookie-preferences-modal *,
    .cookie-consent-popup button,
    .cookie-preferences-modal button,
    .cookie-preferences-modal input,
    .cookie-preferences-modal label,
    .cookie-preferences-modal th,
    .cookie-preferences-modal td {
        font-family: inherit;
        box-sizing: border-box;
    }

    .cookie-category p {
        font-size: 0.875rem;
    }

    .cookie-details h5 {
         font-size: 0.9rem;
    }

    .cookie-details table,
    .cookie-details th,
    .cookie-details td {
        font-size: 0.85rem;
    }

    /* ===== Responsive ===== */
    @media (max-width: 768px) {
        /* Card layout mobile */
        .cookie-consent-popup.cookie-layout-card {
            max-width: 90%;
            right: 5%;
            left: 5%;
            bottom: 10px;
            font-size: 0.85rem;
        }

        /* Bar layout mobile */
        .cookie-consent-popup.cookie-layout-bar {
            padding: 12px 16px;
        }
        .cookie-layout-bar .cookie-popup-content {
            flex-direction: column;
            text-align: center;
            gap: 10px;
        }
        .cookie-layout-bar .cookie-popup-actions {
            flex-direction: column;
            align-items: stretch;
            width: 100%;
        }

        /* Modal layout mobile */
        .cookie-layout-modal .cookie-popup-content {
            padding: 24px 20px;
            width: 95%;
        }

        .cookie-consent-popup .cookie-btn {
            font-size: 0.8rem;
            padding: 8px 15px;
        }

        /* Card default: stack buttons */
        .cookie-layout-card .cookie-popup-actions {
            flex-direction: column;
            align-items: stretch;
        }

        .cookie-preferences-modal .modal-content {
            max-width: 95%;
            padding: 20px;
        }
         .cookie-preferences-modal .modal-header h3 {
            font-size: 1.2rem;
         }
         .cookie-preferences-modal .modal-body > p {
            font-size: 0.9rem;
         }
         .cookie-category h4 {
            font-size: 1rem;
         }
         .cookie-category p {
            font-size: 0.825rem;
         }
         .cookie-details h5 {
             font-size: 0.85rem;
         }
         .cookie-details table,
         .cookie-details th,
         .cookie-details td {
             font-size: 0.8rem;
             padding: 5px 8px;
         }

        .cookie-preferences-modal .modal-footer {
            justify-content: space-between;
        }
         .cookie-preferences-modal .modal-footer .cookie-btn {
            flex-grow: 1;
            min-width: 100px;
            font-size: 0.8rem;
            padding: 8px 10px;
         }
    }
