/* Tro Cookie Banner */

/* Hide blocked iframes immediately via CSS — before JS runs */
iframe[data-tco-src] { display: none !important; }

/* Neutralize aspect-ratio wrappers (::before padding trick) of blocked iframes.
   Covers Gutenberg (.wp-block-embed__wrapper), Elementor and any other wrapper. */
*:has(> iframe[data-tco-src]) {
    padding-top:    0 !important;
    padding-bottom: 0 !important;
}
*:has(> iframe[data-tco-src])::before,
*:has(> iframe[data-tco-src])::after {
    content: none  !important;
    display: none  !important;
    padding: 0     !important;
}

:root {
    --tco-primary:  #2271b1;
    --tco-bg:       #ffffff;
    --tco-text:     #1d2327;
    --tco-radius:   8px;
    --tco-overlay:  rgba(0,0,0,0.5);
    --tco-shadow:   0 4px 32px rgba(0,0,0,0.18);
    --tco-border:   #e0e0e0;
    --tco-toggle-off: #c9c9c9;
}

/* Overlay */
#tco-overlay {
    position: fixed;
    inset: 0;
    background: var(--tco-overlay);
    z-index: 99998;
    opacity: 0;
    transition: opacity 0.25s;
}
#tco-overlay.tco-visible { opacity: 1; }

/* Banner wrapper */
#tco-banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 99999;
    display: flex;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
}
#tco-banner.tco-pos-bottom  { bottom: 0; transform: translateY(20px); }
#tco-banner.tco-pos-top     { top: 0;    transform: translateY(-20px); }
#tco-banner.tco-pos-center  {
    top: 50%; bottom: auto;
    transform: translateY(calc(-50% + 16px));
}
#tco-banner.tco-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
#tco-banner.tco-pos-center.tco-visible {
    transform: translateY(-50%);
}

/* Banner box */
.tco-box {
    background: var(--tco-bg);
    color: var(--tco-text);
    border-radius: var(--tco-radius);
    box-shadow: var(--tco-shadow);
    padding: 24px 28px;
    max-width: 680px;
    width: 100%;
    box-sizing: border-box;
}

/* Header */
.tco-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.tco-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--tco-text);
    line-height: 1.3;
}

/* Body text */
.tco-body {
    font-size: 13px;
    line-height: 1.6;
    color: var(--tco-text);
    margin-bottom: 16px;
    opacity: 0.85;
}

/* Links row */
.tco-links {
    font-size: 12px;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.tco-links a {
    color: var(--tco-primary);
    text-decoration: none;
}
.tco-links a:hover { text-decoration: underline; }

/* Button row */
.tco-btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.tco-btn {
    padding: 9px 18px;
    border-radius: var(--tco-radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: opacity 0.15s, background 0.15s;
    line-height: 1;
}
.tco-btn:hover { opacity: 0.88; }
.tco-btn-primary {
    background: var(--tco-primary);
    color: #fff;
    border-color: var(--tco-primary);
}
.tco-btn-outline {
    background: transparent;
    color: var(--tco-primary);
    border-color: var(--tco-primary);
}
.tco-btn-ghost {
    background: transparent;
    color: var(--tco-text);
    border-color: var(--tco-border);
}

/* Settings panel (categories) */
.tco-settings-panel {
    display: none;
    margin-top: 16px;
    border-top: 1px solid var(--tco-border);
    padding-top: 16px;
}
.tco-settings-panel.tco-open { display: block; }

.tco-category {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--tco-border);
}
.tco-category:last-child { border-bottom: none; }
.tco-category-info { flex: 1; min-width: 0; }
.tco-category-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 3px;
}
.tco-category-desc {
    font-size: 12px;
    opacity: 0.7;
    line-height: 1.4;
}
.tco-category-services {
    font-size: 11px;
    opacity: 0.55;
    margin-top: 4px;
}

/* Always active badge */
.tco-always-active {
    font-size: 11px;
    font-weight: 600;
    color: #1b6b31;
    background: #d4f4dd;
    padding: 3px 8px;
    border-radius: 10px;
    white-space: nowrap;
    align-self: center;
}

/* Toggle switch */
.tco-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
    align-self: center;
}
.tco-toggle input { opacity: 0; width: 0; height: 0; }
.tco-toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--tco-toggle-off);
    border-radius: 22px;
    cursor: pointer;
    transition: background 0.2s;
}
.tco-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.tco-toggle input:checked + .tco-toggle-slider { background: var(--tco-primary); }
.tco-toggle input:checked + .tco-toggle-slider::before { transform: translateX(18px); }

/* Save button row */
.tco-save-row {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 480px) {
    .tco-box { padding: 18px 16px; }
    .tco-btn-row { flex-direction: column; }
    .tco-btn { width: 100%; text-align: center; }
}

/* Floating settings button */
#tco-float-btn {
    position: fixed;
    z-index: 99997;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--tco-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.15s, opacity 0.2s;
    opacity: 0;
    pointer-events: none;
}
#tco-float-btn.tco-float-visible {
    opacity: 1;
    pointer-events: auto;
}
#tco-float-btn:hover { transform: scale(1.1); }

#tco-float-btn svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}

/* Positions */
#tco-float-btn.tco-float-bottom-left  { bottom: 20px; left: 20px; }
#tco-float-btn.tco-float-bottom-right { bottom: 20px; right: 20px; }
#tco-float-btn.tco-float-top-left     { top: 20px;    left: 20px; }
#tco-float-btn.tco-float-top-right    { top: 20px;    right: 20px; }

/* iFrame placeholder */
.tco-iframe-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #f6f7f7;
    border: 2px dashed #c3c4c7;
    border-radius: var(--tco-radius);
    padding: 24px 16px;
    text-align: center;
    box-sizing: border-box;
    color: #50575e;
    font-family: sans-serif;
}
.tco-iframe-placeholder svg {
    width: 36px;
    height: 36px;
    opacity: 0.45;
}
.tco-iframe-placeholder-title {
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}
.tco-iframe-placeholder-desc {
    font-size: 12px;
    opacity: 0.75;
    max-width: 280px;
    line-height: 1.5;
}
.tco-iframe-placeholder-btn {
    padding: 7px 16px;
    border-radius: var(--tco-radius);
    background: var(--tco-primary);
    color: #fff;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.tco-iframe-placeholder-btn:hover { opacity: 0.85; }
