/**
 * Cookie Consent WP - Frontend Styles
 */

/* CSS Variables - domyślne wartości, nadpisywane przez PHP */
:root {
    --ccwp-primary: #2563eb;
    --ccwp-secondary: #64748b;
    --ccwp-text: #1e293b;
    --ccwp-bg: #ffffff;
    --ccwp-btn-text: #ffffff;
    --ccwp-btn-radius: 6px;
    --ccwp-overlay: rgba(0, 0, 0, 0.5);
    --ccwp-border: #e2e8f0;
    --ccwp-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* Reset */
.ccwp-banner,
.ccwp-banner * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Overlay */
.ccwp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--ccwp-overlay);
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.ccwp-banner.ccwp-visible .ccwp-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Banner base */
.ccwp-banner {
    position: fixed;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.ccwp-banner.ccwp-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Container */
.ccwp-container {
    position: relative;
    z-index: 2;
    background: var(--ccwp-bg);
    color: var(--ccwp-text);
    box-shadow: var(--ccwp-shadow);
    max-height: 90vh;
    overflow-y: auto;
    pointer-events: auto;
}

/* ==========================================
   POZYCJE
   ========================================== */

/* Bottom */
.ccwp-position-bottom {
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(100%);
}

.ccwp-position-bottom.ccwp-visible {
    transform: translateY(0);
}

.ccwp-position-bottom .ccwp-container {
    border-top: 1px solid var(--ccwp-border);
}

/* Top */
.ccwp-position-top {
    top: 0;
    left: 0;
    right: 0;
    transform: translateY(-100%);
}

.ccwp-position-top.ccwp-visible {
    transform: translateY(0);
}

.ccwp-position-top .ccwp-container {
    border-bottom: 1px solid var(--ccwp-border);
}

/* Center (popup) */
.ccwp-position-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    max-width: 600px;
    width: calc(100% - 40px);
}

.ccwp-position-center.ccwp-visible {
    transform: translate(-50%, -50%) scale(1);
}

.ccwp-position-center .ccwp-container {
    border-radius: 16px;
}

/* ==========================================
   UKŁADY
   ========================================== */

/* Bar layout */
.ccwp-layout-bar .ccwp-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 40px;
    flex-wrap: wrap;
}

.ccwp-layout-bar .ccwp-content {
    flex: 1;
    min-width: 300px;
}

.ccwp-layout-bar .ccwp-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Box layout */
.ccwp-layout-box .ccwp-main {
    padding: 24px;
    max-width: 500px;
    margin: 0 auto;
}

.ccwp-layout-box .ccwp-content {
    margin-bottom: 20px;
}

.ccwp-layout-box .ccwp-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Popup layout */
.ccwp-layout-popup .ccwp-main {
    padding: 32px;
}

.ccwp-layout-popup .ccwp-content {
    margin-bottom: 24px;
    text-align: center;
}

.ccwp-layout-popup .ccwp-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==========================================
   MOTYWY
   ========================================== */

/* Dark theme */
.ccwp-theme-dark {
    --ccwp-bg: #1e293b;
    --ccwp-text: #f1f5f9;
    --ccwp-border: #334155;
}

.ccwp-theme-dark .ccwp-category {
    background: #334155;
}

.ccwp-theme-dark .ccwp-toggle-label {
    background: #475569;
}

/* ==========================================
   ELEMENTY
   ========================================== */

/* Title */
.ccwp-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--ccwp-text);
}

/* Description */
.ccwp-description {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--ccwp-text);
    opacity: 0.9;
    margin-bottom: 8px;
}

/* Privacy link */
.ccwp-privacy-link {
    margin-top: 8px;
}

.ccwp-privacy-link a {
    color: var(--ccwp-primary);
    text-decoration: none;
    font-size: 0.875rem;
}

.ccwp-privacy-link a:hover {
    text-decoration: underline;
}

/* ==========================================
   PRZYCISKI
   ========================================== */

.ccwp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    border-radius: var(--ccwp-btn-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ccwp-btn:focus {
    outline: 2px solid var(--ccwp-primary);
    outline-offset: 2px;
}

/* Primary button */
.ccwp-btn-primary {
    background: var(--ccwp-primary);
    color: var(--ccwp-btn-text);
}

.ccwp-btn-primary:hover {
    filter: brightness(1.1);
}

/* Secondary button */
.ccwp-btn-secondary {
    background: var(--ccwp-secondary);
    color: var(--ccwp-btn-text);
}

.ccwp-btn-secondary:hover {
    filter: brightness(1.1);
}

/* Link button */
.ccwp-btn-link {
    background: transparent;
    color: var(--ccwp-text);
    padding: 12px 16px;
}

.ccwp-btn-link:hover {
    background: rgba(0, 0, 0, 0.05);
}

.ccwp-theme-dark .ccwp-btn-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ==========================================
   PANEL USTAWIEŃ
   ========================================== */

.ccwp-settings {
    padding: 24px;
}

.ccwp-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--ccwp-border);
}

.ccwp-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--ccwp-text);
    opacity: 0.6;
    transition: opacity 0.2s;
    border-radius: 50%;
}

.ccwp-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

.ccwp-theme-dark .ccwp-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ccwp-settings-content {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 24px;
}

/* Kategoria */
.ccwp-category {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.ccwp-theme-dark .ccwp-category {
    background: #334155;
}

.ccwp-category-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.ccwp-category-info {
    flex: 1;
}

.ccwp-category-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--ccwp-text);
}

.ccwp-category-description {
    font-size: 0.875rem;
    color: var(--ccwp-text);
    opacity: 0.7;
    line-height: 1.5;
}

/* Lista ciasteczek w kategorii */
.ccwp-category-cookies {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--ccwp-border);
}

.ccwp-cookie-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    font-size: 0.8125rem;
}

.ccwp-cookie-item code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
}

.ccwp-theme-dark .ccwp-cookie-item code {
    background: rgba(255, 255, 255, 0.1);
}

.ccwp-cookie-provider {
    color: var(--ccwp-text);
    opacity: 0.6;
}

.ccwp-cookie-expiry {
    color: var(--ccwp-text);
    opacity: 0.5;
    margin-left: auto;
}

/* Toggle switch */
.ccwp-toggle {
    flex-shrink: 0;
}

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

.ccwp-toggle-label {
    display: block;
    width: 52px;
    height: 28px;
    background: #cbd5e1;
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.ccwp-toggle input:checked + .ccwp-toggle-label {
    background: var(--ccwp-primary);
}

.ccwp-toggle-switch {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ccwp-toggle input:checked + .ccwp-toggle-label .ccwp-toggle-switch {
    transform: translateX(24px);
}

.ccwp-toggle-disabled .ccwp-toggle-label {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Settings footer */
.ccwp-settings-footer {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--ccwp-border);
}

.ccwp-settings-footer .ccwp-btn {
    flex: 1;
}

/* ==========================================
   BADGE (przycisk ponownego otwarcia)
   ========================================== */

.ccwp-badge {
    position: fixed;
    z-index: 999997;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--ccwp-primary);
    color: var(--ccwp-btn-text);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ccwp-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.ccwp-badge:focus {
    outline: 2px solid var(--ccwp-primary);
    outline-offset: 2px;
}

/* Badge positions */
.ccwp-badge-bottom-left {
    bottom: 20px;
    left: 20px;
}

.ccwp-badge-bottom-right {
    bottom: 20px;
    right: 20px;
}

.ccwp-badge-top-left {
    top: 20px;
    left: 20px;
}

.ccwp-badge-top-right {
    top: 20px;
    right: 20px;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .ccwp-layout-bar .ccwp-main {
        flex-direction: column;
        padding: 20px;
        text-align: center;
    }

    .ccwp-layout-bar .ccwp-content {
        min-width: 100%;
    }

    .ccwp-layout-bar .ccwp-actions {
        width: 100%;
        flex-direction: column;
    }

    .ccwp-layout-bar .ccwp-actions .ccwp-btn {
        width: 100%;
    }

    .ccwp-position-center {
        width: calc(100% - 20px);
        max-width: none;
    }

    .ccwp-position-center .ccwp-container {
        border-radius: 12px;
    }

    .ccwp-settings {
        padding: 16px;
    }

    .ccwp-settings-content {
        max-height: 50vh;
    }

    .ccwp-settings-footer {
        flex-direction: column;
    }

    .ccwp-category-header {
        flex-direction: column;
        gap: 12px;
    }

    .ccwp-toggle {
        align-self: flex-end;
    }
}

/* ==========================================
   ANIMACJE
   ========================================== */

@keyframes ccwp-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes ccwp-slide-up {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    .ccwp-banner,
    .ccwp-overlay,
    .ccwp-toggle-label,
    .ccwp-toggle-switch,
    .ccwp-btn,
    .ccwp-badge {
        transition: none;
    }
}

/* Focus visible */
.ccwp-btn:focus-visible,
.ccwp-toggle input:focus-visible + .ccwp-toggle-label,
.ccwp-close:focus-visible,
.ccwp-badge:focus-visible {
    outline: 2px solid var(--ccwp-primary);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .ccwp-container {
        border: 2px solid currentColor;
    }

    .ccwp-btn {
        border: 2px solid currentColor;
    }

    .ccwp-toggle-label {
        border: 2px solid currentColor;
    }
}

/* Print - ukryj banner */
@media print {
    .ccwp-banner,
    .ccwp-badge {
        display: none !important;
    }
}
