/**
 * Simple Cookie Consent Banner - Frontend Styles
 * Version 2.1.0 - Category + Per-Cookie consent with modal support
 * 
 * @package Simple_Cookie_Consent_Banner
 */

/* ==========================================================================
   CSS Custom Properties
   ========================================================================== */

:root {
    --sccb-bg-color: #1a202c;
    --sccb-text-color: #e2e8f0;
    --sccb-btn-primary: #48bb78;
    --sccb-btn-secondary: #4a5568;
    --sccb-accent-color: #667eea;
    --sccb-border-color: rgba(255, 255, 255, 0.1);
    --sccb-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
    --sccb-radius: 12px;
    --sccb-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* ==========================================================================
   Banner Container
   ========================================================================== */

.sccb-cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 999999;
    font-family: var(--sccb-font);
    font-size: 14px;
    line-height: 1.5;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.sccb-cookie-banner.sccb-visible {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   Position Variants
   ========================================================================== */

.sccb-cookie-banner.sccb-position-bottom {
    bottom: 0;
    transform: translateY(100%);
}

.sccb-cookie-banner.sccb-position-bottom.sccb-visible {
    transform: translateY(0);
}

.sccb-cookie-banner.sccb-position-top {
    top: 0;
    transform: translateY(-100%);
}

.sccb-cookie-banner.sccb-position-top.sccb-visible {
    transform: translateY(0);
}

.sccb-cookie-banner.sccb-position-top .sccb-banner-container {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.sccb-cookie-banner.sccb-position-center {
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ==========================================================================
   Layout Variants
   ========================================================================== */

/* Bar Layout */
.sccb-cookie-banner.sccb-layout-bar .sccb-banner-container {
    background: var(--sccb-bg-color);
    box-shadow: var(--sccb-shadow);
}

/* Modal Layout */
.sccb-cookie-banner.sccb-layout-modal .sccb-banner-container,
.sccb-cookie-banner.sccb-position-center .sccb-banner-container {
    max-width: 520px;
    margin: 0 auto;
    border-radius: var(--sccb-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   Overlay (Modal)
   ========================================================================== */

.sccb-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: -1;
}

/* ==========================================================================
   Banner Container
   ========================================================================== */

.sccb-banner-container {
    background: var(--sccb-bg-color);
    color: var(--sccb-text-color);
}

.sccb-banner-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* ==========================================================================
   Banner Content
   ========================================================================== */

.sccb-banner-content {
    margin-bottom: 20px;
}

.sccb-banner-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--sccb-text-color);
}

.sccb-banner-text {
    margin: 0 0 8px;
    color: var(--sccb-text-color);
    opacity: 0.9;
    font-size: 14px;
    line-height: 1.6;
}

.sccb-privacy-link {
    color: var(--sccb-accent-color);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.sccb-privacy-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ==========================================================================
   Categories Section
   ========================================================================== */

.sccb-categories {
    margin: 20px 0;
    padding: 16px 0;
    border-top: 1px solid var(--sccb-border-color);
    border-bottom: 1px solid var(--sccb-border-color);
    max-height: 300px;
    overflow-y: auto;
}

.sccb-category {
    padding: 14px 16px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: background 0.2s;
}

.sccb-category:last-child {
    margin-bottom: 0;
}

.sccb-category:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sccb-category-necessary {
    background: rgba(72, 187, 120, 0.1);
}

.sccb-category-necessary:hover {
    background: rgba(72, 187, 120, 0.15);
}

.sccb-category-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sccb-category-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sccb-category-label {
    font-weight: 600;
    font-size: 14px;
    color: var(--sccb-text-color);
}

.sccb-category-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--sccb-accent-color);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sccb-badge-required {
    background: rgba(72, 187, 120, 0.8);
}

.sccb-category-desc {
    margin: 8px 0 0 54px;
    font-size: 12px;
    color: var(--sccb-text-color);
    opacity: 0.7;
    line-height: 1.5;
}

/* ==========================================================================
   Category Toggle Switch
   ========================================================================== */

.sccb-category-toggle {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.sccb-category-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.sccb-category-toggle .sccb-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: 0.3s;
    border-radius: 24px;
}

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

.sccb-category-toggle input:checked + .sccb-toggle-slider {
    background-color: var(--sccb-btn-primary);
}

.sccb-category-toggle input:checked + .sccb-toggle-slider:before {
    transform: translateX(18px);
}

.sccb-category-toggle input:disabled + .sccb-toggle-slider {
    opacity: 0.7;
    cursor: not-allowed;
}

.sccb-category-toggle input:focus-visible + .sccb-toggle-slider {
    outline: 2px solid var(--sccb-accent-color);
    outline-offset: 2px;
}

/* ==========================================================================
   Cookie Count & Toggle Button
   ========================================================================== */

.sccb-cookie-count {
    font-size: 11px;
    color: var(--sccb-text-color);
    opacity: 0.6;
    margin-left: auto;
}

.sccb-toggle-cookies-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--sccb-accent-color);
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 10px;
    white-space: nowrap;
}

.sccb-toggle-cookies-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--sccb-accent-color);
}

.sccb-category.sccb-cookies-expanded .sccb-toggle-cookies-btn {
    background: var(--sccb-accent-color);
    border-color: var(--sccb-accent-color);
    color: #fff;
}

/* ==========================================================================
   Per-Cookie Toggle List
   ========================================================================== */

.sccb-cookie-list {
    margin-top: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.sccb-cookie-item {
    padding: 10px 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    transition: background 0.2s;
}

.sccb-cookie-item:last-child {
    margin-bottom: 0;
}

.sccb-cookie-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sccb-cookie-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sccb-cookie-toggle {
    position: relative;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
}

.sccb-cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.sccb-toggle-small {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: 0.3s;
    border-radius: 20px;
}

.sccb-toggle-small:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.sccb-cookie-toggle input:checked + .sccb-toggle-small {
    background-color: var(--sccb-btn-primary);
}

.sccb-cookie-toggle input:checked + .sccb-toggle-small:before {
    transform: translateX(16px);
}

.sccb-cookie-toggle input:disabled + .sccb-toggle-small {
    opacity: 0.6;
    cursor: not-allowed;
}

.sccb-cookie-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sccb-cookie-name {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    color: var(--sccb-text-color);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
    word-break: break-all;
}

.sccb-cookie-desc {
    font-size: 11px;
    color: var(--sccb-text-color);
    opacity: 0.6;
    line-height: 1.4;
}

.sccb-no-cookies-msg {
    font-size: 12px;
    color: var(--sccb-text-color);
    opacity: 0.5;
    font-style: italic;
    text-align: center;
    padding: 10px;
    margin: 0;
}

/* Cookie list scrollbar */
.sccb-cookie-list::-webkit-scrollbar {
    width: 5px;
}

.sccb-cookie-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.sccb-cookie-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sccb-cookie-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   Banner Actions
   ========================================================================== */

.sccb-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.sccb-actions-main {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}

.sccb-actions-settings {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.sccb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.sccb-btn:focus {
    outline: none;
}

.sccb-btn:focus-visible {
    outline: 2px solid var(--sccb-accent-color);
    outline-offset: 2px;
}

/* Primary Button */
.sccb-btn-primary {
    background-color: var(--sccb-btn-primary);
    color: #fff;
    flex: 1;
    min-width: 140px;
}

.sccb-btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.sccb-btn-primary:active {
    filter: brightness(0.95);
    transform: translateY(0);
}

/* Secondary Button */
.sccb-btn-secondary {
    background-color: var(--sccb-btn-secondary);
    color: #fff;
    flex: 1;
    min-width: 140px;
}

.sccb-btn-secondary:hover {
    filter: brightness(1.2);
    transform: translateY(-1px);
}

.sccb-btn-secondary:active {
    filter: brightness(0.95);
    transform: translateY(0);
}

/* Link Button */
.sccb-btn-link {
    background: transparent;
    color: var(--sccb-accent-color);
    padding: 8px 16px;
    font-size: 13px;
}

.sccb-btn-link:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Settings Visible State
   ========================================================================== */

.sccb-cookie-banner.sccb-settings-visible .sccb-actions-main {
    display: none;
}

.sccb-cookie-banner.sccb-settings-visible .sccb-actions-settings {
    width: 100%;
}

.sccb-cookie-banner.sccb-settings-visible #sccb-save-settings {
    flex: 1;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media screen and (min-width: 768px) {
    .sccb-cookie-banner.sccb-layout-bar .sccb-banner-inner {
        display: flex;
        align-items: flex-start;
        gap: 24px;
    }
    
    .sccb-cookie-banner.sccb-layout-bar .sccb-banner-content {
        flex: 1;
        margin-bottom: 0;
    }
    
    .sccb-cookie-banner.sccb-layout-bar .sccb-banner-actions {
        flex-shrink: 0;
        width: auto;
        min-width: 320px;
    }
    
    .sccb-cookie-banner.sccb-layout-bar .sccb-actions-main {
        flex-direction: row;
    }
    
    .sccb-cookie-banner.sccb-layout-bar.sccb-settings-visible .sccb-banner-inner {
        flex-direction: column;
    }
    
    .sccb-cookie-banner.sccb-layout-bar.sccb-settings-visible .sccb-banner-actions {
        width: 100%;
    }
}

@media screen and (max-width: 767px) {
    .sccb-banner-inner {
        padding: 20px;
    }
    
    .sccb-banner-title {
        font-size: 16px;
    }
    
    .sccb-banner-text {
        font-size: 13px;
    }
    
    .sccb-btn {
        padding: 12px 20px;
        font-size: 13px;
    }
    
    .sccb-banner-actions {
        flex-direction: column;
    }
    
    .sccb-actions-main {
        flex-direction: column;
        width: 100%;
    }
    
    .sccb-actions-settings {
        width: 100%;
        justify-content: center;
    }
    
    .sccb-btn-primary,
    .sccb-btn-secondary {
        width: 100%;
        flex: none;
    }
    
    .sccb-category-desc {
        margin-left: 0;
        margin-top: 10px;
    }
    
    .sccb-categories {
        max-height: 250px;
    }
}

@media screen and (max-width: 480px) {
    .sccb-banner-inner {
        padding: 16px;
    }
    
    .sccb-category {
        padding: 12px;
    }
    
    .sccb-category-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .sccb-category-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .sccb-cookie-count {
        margin-left: 0;
    }
    
    .sccb-toggle-cookies-btn {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
    }
    
    .sccb-cookie-list {
        max-height: 150px;
    }
    
    .sccb-cookie-header {
        flex-wrap: wrap;
    }
    
    .sccb-cookie-info {
        width: 100%;
        margin-top: 6px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .sccb-cookie-banner,
    .sccb-btn,
    .sccb-category,
    .sccb-category-toggle .sccb-toggle-slider,
    .sccb-category-toggle .sccb-toggle-slider:before {
        transition: none;
    }
}

@media (forced-colors: active) {
    .sccb-cookie-banner {
        border: 2px solid currentColor;
    }
    
    .sccb-btn {
        border: 2px solid currentColor;
    }
    
    .sccb-category-toggle .sccb-toggle-slider {
        border: 2px solid currentColor;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .sccb-cookie-banner {
        display: none !important;
    }
}

/* ==========================================================================
   Scrollbar Styling (Categories)
   ========================================================================== */

.sccb-categories::-webkit-scrollbar {
    width: 6px;
}

.sccb-categories::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.sccb-categories::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sccb-categories::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Firefox */
.sccb-categories {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}
