/* =============================================================
   Cookie Shield – Frontend Styles v2.0
   ============================================================= */

/* ----- Banner ----- */
.cs-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -4px 24px rgba(0,0,0,.12);
    z-index: 999998;
    padding: 20px 0;
    transform: translateY(0);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.cs-backdrop { display: none; }

.cs-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cs-content {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.cs-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.cs-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 6px;
}

.cs-description {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    line-height: 1.55;
}

.cs-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ----- Shared buttons ----- */
.cs-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity .15s, box-shadow .15s;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.cs-btn:focus-visible {
    outline: 3px solid var(--banner-color, #3b82f6);
    outline-offset: 2px;
}

.cs-btn-accept-all {
    color: #fff;
    background: var(--banner-color, #3b82f6);
}

.cs-btn-accept-all:hover { opacity: .88; }

.cs-btn-reject-all,
.cs-btn-customize {
    background: #f3f4f6;
    color: #374151;
}

.cs-btn-reject-all:hover,
.cs-btn-customize:hover {
    background: #e5e7eb;
}

/* ----- Modal ----- */
.cs-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.cs-modal[hidden] { display: none !important; }

.cs-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(2px);
}

.cs-modal-box {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cs-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.cs-modal-header h2 {
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.cs-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color .15s, background .15s;
}

.cs-modal-close:hover {
    color: #374151;
    background: #f3f4f6;
}

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

.cs-modal-intro {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 18px;
    line-height: 1.55;
}

/* ----- Cookie category groups ----- */
.cs-cookie-group {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
    transition: border-color .15s;
}

.cs-cookie-group:last-child { margin-bottom: 0; }

.cs-cookie-group:hover { border-color: #d1d5db; }

.cs-cookie-group--required {
    background: #f9fafb;
}

.cs-cookie-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.cs-cookie-group-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cs-cookie-icon {
    font-size: 20px;
    line-height: 1;
}

.cs-cookie-group h3 {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 3px;
}

.cs-cookie-desc {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
    line-height: 1.55;
}

.cs-badge--required {
    display: inline-block;
    background: #dcfce7;
    color: #166534;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
}

/* ----- Toggle switch ----- */
.cs-toggle {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 24px;
}

.cs-toggle input[type=checkbox] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

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

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

.cs-toggle input:checked + .cs-toggle-slider {
    background: var(--banner-color, #3b82f6);
}

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

.cs-toggle--disabled .cs-toggle-slider {
    background: var(--banner-color, #3b82f6);
    cursor: not-allowed;
    opacity: .6;
}

/* ----- Modal footer ----- */
.cs-modal-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cs-btn-save-prefs {
    color: #fff;
}

.cs-btn-save-prefs:hover { opacity: .88; }

/* ----- Prevent body scroll when modal open ----- */
body.cs-modal-open { overflow: hidden; }

/* ----- Responsive ----- */
@media (min-width: 768px) {
    .cs-container {
        flex-direction: row;
        align-items: center;
    }

    .cs-content { flex: 1; }

    .cs-actions {
        flex: 0 0 auto;
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 767px) {
    .cs-banner { padding: 14px 0; }

    .cs-actions { flex-direction: column; }

    .cs-btn { width: 100%; }

    .cs-modal-footer { justify-content: stretch; }

    .cs-modal-footer .cs-btn { flex: 1; }
}

/* ----- Cookie details expandable table ----- */
.cs-cookie-details {
    margin-top: 10px;
}

.cs-cookie-details summary {
    font-size: 12px;
    color: var(--banner-color, #3b82f6);
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
}

.cs-cookie-details summary:hover {
    text-decoration: underline;
}

.cs-cookie-table-wrap {
    overflow-x: auto;
    margin-top: 8px;
}

.cs-cookie-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.cs-cookie-table th,
.cs-cookie-table td {
    text-align: left;
    padding: 5px 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.cs-cookie-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.cs-cookie-table td code {
    font-size: 11px;
    background: #f3f4f6;
    padding: 1px 4px;
    border-radius: 3px;
    word-break: break-all;
}

.cs-cookie-count {
    font-size: 12px;
    font-weight: 400;
    color: #9ca3af;
}

/* ----- Banner visibility states (for re-open via shortcode) ----- */
.cs-banner--hidden {
    transform: translateY(100%);
    pointer-events: none;
}

/* ----- Banner description — allow HTML from wp_editor ----- */
.cs-description a {
    color: var(--banner-color, #3b82f6);
    text-decoration: underline;
}

.cs-description a:hover {
    opacity: 0.8;
}

/* ----- Shortcode trigger element ----- */
.cs-preferences-trigger {
    cursor: pointer;
    text-decoration: underline;
    color: inherit;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    display: inline;
}

.cs-preferences-trigger:hover {
    opacity: 0.75;
}

/* ----- Blocked iframe placeholder ----- */
.cs-iframe-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 24px 16px;
    min-height: 120px;
    text-align: center;
    font-family: inherit;
}

.cs-iframe-placeholder__msg {
    color: #6b7280;
    font-size: 14px;
    margin: 0;
}

.cs-iframe-placeholder__msg strong {
    color: #374151;
}
