/* ============================================================
   EU Cookie Consent Pro - Frontend styles
   ============================================================ */

/* Overlay (когато е активиран) */
.eccp-overlay {
    position: fixed;
    inset: 0;
    background: var(--eccp-overlay-color, rgba(0,0,0,0.5));
    z-index: 999990;
    backdrop-filter: blur(2px);
}

/* ============================================================
   BANNER - основен box / banner
   ============================================================ */
.eccp-banner {
    position: fixed;
    z-index: 999999;
    max-width: 440px;
    width: calc(100% - 40px);
    background: var(--eccp-bg, #fff);
    color: var(--eccp-text, #1f2937);
    border-radius: var(--eccp-radius, 12px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid var(--eccp-border, #e5e7eb);
}

.eccp-banner-inner {
    padding: 24px;
    position: relative;
}

/* Положения */
.eccp-pos-bottom-left  { bottom: 20px; left: 20px; }
.eccp-pos-bottom-right { bottom: 20px; right: 20px; }
.eccp-pos-bottom-center{ bottom: 20px; left: 50%; transform: translateX(-50%); }
.eccp-pos-top-center   { top: 20px; left: 50%; transform: translateX(-50%); }

/* Layout: banner (full-width) */
.eccp-layout-banner.eccp-banner {
    max-width: 100%;
    width: calc(100% - 40px);
    left: 20px;
    right: 20px;
    transform: none;
}
.eccp-layout-banner.eccp-pos-top-center { top: 20px; left: 20px; }
.eccp-layout-banner.eccp-pos-bottom-center { bottom: 20px; left: 20px; }
.eccp-layout-banner .eccp-banner-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
}
.eccp-layout-banner .eccp-buttons {
    margin-top: 0;
    flex-wrap: nowrap;
}

/* Заглавие и текст */
.eccp-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--eccp-text, #1f2937);
    line-height: 1.3;
}

.eccp-text {
    font-size: 13px;
    color: var(--eccp-muted, #6b7280);
    margin: 0 0 12px 0;
}

.eccp-links {
    font-size: 12px;
    margin: 0 0 16px 0;
}

.eccp-links a {
    color: var(--eccp-primary, #9333ea);
    text-decoration: none;
}

.eccp-links a:hover {
    text-decoration: underline;
}

/* Затваряне (×) */
.eccp-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    width: 28px;
    height: 28px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--eccp-muted, #9ca3af);
    padding: 0;
    border-radius: 6px;
    transition: background .15s, color .15s;
}

.eccp-close:hover {
    background: var(--eccp-decline-bg, #f3f4f6);
    color: var(--eccp-text, #1f2937);
}

/* Бутони */
.eccp-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.eccp-btn {
    flex: 1;
    min-width: 0;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s ease;
    font-family: inherit;
    line-height: 1.2;
    white-space: nowrap;
}

.eccp-btn-primary {
    background: var(--eccp-primary, #9333ea);
    color: #fff;
}
.eccp-btn-primary:hover {
    background: var(--eccp-primary-hover, #7e22ce);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.eccp-btn-secondary {
    background: var(--eccp-decline-bg, #f3f4f6);
    color: var(--eccp-decline-text, #374151);
}
.eccp-btn-secondary:hover {
    background: var(--eccp-border, #e5e7eb);
}

.eccp-btn-ghost {
    background: transparent;
    color: var(--eccp-text, #1f2937);
    border: 1px solid var(--eccp-border, #e5e7eb);
}
.eccp-btn-ghost:hover {
    background: var(--eccp-decline-bg, #f3f4f6);
}

/* ============================================================
   ИКОНА (минимизирана)
   ============================================================ */
.eccp-icon {
    position: fixed;
    width: var(--eccp-icon-size, 48px);
    height: var(--eccp-icon-size, 48px);
    background: var(--eccp-primary, #9333ea);
    color: #fff;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    z-index: 999998;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: transform .2s ease, box-shadow .2s ease;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eccp-icon-bottom-left  { left: var(--eccp-icon-offset, 20px); bottom: var(--eccp-icon-offset, 20px); }
.eccp-icon-bottom-right { right: var(--eccp-icon-offset, 20px); bottom: var(--eccp-icon-offset, 20px); }

.eccp-icon:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,0.28);
}

.eccp-icon svg {
    width: 100%;
    height: 100%;
}

/* ============================================================
   МОДАЛ - детайлни настройки
   ============================================================ */
.eccp-modal {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.eccp-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.eccp-modal-inner {
    position: relative;
    background: var(--eccp-bg, #fff);
    color: var(--eccp-text, #1f2937);
    border-radius: var(--eccp-radius, 12px);
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
    overflow: hidden;
}

.eccp-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--eccp-border, #e5e7eb);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.eccp-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--eccp-text, #1f2937);
}

.eccp-modal-close {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    font-size: 24px;
    cursor: pointer;
    color: var(--eccp-muted, #6b7280);
    border-radius: 8px;
    transition: background .15s;
}

.eccp-modal-close:hover {
    background: var(--eccp-decline-bg, #f3f4f6);
    color: var(--eccp-text, #1f2937);
}

.eccp-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.eccp-modal-intro {
    font-size: 13px;
    color: var(--eccp-muted, #6b7280);
    margin: 0 0 20px 0;
}

.eccp-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--eccp-border, #e5e7eb);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.eccp-modal-footer .eccp-btn {
    flex: 1;
    min-width: 0;
}

/* Категории */
.eccp-categories {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.eccp-category {
    border: 1px solid var(--eccp-border, #e5e7eb);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color .15s;
}

.eccp-category-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
    background: var(--eccp-bg, #fff);
}

.eccp-category-title {
    flex: 1;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    padding: 0;
    font: inherit;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
}

.eccp-cat-name {
    font-weight: 500;
    font-size: 14px;
}

.eccp-required-badge {
    background: var(--eccp-decline-bg, #f3f4f6);
    color: var(--eccp-muted, #6b7280);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.eccp-chevron {
    margin-left: auto;
    color: var(--eccp-muted, #9ca3af);
    transition: transform .2s;
    font-size: 12px;
}

.eccp-category.is-open .eccp-chevron {
    transform: rotate(180deg);
}

.eccp-category-desc {
    padding: 0 16px 16px 16px;
    border-top: 1px solid var(--eccp-border, #e5e7eb);
    margin-top: 0;
}

.eccp-category-desc p {
    margin: 12px 0 0 0;
    font-size: 13px;
    color: var(--eccp-muted, #6b7280);
    line-height: 1.55;
}

/* Toggle switch */
.eccp-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

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

.eccp-toggle-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: #d1d5db;
    border-radius: 22px;
    transition: background .2s;
}

.eccp-toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.eccp-toggle input:checked + .eccp-toggle-slider {
    background: var(--eccp-primary, #9333ea);
}

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

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

/* ============================================================
   АНИМАЦИИ
   ============================================================ */
.eccp-anim-slide-up { animation: eccp-slide-up .35s cubic-bezier(0.16, 1, 0.3, 1); }
.eccp-anim-fade     { animation: eccp-fade .25s ease; }

@keyframes eccp-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.eccp-pos-bottom-center.eccp-anim-slide-up,
.eccp-pos-top-center.eccp-anim-slide-up {
    /* при центриране translateX-а в pos класовете трябва да се запази */
}
@keyframes eccp-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Hiding */
.eccp-banner.eccp-hiding {
    animation: eccp-slide-down .25s ease forwards;
}
@keyframes eccp-slide-down {
    to { opacity: 0; transform: translateY(20px); }
}

/* ============================================================
   ТЪМНА ТЕМА
   ============================================================ */
.eccp-theme-dark {
    --eccp-bg: #1f2937;
    --eccp-text: #f9fafb;
    --eccp-muted: #9ca3af;
    --eccp-border: #374151;
    --eccp-decline-bg: #374151;
    --eccp-decline-text: #f9fafb;
}

@media (prefers-color-scheme: dark) {
    .eccp-theme-auto {
        --eccp-bg: #1f2937;
        --eccp-text: #f9fafb;
        --eccp-muted: #9ca3af;
        --eccp-border: #374151;
        --eccp-decline-bg: #374151;
        --eccp-decline-text: #f9fafb;
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
    .eccp-banner {
        max-width: calc(100% - 24px);
        width: calc(100% - 24px);
    }
    .eccp-pos-bottom-left,
    .eccp-pos-bottom-right,
    .eccp-pos-bottom-center {
        bottom: 12px;
        left: 12px;
        right: 12px;
        transform: none;
    }
    .eccp-pos-top-center {
        top: 12px;
        left: 12px;
        right: 12px;
        transform: none;
    }
    .eccp-banner-inner { padding: 20px; }
    .eccp-buttons { flex-wrap: wrap; }
    .eccp-btn { flex: 1 1 calc(50% - 4px); }
    .eccp-layout-banner .eccp-banner-inner {
        grid-template-columns: 1fr;
    }
    .eccp-modal { padding: 0; }
    .eccp-modal-inner {
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }
    .eccp-modal-footer { flex-direction: column; }
    .eccp-modal-footer .eccp-btn { width: 100%; }
}

/* Намалена motion */
@media (prefers-reduced-motion: reduce) {
    .eccp-anim-slide-up, .eccp-anim-fade, .eccp-banner.eccp-hiding {
        animation: none;
    }
    .eccp-btn:hover { transform: none; }
}
