/**
 * Cookie Consent Banner Styles
 *
 * Accessible, mobile-friendly cookie consent UI.
 *
 * @package NewsQode
 * @since 1.0.0
 */

/* Cookie Banner */
#newsqode-cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    border-top: 3px solid var(--bs-primary, #0073aa);
}

#newsqode-cookie-banner.show {
    transform: translateY(0);
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.cookie-banner-text {
    flex: 1 1 300px;
}

.cookie-banner-text h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.cookie-banner-text p {
    margin: 0;
    font-size: 0.95rem;
    color: #666;
    line-height: 1.5;
}

.cookie-banner-text a {
    color: var(--bs-primary, #0073aa);
    text-decoration: underline;
}

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

.cookie-banner-actions button {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cookie-banner-actions button:focus {
    outline: 2px solid var(--bs-primary, #0073aa);
    outline-offset: 2px;
}

.cookie-banner-actions button[data-cookie-action="accept-all"] {
    background: var(--bs-primary, #0073aa);
    color: #fff;
}

.cookie-banner-actions button[data-cookie-action="accept-all"]:hover {
    background: var(--bs-primary-dark, #005a87);
}

.cookie-banner-actions button[data-cookie-action="reject-all"] {
    background: #f0f0f0;
    color: #333;
}

.cookie-banner-actions button[data-cookie-action="reject-all"]:hover {
    background: #e0e0e0;
}

.cookie-banner-actions button[data-cookie-action="settings"] {
    background: transparent;
    color: var(--bs-primary, #0073aa);
    border: 1px solid var(--bs-primary, #0073aa);
}

.cookie-banner-actions button[data-cookie-action="settings"]:hover {
    background: var(--bs-primary, #0073aa);
    color: #fff;
}

/* Cookie Preferences Modal */
#newsqode-cookie-preferences {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

#newsqode-cookie-preferences.show {
    display: flex;
}

.cookie-preferences-modal {
    background: #fff;
    border-radius: 8px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
}

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

.cookie-preferences-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.cookie-preferences-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    color: #666;
    line-height: 1;
}

.cookie-preferences-close:hover {
    color: #333;
}

.cookie-preferences-close:focus {
    outline: 2px solid var(--bs-primary, #0073aa);
    outline-offset: 2px;
}

.cookie-preferences-body {
    padding: 1.5rem;
}

.cookie-preferences-intro {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f9f9f9;
    border-left: 3px solid var(--bs-primary, #0073aa);
    border-radius: 4px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #666;
}

.cookie-preferences-intro p {
    margin: 0 0 0.5rem 0;
}

.cookie-preferences-intro p:last-child {
    margin-bottom: 0;
}

.cookie-category {
    padding: 1.25rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 1rem;
}

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

.cookie-category-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.cookie-category-info p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

.cookie-category-toggle {
    flex-shrink: 0;
}

.cookie-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

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

.cookie-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.cookie-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    background-color: var(--bs-primary, #0073aa);
}

.cookie-toggle input:focus + .cookie-toggle-slider {
    outline: 2px solid var(--bs-primary, #0073aa);
    outline-offset: 2px;
}

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

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

.cookie-list {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.cookie-list h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
}

.cookie-list ul {
    margin: 0;
    padding-left: 1.5rem;
    list-style: disc;
}

.cookie-list li {
    font-size: 0.85rem;
    color: #666;
    font-family: 'Courier New', monospace;
    margin-bottom: 0.25rem;
}

.cookie-preferences-footer {
    padding: 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.cookie-preferences-footer button {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cookie-preferences-footer button:focus {
    outline: 2px solid var(--bs-primary, #0073aa);
    outline-offset: 2px;
}

.cookie-preferences-footer button[data-cookie-action="save-preferences"] {
    background: var(--bs-primary, #0073aa);
    color: #fff;
}

.cookie-preferences-footer button[data-cookie-action="save-preferences"]:hover {
    background: var(--bs-primary-dark, #005a87);
}

/* Responsive */
@media (max-width: 768px) {
    #newsqode-cookie-banner {
        padding: 1rem;
    }

    .cookie-banner-content {
        flex-direction: column;
        gap: 1rem;
    }

    .cookie-banner-text h3 {
        font-size: 1.1rem;
    }

    .cookie-banner-text p {
        font-size: 0.9rem;
    }

    .cookie-banner-actions {
        width: 100%;
        flex-direction: column;
    }

    .cookie-banner-actions button {
        width: 100%;
    }

    .cookie-preferences-modal {
        max-height: 95vh;
        margin: 0.5rem;
    }

    .cookie-preferences-header,
    .cookie-preferences-body,
    .cookie-preferences-footer {
        padding: 1rem;
    }

    .cookie-category-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .cookie-category-toggle {
        align-self: flex-end;
    }

    .cookie-preferences-footer {
        flex-direction: column;
    }

    .cookie-preferences-footer button {
        width: 100%;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    #newsqode-cookie-banner {
        background: #1a1a1a;
        border-top-color: var(--bs-primary, #0073aa);
    }

    .cookie-banner-text h3 {
        color: #fff;
    }

    .cookie-banner-text p {
        color: #ccc;
    }

    .cookie-preferences-modal {
        background: #1a1a1a;
    }

    .cookie-preferences-header {
        border-bottom-color: #333;
    }

    .cookie-preferences-header h2 {
        color: #fff;
    }

    .cookie-preferences-close {
        color: #ccc;
    }

    .cookie-preferences-close:hover {
        color: #fff;
    }

    .cookie-category {
        border-color: #333;
    }

    .cookie-category-info h3 {
        color: #fff;
    }

    .cookie-category-info p {
        color: #ccc;
    }

    .cookie-list {
        border-top-color: #333;
    }

    .cookie-list h4 {
        color: #ccc;
    }

    .cookie-list li {
        color: #ccc;
    }

    .cookie-preferences-footer {
        border-top-color: #333;
    }
}

/* Print styles */
@media print {
    #newsqode-cookie-banner,
    #newsqode-cookie-preferences {
        display: none !important;
    }
}
