/* ==========================================================================
   RokkuWare GDPR & ePrivacy Cookie Consent Styling
   Lightweight, accessible, zero-dependency, and mobile-optimized
   ========================================================================== */

/* --- Layer 1: Floating Bottom Banner --- */
.cookie-banner {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    max-width: 440px;
    width: calc(100% - 3rem);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 16px;
    box-shadow: 0 16px 40px -8px rgba(15, 23, 42, 0.18), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
    padding: 1.35rem 1.5rem;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1e293b;
}

.cookie-banner.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.cookie-banner-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.cookie-banner-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.cookie-banner-text {
    font-size: 0.875rem;
    line-height: 1.55;
    color: #475569;
    margin: 0 0 1rem 0;
}

.cookie-banner-text a,
.cookie-modal-text a {
    color: var(--primary, #0e8088);
    text-decoration: underline;
    font-weight: 600;
}

.cookie-banner-text a:hover,
.cookie-modal-text a:hover {
    color: #09595f;
}

.cookie-banner-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.cookie-btn-primary {
    flex: 1 1 auto;
    background: var(--primary, #0e8088);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 0.65rem 1.1rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s ease, transform 0.1s ease;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cookie-btn-primary:hover {
    background: #0b666c;
}

.cookie-btn-primary:active {
    transform: scale(0.98);
}

.cookie-btn-secondary {
    flex: 1 1 auto;
    background: #ffffff;
    color: #334155;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    padding: 0.65rem 1.1rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cookie-btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

.cookie-btn-secondary:active {
    transform: scale(0.98);
}

.cookie-btn-customize {
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 0.4rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.15s ease;
    width: 100%;
    text-align: center;
    margin-top: 0.15rem;
}

.cookie-btn-customize:hover {
    color: var(--primary, #0e8088);
}

/* --- Layer 2: Preferences Modal Dialog --- */
.cookie-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.cookie-modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.cookie-modal-card {
    background: #ffffff;
    border-radius: 18px;
    max-width: 560px;
    width: 100%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.25);
    transform: scale(0.96);
    transition: transform 0.25s ease;
    overflow: hidden;
}

.cookie-modal-overlay.show .cookie-modal-card {
    transform: scale(1);
}

.cookie-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cookie-modal-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cookie-modal-close {
    background: transparent;
    border: none;
    font-size: 1.35rem;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
}

.cookie-modal-close:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.cookie-modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.cookie-modal-intro {
    font-size: 0.88rem;
    line-height: 1.6;
    color: #475569;
    margin: 0 0 1.25rem 0;
}

/* Category Cards */
.cookie-category-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.85rem;
}

.cookie-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.cookie-category-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.cookie-category-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    background: #e6f7ec;
    color: #0e8a3a;
    border: 1px solid #bbf7d0;
    white-space: nowrap;
}

.cookie-category-desc {
    font-size: 0.825rem;
    line-height: 1.5;
    color: #64748b;
    margin: 0;
}

/* iOS Style Switch */
.cookie-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.cookie-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #cbd5e1;
    transition: 0.2s ease;
    border-radius: 24px;
}

.cookie-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: 0.2s ease;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.cookie-switch input:checked + .cookie-slider {
    background-color: var(--primary, #0e8088);
}

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

.cookie-switch input:focus-visible + .cookie-slider {
    outline: 2px solid var(--primary, #0e8088);
    outline-offset: 2px;
}

.cookie-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #ffffff;
    flex-wrap: wrap;
}

/* Footer Link styling */
.footer-link-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: inherit;
    color: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    display: inline;
    transition: color 0.15s ease;
}

.footer-link-btn:hover {
    color: var(--primary, #0e8088);
}

/* --- Mobile Responsiveness (< 640px) --- */
@media (max-width: 640px) {
    .cookie-banner {
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
        width: 100%;
        border-radius: 18px 18px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        padding: 1.15rem 1.15rem calc(1.15rem + env(safe-area-inset-bottom, 0px)) 1.15rem;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
    }

    .cookie-banner-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .cookie-btn-primary,
    .cookie-btn-secondary {
        width: 100%;
    }

    .cookie-modal-card {
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
        position: fixed;
        bottom: 0;
    }

    .cookie-modal-footer {
        flex-direction: column-reverse;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }

    .cookie-modal-footer .cookie-btn-primary,
    .cookie-modal-footer .cookie-btn-secondary {
        width: 100%;
    }
}
