/* ============================================================
   RGPD COOKIE BANNER — Albañil en Granada
   Normativa: RGPD (UE) 2016/679 + LOPDGDD 3/2018 + LSSICE
   ============================================================ */

/* ---- Banner overlay ---- */
#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #1a1a2e;
    color: #e8e8f0;
    font-family: 'Inter', 'Outfit', system-ui, sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.35);
    border-top: 3px solid #c0392b;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

#cookie-banner.visible {
    transform: translateY(0);
}

#cookie-banner.hiding {
    transform: translateY(110%);
}

/* ---- Banner inner layout ---- */
.cookie-banner-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}

.cookie-banner-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.cookie-banner-text {
    flex: 1;
    min-width: 260px;
}

.cookie-banner-text h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 6px;
    letter-spacing: 0.01em;
}

.cookie-banner-text p {
    margin: 0;
    color: #b0b0c0;
    font-size: 0.85rem;
}

.cookie-banner-text a {
    color: #e57368;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cookie-banner-text a:hover {
    color: #ff8a80;
}

/* ---- Cookie categories (panel avanzado) ---- */
.cookie-categories {
    display: none;
    flex: 1 1 100%;
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 16px;
    gap: 16px;
    flex-wrap: wrap;
}

.cookie-categories.expanded {
    display: flex;
}

.cookie-category {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 14px 16px;
    flex: 1 1 220px;
    min-width: 200px;
}

.cookie-category-info {
    flex: 1;
}

.cookie-category-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    display: block;
    margin-bottom: 4px;
}

.cookie-category-desc {
    font-size: 0.78rem;
    color: #909090;
    line-height: 1.5;
}

/* Toggle switch */
.cookie-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cookie-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #444;
    border-radius: 24px;
    transition: background 0.25s;
}

.cookie-toggle-slider:before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.25s;
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    background: #c0392b;
}

.cookie-toggle input:checked + .cookie-toggle-slider:before {
    transform: translateX(20px);
}

.cookie-toggle input:disabled + .cookie-toggle-slider {
    background: #c0392b;
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---- Action buttons ---- */
.cookie-banner-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
    padding-top: 4px;
}

.cookie-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
    letter-spacing: 0.02em;
}

.cookie-btn-accept {
    background: #c0392b;
    color: white;
    border-color: #c0392b;
}

.cookie-btn-accept:hover {
    background: #a93226;
    border-color: #a93226;
    transform: translateY(-1px);
}

.cookie-btn-reject {
    background: transparent;
    color: #b0b0c0;
    border-color: rgba(255, 255, 255, 0.2);
}

.cookie-btn-reject:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.cookie-btn-configure {
    background: transparent;
    color: #b0b0c0;
    border: none;
    padding: 10px 8px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    font-family: inherit;
}

.cookie-btn-configure:hover {
    color: #ffffff;
}

/* ---- Floating settings button (siempre visible) ---- */
#cookie-settings-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 99998;
    background: #1a1a2e;
    border: 2px solid #c0392b;
    color: #ffffff;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: none; /* shown after banner dismissed */
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

#cookie-settings-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(192, 57, 43, 0.4);
}

#cookie-settings-btn.visible {
    display: flex;
}

/* ---- RGPD Checkbox en formularios ---- */
.gdpr-consent-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 16px 0 20px;
    padding: 14px 16px;
    background: #fff8f7;
    border: 1px solid rgba(192, 57, 43, 0.2);
    border-radius: 8px;
}

.gdpr-consent-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin-top: 2px;
    accent-color: #c0392b;
    cursor: pointer;
}

.gdpr-consent-group label {
    font-size: 0.82rem;
    color: #555;
    line-height: 1.55;
    cursor: pointer;
    font-weight: 400 !important;
    margin-bottom: 0 !important;
}

.gdpr-consent-group label a {
    color: #c0392b;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
}

.gdpr-consent-group label a:hover {
    color: #a93226;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .cookie-banner-inner {
        padding: 16px;
        gap: 16px;
    }

    .cookie-banner-actions {
        width: 100%;
        flex-direction: column;
    }

    .cookie-btn {
        width: 100%;
        text-align: center;
    }

    .cookie-banner-icon {
        display: none;
    }

    .cookie-category {
        flex: 1 1 100%;
    }
}
