/**
 * ConstructInfo — Cookie Consent Styles
 * 
 * Modal GDPR consent — overlay, box, toggle switches, responsive.
 * Design guidelines din §4.9.
 */

/* ========================================================================
   OVERLAY + BODY LOCK (§4.3)
   ======================================================================== */

/* ⚠️ FIX B-GA42: .ci-consent-active pe body blochează scroll */
body.ci-consent-active {
    overflow: hidden;
}

.ci-consent-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999999; /* §4.3 — deasupra hărții MapLibre */
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.ci-consent-overlay.ci-consent-active {
    display: flex;
}

/* ========================================================================
   MODAL BOX (§4.9)
   ======================================================================== */

.ci-consent-box {
    background: #fff;
    max-width: 540px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--ci-radius-lg, 12px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 24px;
    animation: ciConsentFadeIn 200ms ease-out;
}

@keyframes ciConsentFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================================================
   HEADER
   ======================================================================== */

.ci-consent-header {
    position: relative;
    margin-bottom: 20px;
}

#ci-consent-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--ci-gray-900, #111);
    line-height: 1.3;
}

.ci-consent-desc {
    font-size: 0.875rem;
    color: var(--ci-gray-600, #555);
    margin: 0;
    line-height: 1.5;
}

.ci-consent-lang-toggle {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--ci-gray-100, #f3f4f6);
    border: 1px solid var(--ci-gray-300, #d1d5db);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--ci-gray-700, #374151);
    transition: background 150ms;
}

.ci-consent-lang-toggle:hover {
    background: var(--ci-gray-200, #e5e7eb);
}

/* ========================================================================
   BUTOANE PRINCIPALE (§4.3)
   ======================================================================== */

.ci-consent-actions-primary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.ci-consent-box .ci-btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    text-align: center;
    transition: background 150ms, transform 100ms;
    line-height: 1.4;
}

.ci-consent-box .ci-btn:active {
    transform: scale(0.98);
}

.ci-consent-box .ci-btn--primary {
    background: var(--ci-red-700, #b91c1c);
    color: #fff;
}

.ci-consent-box .ci-btn--primary:hover {
    background: var(--ci-red-800, #991b1b);
}

.ci-consent-box .ci-btn--outline {
    background: #fff;
    color: var(--ci-gray-700, #374151);
    border: 2px solid var(--ci-gray-300, #d1d5db);
}

.ci-consent-box .ci-btn--outline:hover {
    background: var(--ci-gray-50, #f9fafb);
    border-color: var(--ci-gray-400, #9ca3af);
}

.ci-consent-box .ci-btn--text {
    background: transparent;
    color: var(--ci-gray-600, #555);
    padding: 8px 20px;
    font-size: 0.875rem;
}

.ci-consent-box .ci-btn--text:hover {
    color: var(--ci-gray-800, #1f2937);
    text-decoration: underline;
}

/* ========================================================================
   CATEGORII + TOGGLE SWITCHES (§4.9)
   ======================================================================== */

.ci-consent-details {
    border-top: 1px solid var(--ci-gray-200, #e5e7eb);
    padding-top: 16px;
    margin-bottom: 16px;
}

.ci-consent-category {
    padding: 12px 0;
    border-bottom: 1px solid var(--ci-gray-100, #f3f4f6);
}

.ci-consent-category:last-of-type {
    border-bottom: none;
}

.ci-consent-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.ci-consent-category-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--ci-gray-800, #1f2937);
}

.ci-consent-badge--required {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--ci-gray-500, #6b7280);
    background: var(--ci-gray-100, #f3f4f6);
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ci-consent-category-desc {
    font-size: 0.8125rem;
    color: var(--ci-gray-500, #6b7280);
    margin: 4px 0 6px 0;
    line-height: 1.4;
}

/* Toggle switch — 44px height conform branding touch targets (§4.9) */
.ci-consent-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.ci-consent-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--ci-gray-300, #d1d5db);
    border-radius: 24px;
    transition: background 200ms;
}

.ci-consent-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 200ms;
}

.ci-consent-toggle input:checked + .ci-consent-slider {
    background-color: var(--ci-red-700, #b91c1c);
}

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

.ci-consent-toggle input:disabled + .ci-consent-slider {
    background-color: var(--ci-gray-400, #9ca3af);
    cursor: not-allowed;
}

.ci-consent-toggle input:focus-visible + .ci-consent-slider {
    outline: 2px solid var(--ci-red-700, #b91c1c);
    outline-offset: 2px;
}

/* Cookie list (expandable) */
.ci-consent-cookie-list {
    margin-top: 6px;
}

.ci-consent-cookie-list summary {
    font-size: 0.75rem;
    color: var(--ci-gray-500, #6b7280);
    cursor: pointer;
    user-select: none;
}

.ci-consent-cookie-list summary:hover {
    color: var(--ci-gray-700, #374151);
}

.ci-consent-cookie-table {
    width: 100%;
    font-size: 0.75rem;
    border-collapse: collapse;
    margin-top: 6px;
}

.ci-consent-cookie-table td {
    padding: 4px 6px;
    border-bottom: 1px solid var(--ci-gray-100, #f3f4f6);
    color: var(--ci-gray-600, #555);
    vertical-align: top;
}

.ci-consent-cookie-table td:first-child {
    white-space: nowrap;
}

.ci-consent-cookie-table code {
    font-size: 0.6875rem;
    background: var(--ci-gray-100, #f3f4f6);
    padding: 1px 4px;
    border-radius: 3px;
}

/* Save button inside details */
.ci-consent-details .ci-consent-save {
    margin-top: 12px;
}

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

.ci-consent-footer {
    padding-top: 12px;
    border-top: 1px solid var(--ci-gray-200, #e5e7eb);
    text-align: center;
}

.ci-consent-footer a {
    font-size: 0.8125rem;
    color: var(--ci-gray-500, #6b7280);
    text-decoration: underline;
}

.ci-consent-footer a:hover {
    color: var(--ci-red-700, #b91c1c);
}

/* ========================================================================
   RESPONSIVE — Mobile first (§13.1, §4.9)
   Pe mobile (< 768px): full-width, butoane stacked, padding 16px
   ======================================================================== */

@media (min-width: 768px) {
    .ci-consent-actions-primary {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .ci-consent-box .ci-btn {
        width: auto;
        flex: 1 1 auto;
    }

    .ci-consent-box .ci-btn--text {
        flex: 0 0 auto;
        width: 100%;
    }
}

@media (max-width: 767px) {
    .ci-consent-box {
        padding: 16px;
        border-radius: 12px 12px 0 0;
        max-height: 85vh;
    }

    .ci-consent-overlay {
        align-items: flex-end;
        padding: 0;
    }

    #ci-consent-title {
        font-size: 1.125rem;
        padding-right: 50px;
    }
}
