/**
 * Smart Cookie Consent - Frontend Styles
 * Version: 1.0.0
 */

/* CSS Variables - customizable via settings */
:root {
    --scc-primary-color: #2271b1;
    --scc-text-color: #2c3338;
    --scc-bg-color: #ffffff;
    --scc-border-radius: 4px;
    --scc-font-family: inherit;
    --scc-box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    --scc-overlay-bg: rgba(0,0,0,0.5);
    --scc-transition: all 0.3s ease;
}

/* Removed - Overlay is part of modal now */

/* Banner Base Styles */
.scc-banner {
    position: fixed;
    left: 0;
    right: 0;
    background: var(--scc-bg-color);
    color: var(--scc-text-color);
    font-family: var(--scc-font-family);
    box-shadow: var(--scc-box-shadow);
    z-index: 999999;
    padding: 24px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    visibility: hidden;
    will-change: transform, opacity;
}

.scc-banner.show {
    opacity: 1;
    visibility: visible;
}

/* Banner Positions */
.scc-banner-bottom {
    bottom: 0;
    transform: translateY(100%);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    /* iOS Safe Area support */
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.scc-banner-bottom.show {
    transform: translateY(0);
}

.scc-banner-top {
    top: 0;
    transform: translateY(-100%);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.scc-banner-top.show {
    transform: translateY(0);
}

.scc-banner-center {
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%) scale(0.9);
    max-width: 600px;
    border-radius: 12px;
}

.scc-banner-center.show {
    transform: translate(-50%, -50%) scale(1);
}

/* Banner Layouts */
.scc-layout-banner .scc-banner-container {
    max-width: 1200px;
    margin: 0 auto;
}

.scc-layout-box .scc-banner-container {
    max-width: 500px;
    margin: 0 auto;
}

.scc-layout-popup .scc-banner-container {
    max-width: 600px;
    margin: 0 auto;
}

/* Banner Content */
.scc-banner-content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.scc-banner-icon {
    flex-shrink: 0;
    color: var(--scc-primary-color);
    font-size: 32px;
    line-height: 1;
}

.scc-banner-icon svg {
    width: 32px;
    height: 32px;
}

.scc-banner-text {
    flex: 1;
}

.scc-banner-heading {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--scc-text-color);
    line-height: 1.4;
}

.scc-banner-description {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--scc-text-color);
    opacity: 0.9;
}

.scc-banner-description a {
    color: var(--scc-primary-color);
    text-decoration: underline;
}

/* Banner Actions */
.scc-banner-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Buttons */
.scc-button {
    display: inline-block;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--scc-border-radius);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    white-space: nowrap;
    touch-action: manipulation;
    user-select: none;
}

.scc-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.scc-button-primary {
    background: var(--scc-primary-color);
    color: #ffffff;
    border-color: var(--scc-primary-color);
}

.scc-button-primary:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.scc-button-secondary {
    background: transparent;
    color: var(--scc-primary-color);
    border-color: var(--scc-primary-color);
}

.scc-button-secondary:hover:not(:disabled) {
    background: var(--scc-primary-color);
    color: #ffffff;
}

.scc-button-settings {
    background: transparent;
    color: var(--scc-text-color);
    border-color: rgba(0,0,0,0.2);
}

.scc-button-settings:hover:not(:disabled) {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.3);
}

/* Modal */
.scc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000000;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
}

.scc-modal.show {
    opacity: 1;
}

.scc-modal-content {
    background: var(--scc-bg-color);
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    transform: scale(0.95);
    transition: transform 0.3s ease;
    will-change: transform;
}

.scc-modal.show .scc-modal-content {
    transform: scale(1);
}

.scc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.scc-modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: var(--scc-text-color);
}

.scc-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    color: var(--scc-text-color);
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scc-modal-close:hover {
    opacity: 1;
}

.scc-modal-body {
    padding: 24px;
}

.scc-modal-description {
    margin: 0 0 24px 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--scc-text-color);
    opacity: 0.9;
}

.scc-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(0,0,0,0.1);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Categories */
.scc-categories {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.scc-category {
    padding: 16px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    transition: var(--scc-transition);
}

.scc-category:hover {
    border-color: rgba(0,0,0,0.2);
    background: rgba(0,0,0,0.02);
}

.scc-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.scc-category-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.scc-category-title h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--scc-text-color);
}

.scc-category-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
}

.scc-badge-required {
    background: #e8f5e9;
    color: #2e7d32;
}

.scc-category-description {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--scc-text-color);
    opacity: 0.8;
}

/* Toggle Switch */
.scc-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.scc-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.scc-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: var(--scc-transition);
    border-radius: 28px;
}

.scc-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: var(--scc-transition);
    border-radius: 50%;
}

.scc-toggle input:checked + .scc-toggle-slider {
    background-color: var(--scc-primary-color);
}

.scc-toggle input:checked + .scc-toggle-slider:before {
    transform: translateX(24px);
}

.scc-toggle-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.scc-toggle-disabled .scc-toggle-slider {
    cursor: not-allowed;
}

/* Privacy Badge */
.scc-badge {
    position: fixed !important;
    z-index: 999997 !important;
    transition: var(--scc-transition);
    pointer-events: auto !important;
}

.scc-badge-bottom-left {
    bottom: 20px !important;
    left: 20px !important;
}

.scc-badge-bottom-right {
    bottom: 20px !important;
    right: 20px !important;
}

/* Mobile: Move badge above navigation */
@media (max-width: 768px) {
    .scc-badge-bottom-left,
    .scc-badge-bottom-right {
        bottom: 80px !important; /* Above mobile navigation bar */
    }
}

.scc-badge-top-left {
    top: 20px !important;
    left: 20px !important;
}

.scc-badge-top-right {
    top: 20px !important;
    right: 20px !important;
}

/* Badge button - now a div */
.scc-badge-button {
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    background: var(--scc-primary-color) !important;
    color: #ffffff !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.scc-badge-button:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 16px rgba(0,0,0,0.3) !important;
}

.scc-badge-button:active {
    transform: scale(1.05) !important;
}

.scc-badge-button svg {
    width: 24px !important;
    height: 24px !important;
    pointer-events: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .scc-banner {
        padding: 12px 16px;
        max-height: 85vh; /* Don't cover entire screen */
        overflow-y: auto;
        left: 10px;
        right: 10px;
        border-radius: 8px;
    }
    
    /* Bottom banner - leave space for mobile navigation */
    .scc-banner-bottom {
        bottom: 60px; /* Space for mobile nav bar (usually 50-60px) */
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); /* Safe area */
    }
    
    /* Alternative: if your nav is higher */
    @media (max-width: 480px) {
        .scc-banner-bottom {
            bottom: 70px; /* Extra space for smaller screens */
        }
    }
    
    /* Top banner adjustment for mobile */
    .scc-banner-top {
        top: 0;
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
    }
    
    /* Center banner - smaller on mobile */
    .scc-banner-center {
        max-width: calc(100% - 20px);
        margin: 10px;
    }
    
    /* Make banner more compact on mobile */
    .scc-banner-content {
        flex-direction: row; /* Keep horizontal on mobile */
        gap: 12px;
        margin-bottom: 12px; /* Reduce space */
    }
    
    .scc-banner-icon {
        font-size: 20px; /* Smaller icon */
    }
    
    .scc-banner-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .scc-banner-heading {
        font-size: 16px; /* Smaller heading */
        margin-bottom: 4px;
    }
    
    .scc-banner-description {
        font-size: 12px; /* Smaller text */
        line-height: 1.4;
    }
    
    .scc-banner-actions {
        flex-direction: row; /* Horizontal buttons */
        gap: 8px;
    }
    
    .scc-button {
        flex: 1; /* Equal width buttons */
        padding: 10px 12px;
        font-size: 13px;
    }
    
    /* Hide settings button on mobile to save space */
    .scc-button-settings {
        display: none; /* User can use badge instead */
    }
    
    .scc-modal {
        padding: 10px;
        align-items: flex-end; /* Align to bottom on mobile */
    }
    
    .scc-modal-content {
        max-height: 90vh;
        width: 100%;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        margin-bottom: 0;
        /* Safe area for iOS */
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    
    .scc-modal-header,
    .scc-modal-body,
    .scc-modal-footer {
        padding: 16px;
    }
    
    .scc-modal-footer {
        flex-direction: row; /* Keep horizontal */
        gap: 8px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
    
    .scc-modal-footer .scc-button {
        flex: 1; /* Equal width */
        padding: 12px;
        font-size: 14px;
    }
    
    /* Smaller category cards */
    .scc-category {
        padding: 12px;
    }
    
    .scc-category-title h4 {
        font-size: 14px;
    }
    
    .scc-category-description {
        font-size: 12px;
    }
}

/* Performance optimizations */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Animations */
@keyframes sccFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes sccSlideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .scc-banner,
    .scc-modal,
    .scc-modal-content,
    .scc-button {
        transition: none !important;
        animation: none !important;
    }
}

/* Accessibility */
.scc-button:focus,
.scc-toggle input:focus + .scc-toggle-slider,
.scc-modal-close:focus,
.scc-badge-button:focus {
    outline: 2px solid var(--scc-primary-color);
    outline-offset: 2px;
}

/* Hide when printing */
@media print {
    .scc-banner,
    .scc-modal,
    .scc-overlay,
    .scc-badge {
        display: none !important;
    }
}

