/* ==========================================================================
   Cookie Master - Public CSS
   ========================================================================== */

#cookie-master-banner,
#cookie-master-preferences,
#cookie-master-floating-btn {
    box-sizing: border-box;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--cm-banner-text, #1a1a1a);
}

#cookie-master-banner *,
#cookie-master-preferences *,
#cookie-master-floating-btn * {
    box-sizing: border-box;
    font-family: inherit;
}

/* ==========================================================================
   BANNER GŁÓWNY
   ========================================================================== */

.cm-banner {
    position: fixed;
    z-index: 999998;
    background: var(--cm-banner-bg, #ffffff);
    color: var(--cm-banner-text, #1a1a1a);
    box-shadow: 0 -2px 30px rgba(0, 0, 0, 0.12);
    animation: cm-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cm-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes cm-slide-down {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes cm-fade-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* Layout: bottom_bar */
.cm-banner.cm-layout-bottom_bar {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.cm-banner.cm-layout-bottom_bar.cm-position-top {
    bottom: auto;
    top: 0;
    border-top: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 30px rgba(0, 0, 0, 0.12);
    animation-name: cm-slide-down;
}

.cm-banner.cm-layout-bottom_bar .cm-banner-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.cm-banner.cm-layout-bottom_bar .cm-banner-content {
    flex: 1;
    min-width: 280px;
}

.cm-banner.cm-layout-bottom_bar .cm-banner-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Layout: floating */
.cm-banner.cm-layout-floating {
    bottom: 24px;
    left: 24px;
    max-width: 420px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.cm-banner.cm-layout-floating.cm-position-bottom-right {
    left: auto;
    right: 24px;
}

.cm-banner.cm-layout-floating.cm-position-top-left {
    bottom: auto;
    top: 24px;
}

.cm-banner.cm-layout-floating.cm-position-top-right {
    bottom: auto;
    top: 24px;
    left: auto;
    right: 24px;
}

.cm-banner.cm-layout-floating .cm-banner-inner {
    padding: 24px;
}

.cm-banner.cm-layout-floating .cm-banner-content {
    margin-bottom: 16px;
}

.cm-banner.cm-layout-floating .cm-banner-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cm-banner.cm-layout-floating .cm-banner-actions .cm-btn {
    width: 100%;
}

/* Layout: popup (centered modal) */
.cm-banner.cm-layout-popup {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 520px;
    width: calc(100% - 40px);
    border-radius: 16px;
    animation: cm-fade-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cm-banner.cm-layout-popup::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    backdrop-filter: blur(4px);
}

.cm-banner.cm-layout-popup .cm-banner-inner {
    padding: 32px;
}

.cm-banner.cm-layout-popup .cm-banner-content {
    margin-bottom: 24px;
}

.cm-banner.cm-layout-popup .cm-banner-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Tytuł i wiadomość */
.cm-banner-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: inherit;
}

.cm-banner-title .cm-icon {
    display: inline-flex;
    align-items: center;
    color: var(--cm-accent, #2563eb);
}

.cm-banner-title .cm-icon svg {
    width: 24px;
    height: 24px;
}

.cm-preferences-header h2 .cm-icon {
    display: inline-flex;
    align-items: center;
    color: var(--cm-accent, #2563eb);
}

.cm-preferences-header h2 .cm-icon svg {
    width: 22px;
    height: 22px;
}

.cm-close {
    color: var(--cm-banner-text, #1a1a1a);
}

.cm-banner-message {
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    color: inherit;
    opacity: 0.85;
}

.cm-banner-message a {
    color: var(--cm-accent, #2563eb);
    text-decoration: underline;
}

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

.cm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
    font-family: inherit;
    min-height: 40px;
}

.cm-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.cm-btn-primary {
    background: var(--cm-btn-primary-bg, #2563eb);
    color: var(--cm-btn-primary-text, #ffffff);
}

.cm-btn-primary:hover {
    filter: brightness(1.05);
}

.cm-btn-secondary {
    background: var(--cm-btn-secondary-bg, #f3f4f6);
    color: var(--cm-btn-secondary-text, #1a1a1a);
    border-color: rgba(0, 0, 0, 0.08);
}

.cm-btn-secondary:hover {
    filter: brightness(0.97);
}

/* ==========================================================================
   MODAL PREFERENCJI
   ========================================================================== */

.cm-preferences {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cm-preferences-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.cm-preferences-modal {
    position: relative;
    background: var(--cm-banner-bg, #ffffff);
    border-radius: 16px;
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: cm-fade-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.cm-preferences-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.cm-preferences-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cm-close {
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--cm-banner-text, #1a1a1a);
    opacity: 0.6;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

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

.cm-preferences-body {
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
}

.cm-preferences-intro {
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 20px 0;
    opacity: 0.85;
}

.cm-preferences-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.01);
}

/* ==========================================================================
   TABS
   ========================================================================== */

.cm-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    padding-bottom: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.cm-tabs-nav::-webkit-scrollbar {
    display: none;
}

.cm-tab-btn {
    background: transparent;
    border: none;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--cm-banner-text, #1a1a1a);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s ease;
    white-space: nowrap;
    font-family: inherit;
    opacity: 0.6;
    flex-shrink: 0;
}

.cm-tab-btn:hover {
    opacity: 1;
}

.cm-tab-btn.active {
    color: var(--cm-accent, #2563eb);
    border-bottom-color: var(--cm-accent, #2563eb);
    opacity: 1;
}

.cm-tab-panel {
    display: none;
    animation: cm-fade-in 0.2s ease;
}

.cm-tab-panel.active {
    display: block;
}

.cm-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 16px;
}

.cm-category-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.cm-category-description {
    font-size: 13px;
    line-height: 1.6;
    margin: 0 0 20px 0;
    opacity: 0.8;
}

/* ==========================================================================
   SWITCH (TOGGLE)
   ========================================================================== */

.cm-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.cm-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cm-slider {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 24px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.cm-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cm-switch input:checked + .cm-slider {
    background: var(--cm-accent, #2563eb);
}

.cm-switch input:checked + .cm-slider::before {
    transform: translateX(20px);
}

.cm-switch input:disabled + .cm-slider {
    opacity: 0.6;
    cursor: not-allowed;
}

.cm-switch-label {
    font-size: 12px;
    opacity: 0.7;
}

/* ==========================================================================
   TABELA COOKIES
   ========================================================================== */

.cm-cookies-table-wrapper {
    margin-top: 20px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    padding: 16px;
}

.cm-cookies-table-wrapper h4 {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

.cm-cookies-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.cm-cookies-table th {
    text-align: left;
    padding: 8px 10px;
    font-weight: 600;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

.cm-cookies-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    vertical-align: top;
}

.cm-cookies-table tr:last-child td {
    border-bottom: none;
}

.cm-cookies-table code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
    word-break: break-all;
}

.cm-no-cookies {
    padding: 20px;
    text-align: center;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    margin: 20px 0 0 0;
    font-size: 13px;
    opacity: 0.7;
}

/* ==========================================================================
   FLOATING BUTTON
   ========================================================================== */

.cm-floating-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--cm-btn-primary-bg, #2563eb);
    color: var(--cm-btn-primary-text, #ffffff);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 999997;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cm-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* ==========================================================================
   MOTYW DARK
   ========================================================================== */

.cm-banner.cm-theme-dark,
.cm-theme-dark .cm-preferences-modal {
    background: #1a1a1a;
    color: #f1f5f9;
}

.cm-theme-dark .cm-banner-message,
.cm-theme-dark .cm-category-description,
.cm-theme-dark .cm-preferences-intro {
    color: #cbd5e1;
}

.cm-theme-dark .cm-cookies-table-wrapper {
    background: rgba(255, 255, 255, 0.04);
}

.cm-theme-dark .cm-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
    border-color: rgba(255, 255, 255, 0.1);
}

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

@media (max-width: 768px) {
    .cm-banner.cm-layout-bottom_bar .cm-banner-inner {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }

    .cm-banner.cm-layout-bottom_bar .cm-banner-actions {
        flex-direction: column;
    }

    .cm-banner.cm-layout-bottom_bar .cm-banner-actions .cm-btn {
        width: 100%;
    }

    .cm-banner.cm-layout-floating {
        left: 16px !important;
        right: 16px !important;
        max-width: none;
        bottom: 16px;
    }

    .cm-preferences-modal {
        max-height: 95vh;
    }

    .cm-preferences-header,
    .cm-preferences-body,
    .cm-preferences-footer {
        padding: 16px;
    }

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

    .cm-preferences-footer .cm-btn {
        width: 100%;
    }

    .cm-cookies-table {
        font-size: 11px;
    }

    .cm-cookies-table th,
    .cm-cookies-table td {
        padding: 6px 8px;
    }

    .cm-floating-btn {
        bottom: 16px;
        left: 16px;
    }

    .cm-banner-title {
        font-size: 16px;
    }

    .cm-tabs-nav {
        gap: 2px;
    }

    .cm-tab-btn {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* Public cookies table (shortcode) */
.cm-public-cookies-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 20px 0;
}

.cm-public-cookies-table th,
.cm-public-cookies-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.cm-public-cookies-table th {
    background: #f9fafb;
    font-weight: 600;
}

.cm-public-cookies-table code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}
