/**
 * Leven GDPR Cookie Banner Styles
 * Optimized for performance and mobile responsiveness
 */

/* Reset and base */
.leven-gdpr-banner *,
.leven-gdpr-banner *::before,
.leven-gdpr-banner *::after {
    box-sizing: border-box;
}

/* Main banner container */
.leven-gdpr-banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease-in-out;
    will-change: transform, opacity;
}

/* Dark theme (default) */
.leven-gdpr-banner {
    background: rgba(28, 28, 28, 0.95);
    color: #ffffff;
    border-top: 2px solid #6BBE6B;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

/* Light theme */
.leven-gdpr-banner-light {
    background: rgba(248, 249, 250, 0.95);
    color: #333333;
    border-top: 2px solid #6BBE6B;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

/* Position variants */
.leven-gdpr-banner-bottom {
    bottom: 0;
    transform: translateY(100%);
}

.leven-gdpr-banner-bottom.shown {
    transform: translateY(0);
}

.leven-gdpr-banner-top {
    top: 0;
    transform: translateY(-100%);
}

.leven-gdpr-banner-top.shown {
    transform: translateY(0);
}

/* Banner content */
.leven-gdpr-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 70px;
}

.leven-gdpr-banner-text {
    flex: 1;
    min-width: 0;
}

.leven-gdpr-banner-text p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.leven-gdpr-banner-text a {
    color: #6BBE6B;
    text-decoration: underline;
}

.leven-gdpr-banner-text a:hover {
    color: #5aa85a;
}

/* Actions container */
.leven-gdpr-banner-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.leven-gdpr-banner-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Button styles */
.leven-gdpr-btn {
    background: #6BBE6B;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    min-width: 100px;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.leven-gdpr-btn:hover {
    background: #5aa85a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(107, 190, 107, 0.3);
}

.leven-gdpr-btn:active {
    transform: translateY(0);
}

.leven-gdpr-btn:focus {
    outline: 2px solid #6BBE6B;
    outline-offset: 2px;
}

/* Button variants */
.leven-gdpr-btn-accept-all {
    background: #6BBE6B;
    order: 1;
}

.leven-gdpr-btn-reject-all {
    background: #666;
    order: 3;
}

.leven-gdpr-btn-reject-all:hover {
    background: #555;
}

.leven-gdpr-btn-customize {
    background: transparent;
    border: 1px solid #666;
    order: 2;
}

.leven-gdpr-btn-customize:hover {
    background: #666;
    border-color: #666;
}

/* Light theme button adjustments */
.leven-gdpr-banner-light .leven-gdpr-btn-customize {
    border-color: #999;
    color: #333;
}

.leven-gdpr-banner-light .leven-gdpr-btn-customize:hover {
    background: #999;
    color: #fff;
}

/* Customize panel */
.leven-gdpr-customize-panel {
    display: none;
    background: #f8f9fa;
    color: #333;
    border-top: 1px solid #ddd;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 400px; }
}

.leven-gdpr-customize-content {
    max-width: 1200px;
    margin: 0 auto;
}

.leven-gdpr-customize-content h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

/* Cookie categories */
.leven-gdpr-cookie-category {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.leven-gdpr-cookie-category:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.leven-gdpr-category-header {
    margin-bottom: 8px;
}

/* Toggle switch */
.leven-gdpr-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.leven-gdpr-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.leven-gdpr-toggle-slider {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    background-color: #ccc;
    border-radius: 24px;
    margin-right: 12px;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.leven-gdpr-toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.leven-gdpr-toggle input:checked + .leven-gdpr-toggle-slider {
    background-color: #6BBE6B;
}

.leven-gdpr-toggle input:checked + .leven-gdpr-toggle-slider:before {
    transform: translateX(26px);
}

.leven-gdpr-toggle input:disabled + .leven-gdpr-toggle-slider {
    background-color: #6BBE6B;
    opacity: 0.7;
    cursor: not-allowed;
}

.leven-gdpr-toggle-label {
    font-weight: 600;
    font-size: 14px;
    flex: 1;
}

/* Category descriptions */
.leven-gdpr-category-description {
    margin-left: 62px;
}

.leven-gdpr-category-description p {
    margin: 0;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

/* Customize actions */
.leven-gdpr-customize-actions {
    margin-top: 20px;
    text-align: center;
}

.leven-gdpr-btn-save {
    background: #6BBE6B;
    margin-right: 10px;
}

.leven-gdpr-btn-cancel {
    background: #666;
}

/* Affiliate emphasis animation */
.leven-gdpr-banner.affiliate-emphasis {
    animation: levenGdprPulse 2s infinite;
    border-color: #ffc107;
    box-shadow: 0 -4px 20px rgba(255, 193, 7, 0.8);
}

@keyframes levenGdprPulse {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(0) scale(1.02); }
    100% { transform: translateY(0) scale(1); }
}

/* Loading state */
.leven-gdpr-banner.loading {
    pointer-events: none;
    opacity: 0.7;
}

.leven-gdpr-btn.loading {
    position: relative;
    color: transparent;
}

.leven-gdpr-btn.loading:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .leven-gdpr-banner-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 15px;
    }
    
    .leven-gdpr-banner-buttons {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }
    
    .leven-gdpr-btn {
        width: 100%;
        margin: 0;
        font-size: 14px;
        padding: 12px 20px;
    }
    
    .leven-gdpr-customize-panel {
        max-height: 300px;
        padding: 15px;
    }
    
    .leven-gdpr-category-description {
        margin-left: 0;
        margin-top: 10px;
    }
    
    .leven-gdpr-toggle {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .leven-gdpr-toggle-slider {
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    .leven-gdpr-banner-content {
        padding: 12px;
    }
    
    .leven-gdpr-banner-text {
        font-size: 13px;
    }
    
    .leven-gdpr-btn {
        font-size: 13px;
        padding: 10px 16px;
    }
    
    .leven-gdpr-customize-panel {
        padding: 12px;
    }
    
    .leven-gdpr-customize-content h3 {
        font-size: 16px;
    }
}

/* Body modifications when banner is visible */
body.leven-gdpr-banner-visible {
    padding-bottom: 80px;
    transition: padding-bottom 0.3s ease;
}

body.leven-gdpr-banner-visible.banner-top {
    padding-top: 80px;
    padding-bottom: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .leven-gdpr-banner {
        background: rgba(0, 0, 0, 0.95);
        border-top-color: #ffffff;
    }
    
    .leven-gdpr-btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .leven-gdpr-banner,
    .leven-gdpr-btn,
    .leven-gdpr-toggle-slider,
    .leven-gdpr-toggle-slider:before {
        transition: none;
    }
    
    .leven-gdpr-banner.affiliate-emphasis {
        animation: none;
    }
}

/* Floating Settings Icon */
.leven-gdpr-settings-icon {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 999998;
    width: 50px;
    height: 50px;
    background: #6BBE6B;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    color: #ffffff;
    user-select: none;
}

.leven-gdpr-settings-icon:hover {
    background: #5aa85a;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.leven-gdpr-settings-icon:focus {
    outline: 2px solid #6BBE6B;
    outline-offset: 2px;
}

.leven-gdpr-settings-icon:active {
    transform: translateY(0px) scale(0.98);
}

.leven-gdpr-settings-icon svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.leven-gdpr-settings-icon:hover svg {
    transform: rotate(45deg);
}

.leven-gdpr-settings-icon.visible {
    opacity: 1;
    animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Settings icon pulse animation for attention */
.leven-gdpr-settings-icon.pulse {
    animation: settingsPulse 2s infinite;
}

@keyframes settingsPulse {
    0% { 
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15), 0 0 0 0 rgba(107, 190, 107, 0.7);  
    }
    70% { 
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15), 0 0 0 10px rgba(107, 190, 107, 0); 
    }
    100% { 
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15), 0 0 0 0 rgba(107, 190, 107, 0); 
    }
}

/* Mobile adjustments for settings icon */
@media (max-width: 768px) {
    .leven-gdpr-settings-icon {
        bottom: 15px;
        left: 15px;
        width: 45px;
        height: 45px;
    }
    
    .leven-gdpr-settings-icon svg {
        width: 20px;
        height: 20px;
    }
}

/* Hide settings icon when banner is visible */
body.leven-gdpr-banner-visible .leven-gdpr-settings-icon {
    opacity: 0.3;
    pointer-events: none;
}

/* Print styles */
@media print {
    .leven-gdpr-banner,
    .leven-gdpr-settings-icon {
        display: none !important;
    }
}
