/**
 * EasyLytics Cookie Consent Styles
 * Version: 1.4.1
 * Updated with close button, dynamic color system, toggle functionality, mobile improvements,
 * and smooth animation fixes
 */

/* CSS Variables - will be overridden by dynamic CSS */
:root {
    --eslt-bg-color: #ffffff;
    --eslt-text-color: #374151;
    --eslt-primary-btn-bg: #3b82f6;
    --eslt-primary-btn-text: #ffffff;
    --eslt-secondary-btn-bg: #000000;
    --eslt-secondary-btn-text: #ffffff;
    --eslt-tertiary-btn-bg: #dc2626;
    --eslt-tertiary-btn-text: #ffffff;
    --eslt-border-color: #d1d5db;
    --eslt-font-size: 16px;
}

/* Main popup container */
#eslt-cookie-popup {
    position: fixed;
    z-index: 999999;
    width: 100%;
    max-width: 450px;
    max-height: calc(100vh - 40px);
    background-color: var(--eslt-bg-color);
    color: var(--eslt-text-color);
    border: 2px solid var(--eslt-border-color);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 24px 24px 24px 24px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: var(--eslt-font-size);
    line-height: 1.5;
    overflow-y: auto;
    overflow-x: hidden;
    /*scrollbar-width: none;*/
}

/* Position classes */
#eslt-cookie-popup.eslt-popup-bottom-right {
    bottom: 20px;
    right: 20px;
}

#eslt-cookie-popup.eslt-popup-bottom-left {
    bottom: 20px;
    left: 20px;
}

#eslt-cookie-popup.eslt-popup-bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

/* Close button - dismisses popup without saving cookies */
.eslt-close-btn {
    position: absolute;
    top: 0px;
    right: 0px;
    background: none;
    border: none;
    color: var(--eslt-text-color);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 4px;
    transition: color 0.2s ease;
    z-index: 1;
    margin: 0;
}

.eslt-close-btn:hover,
.eslt-close-btn:focus {
    color: #dc2626;
    outline: none;
}

.eslt-close-btn:focus-visible {
    outline: 2px solid var(--eslt-primary-btn-bg);
    outline-offset: 2px;
}

/* Popup content */
.eslt-popup-content {
    position: relative;
}

.eslt-popup-content h3 {
    margin: 0 0 12px 0;
    font-size: calc(var(--eslt-font-size) + 2px);
    font-weight: 600;
    color: var(--eslt-text-color);
}

.eslt-popup-content p {
    margin: 0;
    color: var(--eslt-text-color);
    font-size: var(--eslt-font-size);
}

.eslt-cookie-info-link {
    padding: 20px 0 0 0;
    font-size: calc(var(--eslt-font-size) - 1px) !important;
}

.eslt-cookie-info-link a {
    color: var(--eslt-primary-btn-bg);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.eslt-cookie-info-link a:hover,
.eslt-cookie-info-link a:focus {
    outline: none;
}

/* Button containers */
.eslt-buttons {
    display: flex;
    gap: 8px;
    padding-top: 25px;
    flex-wrap: wrap;
}

.eslt-buttons button {
    flex: 1;
    min-width: 115px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: calc(var(--eslt-font-size) + 2px);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    line-height: 1.2;
    margin: 0;
}

/* Primary button (Accept All, Save Preferences) */
.eslt-accept-btn,
.eslt-save-btn {
    background-color: var(--eslt-primary-btn-bg);
    color: var(--eslt-primary-btn-text);
}

.eslt-accept-btn:hover,
.eslt-accept-btn:focus,
.eslt-save-btn:hover,
.eslt-save-btn:focus {
    opacity: 0.9;
    transform: translateY(-1px);
    outline: none;
}

/* Reject button (Tertiary button style) */
.eslt-reject-btn {
    background-color: var(--eslt-tertiary-btn-bg);
    color: var(--eslt-tertiary-btn-text);
}

.eslt-reject-btn:hover,
.eslt-reject-btn:focus {
    opacity: 0.9;
    transform: translateY(-1px);
    outline: none;
}

.eslt-reject-btn:focus-visible {
    outline: 2px solid var(--eslt-text-color);
    outline-offset: 2px;
}

.eslt-accept-btn:focus-visible,
.eslt-save-btn:focus-visible {
    outline: 2px solid var(--eslt-text-color);
    outline-offset: 2px;
}

/* Secondary button (Cookie Settings) */
.eslt-settings-btn {
    background-color: var(--eslt-secondary-btn-bg);
    color: var(--eslt-secondary-btn-text);
    border: 1px solid var(--eslt-border-color);
    transition: all 0.2s ease;
}

.eslt-settings-btn:hover,
.eslt-settings-btn:focus {
    opacity: 0.9;
    transform: translateY(-1px);
    outline: none;
}

.eslt-settings-btn:focus-visible {
    outline: 2px solid var(--eslt-primary-btn-bg);
    outline-offset: 2px;
}

/* Settings button when active/expanded */
.eslt-settings-btn.eslt-active {
    background-color: var(--eslt-primary-btn-bg);
    color: var(--eslt-primary-btn-text);
    border-color: var(--eslt-primary-btn-bg);
}

/* Settings view - with overflow hidden for smooth animations */
.eslt-settings-view {
    margin-top: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--eslt-border-color);
    display: block;
    overflow: hidden;
}

.eslt-settings-view.eslt-hidden {
    display: none;
}

.eslt-hidden {
    display: none;
}

.eslt-cookie-category {
    margin-bottom: 20px;
    padding: 16px;
    background-color: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--eslt-border-color);
    border-radius: 8px;
}

.eslt-cookie-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    margin-bottom: 8px;
}

.eslt-cookie-label input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    width: 1px;
    height: 1px;
}

.eslt-checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--eslt-border-color);
    border-radius: 4px;
    margin-right: 12px;
    flex-shrink: 0;
    position: relative;
    background-color: var(--eslt-bg-color);
    transition: all 0.2s ease;
    margin-top: 2px;
}

.eslt-cookie-label input[type="checkbox"]:checked + .eslt-checkbox-custom {
    background-color: var(--eslt-primary-btn-bg);
    border-color: var(--eslt-primary-btn-bg);
}

.eslt-cookie-label input[type="checkbox"]:checked + .eslt-checkbox-custom::after {
    content: '✓';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.eslt-cookie-label input[type="checkbox"]:disabled + .eslt-checkbox-custom {
    opacity: 0.6;
    cursor: not-allowed;
}

.eslt-cookie-label input[type="checkbox"]:focus + .eslt-checkbox-custom {
    outline: 2px solid var(--eslt-primary-btn-bg);
    outline-offset: 2px;
}

.eslt-cookie-label strong {
    color: var(--eslt-text-color);
    font-weight: 600;
}

.eslt-cookie-description {
    margin: 0;
    font-size: calc(var(--eslt-font-size) - 2px);
    color: var(--eslt-text-color);
    opacity: 0.8;
    margin-left: 32px;
}

/* Success message styling - uses popup colors */
.eslt-success-message {
    display: none;
    margin-top: 16px;
    padding: 12px 16px;
    background-color: #ffffff;
    color: var(--eslt-text-color);
    border: 1px solid #28a745;
    border-radius: 6px;
    font-weight: 500;
    text-align: center;
}

.eslt-success-message p {
    margin: 0;
    font-size: calc(var(--eslt-font-size) - 1px);
    line-height: 1.4;
}

/* YouTube wrapper and blur styling */
.eslt-youtube-wrapper {
}

.eslt-youtube-blurred {        

}

.eslt-youtube-overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
}

.eslt-youtube-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.3;
}

.eslt-youtube-overlay {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
}

.eslt-youtube-play-button {
    width: 80px;
    height: 80px;
    background: rgba(255, 0, 0, 0.8);
    border-radius: 50%;
    position: relative;
    margin-bottom: 20px;
    cursor: pointer;
}

.eslt-youtube-play-button::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-40%, -50%);
    width: 0;
    height: 0;
    border-left: 20px solid white;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
}

.eslt-youtube-consent-banner {
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 8px;
    max-width: 400px;
}

.eslt-youtube-consent-banner h4 {
    margin: 0 0 10px 0;
    font-size: 30px;
    color: white;
}

.eslt-youtube-consent-banner p {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #ccc;
}

.eslt-youtube-accept-btn {
    background: #ff0000;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease;
}

.eslt-youtube-accept-btn:hover {
    background: #cc0000;
}

/* Mobile responsive for YouTube blocks */
@media (max-width: 480px) {
    .eslt-youtube-wrapper {
        margin: 15px 0;
        max-width: 100%;
        overflow: auto;
        min-height: 230px;        
    }
    
    .eslt-youtube-blurred {
        height: 200px;
    }
    
    .eslt-youtube-consent-banner {
        padding: 15px;
        max-width: 300px;
    }
    
    .eslt-youtube-play-button {
        width: 60px;
        height: 60px;
        margin-bottom: 15px;
    }
    
    .eslt-youtube-play-button::after {
        border-left: 15px solid white;
        border-top: 9px solid transparent;
        border-bottom: 9px solid transparent;
    }

    .eslt-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .eslt-buttons button {
        min-width: auto;
        width: 100%;
    }
}

/* Mobile responsive */
@media (max-width: 480px) {
    #eslt-cookie-popup {
        position: fixed;
        /*top: 50%;*/
        left: 15px;
        right: 15px;
        /*transform: translateY(-50%);*/
        bottom: auto;
        width: auto;
        max-width: calc(100% - 30px);
        max-height: calc(100vh - 30px);
        margin: 0;
        padding: 20px;
        border-radius: 8px;
        top: 25px;
        bottom: 25px;
    }
    
    #eslt-cookie-popup.eslt-popup-bottom-right,
    #eslt-cookie-popup.eslt-popup-bottom-left,
    #eslt-cookie-popup.eslt-popup-bottom-center {
        /*
        top: 55%;
        left: 15px;
        right: 15px;
        transform: translateY(-50%);
        */
        bottom: auto;
        /*width: auto;*/
        right: auto;
    }
    
    .eslt-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .eslt-close-btn {
        top: 0px;
        right: 0px;
        font-size: 16px;
    }
    
    #eslt-cookie-popup {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #eslt-cookie-popup::-webkit-scrollbar {
        width: 4px;
    }
    
    #eslt-cookie-popup::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.1);
        border-radius: 2px;
    }
    
    #eslt-cookie-popup::-webkit-scrollbar-thumb {
        background: var(--eslt-text-color);
        opacity: 0.3;
        border-radius: 2px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #eslt-cookie-popup {
        border-width: 3px;
    }
    
    .eslt-checkbox-custom {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    #eslt-cookie-popup,
    .eslt-buttons button,
    .eslt-checkbox-custom,
    .eslt-close-btn {
        transition: none;
    }
    
    .eslt-accept-btn:hover,
    .eslt-accept-btn:focus,
    .eslt-save-btn:hover,
    .eslt-save-btn:focus,
    .eslt-settings-btn:hover,
    .eslt-settings-btn:focus {
        transform: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --eslt-bg-color: #1f2937;
        --eslt-text-color: #f9fafb;
        --eslt-border-color: #374151;
    }
    
    .eslt-cookie-category {
        background-color: rgba(255, 255, 255, 0.05);
    }
}

/* Focus management for accessibility */
#eslt-cookie-popup:focus-within {
    outline: none;
}

/* Loading state */
#eslt-cookie-popup.eslt-loading {
    pointer-events: none;
}

#eslt-cookie-popup.eslt-loading .eslt-buttons button {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Print styles */
@media print {
    #eslt-cookie-popup {
        display: none !important;
    }
}

/* Shortcode button styling */
.easylytics-settings-btn {
    padding: 8px 16px;
    background-color: var(--eslt-secondary-btn-bg, #000000);
    color: var(--eslt-secondary-btn-text, #ffffff);
    border: 1px solid var(--eslt-border-color, #d1d5db);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
}

.easylytics-settings-btn:hover,
.easylytics-settings-btn:focus {
    opacity: 0.9;
    transform: translateY(-1px);
    outline: none;
    text-decoration: none;
    color: var(--eslt-secondary-btn-text, #ffffff);
}

.easylytics-settings-btn:focus-visible {
    outline: 2px solid var(--eslt-primary-btn-bg, #3b82f6);
    outline-offset: 2px;
}