/* ==========================================================================
   GXA Cookie Consent — Frontend styles
   ========================================================================== */

:root {
    --gxa-color-primary: #1e3a5f;
    --gxa-color-primary-hover: #162d4a;
    --gxa-color-text: #1a1a1a;
    --gxa-color-text-muted: #555;
    --gxa-color-bg: #ffffff;
    --gxa-color-bg-muted: #f5f5f5;
    --gxa-color-border: #ddd;
    --gxa-color-toggle-off: #ccc;
    --gxa-color-toggle-on: var(--gxa-color-primary);
    --gxa-radius: 6px;
    --gxa-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    --gxa-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --gxa-transition: 0.2s ease;
    --gxa-z-banner: 999999;
    --gxa-z-modal: 1000000;
}

@media (prefers-color-scheme: dark) {
    :root {
        --gxa-color-text: #f0f0f0;
        --gxa-color-text-muted: #aaa;
        --gxa-color-bg: #1e1e1e;
        --gxa-color-bg-muted: #2a2a2a;
        --gxa-color-border: #444;
        --gxa-color-toggle-off: #555;
    }
}

/* ==========================================================================
   Banner
   ========================================================================== */

#gxa-cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: var(--gxa-z-banner);
    background: var(--gxa-color-bg);
    border-top: 3px solid var(--gxa-color-primary);
    box-shadow: var(--gxa-shadow);
    font-family: var(--gxa-font);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

#gxa-cookie-banner.gxa-banner--bottom { bottom: 0; border-top: 3px solid var(--gxa-color-primary); border-bottom: none; }
#gxa-cookie-banner.gxa-banner--top    { top: 0;    border-bottom: 3px solid var(--gxa-color-primary); border-top: none; }

.gxa-banner-inner {
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
}

#gxa-cookie-banner h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--gxa-color-text);
    line-height: 1.4;
}

#gxa-cookie-banner p {
    font-size: 0.875rem;
    color: var(--gxa-color-text-muted);
    margin: 0 0 12px;
    line-height: 1.5;
}

.gxa-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#gxa-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: var(--gxa-color-text-muted);
    padding: 4px 8px;
    flex-shrink: 0;
    align-self: flex-start;
    border-radius: var(--gxa-radius);
}

#gxa-close:hover,
#gxa-close:focus-visible {
    color: var(--gxa-color-text);
    outline: 2px solid var(--gxa-color-primary);
    outline-offset: 2px;
}

/* ==========================================================================
   Buttons — equal visual weight for accept and reject
   ========================================================================== */

.gxa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--gxa-radius);
    font-family: var(--gxa-font);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    border: 2px solid var(--gxa-color-primary);
    transition: background var(--gxa-transition), color var(--gxa-transition), opacity var(--gxa-transition);
    text-decoration: none;
    white-space: nowrap;
}

.gxa-btn:focus-visible {
    outline: 3px solid var(--gxa-color-primary);
    outline-offset: 3px;
}

.gxa-btn--primary {
    background: var(--gxa-color-primary);
    color: #fff;
}

.gxa-btn--primary:hover {
    background: var(--gxa-color-primary-hover);
    border-color: var(--gxa-color-primary-hover);
}

.gxa-btn--secondary {
    background: transparent;
    color: var(--gxa-color-primary);
}

.gxa-btn--secondary:hover {
    background: var(--gxa-color-primary);
    color: #fff;
}

/* ==========================================================================
   Modal overlay
   ========================================================================== */

#gxa-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--gxa-z-modal);
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-family: var(--gxa-font);
}

#gxa-modal-overlay[hidden] {
    display: none;
}

.gxa-modal {
    background: var(--gxa-color-bg);
    border-radius: var(--gxa-radius);
    box-shadow: var(--gxa-shadow);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gxa-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--gxa-color-border);
    flex-shrink: 0;
}

.gxa-modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--gxa-color-text);
}

.gxa-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--gxa-color-text-muted);
    padding: 4px 8px;
    border-radius: var(--gxa-radius);
}

.gxa-modal-close:hover,
.gxa-modal-close:focus-visible {
    color: var(--gxa-color-text);
    outline: 2px solid var(--gxa-color-primary);
    outline-offset: 2px;
}

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

.gxa-modal-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--gxa-color-border);
    flex-shrink: 0;
    justify-content: flex-end;
}

/* ==========================================================================
   Category rows
   ========================================================================== */

.gxa-category-row {
    border-bottom: 1px solid var(--gxa-color-border);
    padding: 16px 0;
}

.gxa-category-row:last-child {
    border-bottom: none;
}

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

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

.gxa-category-info strong {
    display: block;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--gxa-color-text);
    margin-bottom: 4px;
}

.gxa-category-info p {
    font-size: 0.8125rem;
    color: var(--gxa-color-text-muted);
    margin: 0;
    line-height: 1.5;
}

.gxa-always-on {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gxa-color-primary);
    white-space: nowrap;
    padding-top: 2px;
}

/* ==========================================================================
   Toggle switch
   ========================================================================== */

.gxa-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.gxa-toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--gxa-color-toggle-off);
    border-radius: 24px;
    cursor: pointer;
    transition: background var(--gxa-transition);
}

.gxa-toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--gxa-transition);
}

.gxa-toggle input:checked + .gxa-toggle-slider {
    background: var(--gxa-color-toggle-on);
}

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

.gxa-toggle input:focus-visible + .gxa-toggle-slider {
    outline: 3px solid var(--gxa-color-primary);
    outline-offset: 2px;
}

/* ==========================================================================
   Cookie list table (inside category rows)
   ========================================================================== */

.gxa-cookie-list {
    margin-top: 12px;
    overflow-x: auto;
}

.gxa-cookie-list table,
.gxa-cookie-declarations {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    color: var(--gxa-color-text-muted);
}

.gxa-cookie-list th,
.gxa-cookie-list td,
.gxa-cookie-declarations th,
.gxa-cookie-declarations td {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--gxa-color-border);
    vertical-align: top;
}

.gxa-cookie-list th,
.gxa-cookie-declarations th {
    font-weight: 600;
    color: var(--gxa-color-text);
    white-space: nowrap;
    background: var(--gxa-color-bg-muted);
}

.gxa-cookie-list code,
.gxa-cookie-declarations code {
    font-size: 0.8em;
    background: var(--gxa-color-bg-muted);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* ==========================================================================
   Shortcode cookie table (full declarations page)
   ========================================================================== */

.gxa-cookie-table-section {
    margin-bottom: 32px;
}

.gxa-cookie-table-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--gxa-color-text);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gxa-color-primary);
    display: inline-block;
}

/* ==========================================================================
   Shortcode settings widget
   ========================================================================== */

.gxa-settings-widget {
    border: 1px solid var(--gxa-color-border);
    border-radius: var(--gxa-radius);
    overflow: hidden;
    font-family: var(--gxa-font);
    max-width: 680px;
}

.gxa-widget-footer {
    justify-content: flex-start;
}

.gxa-widget-saved-msg {
    padding: 10px 24px;
    background: #eaffea;
    color: #1a6b1a;
    font-size: 0.875rem;
    border-top: 1px solid #c3e6c3;
}

@media (prefers-color-scheme: dark) {
    .gxa-widget-saved-msg {
        background: #1a3a1a;
        color: #7ecf7e;
        border-top-color: #2d5a2d;
    }
}

/* ==========================================================================
   Responsive — stack buttons below 480px
   ========================================================================== */

@media (max-width: 480px) {
    .gxa-banner-actions {
        flex-direction: column;
    }

    .gxa-banner-actions .gxa-btn {
        width: 100%;
    }

    .gxa-modal-footer {
        flex-direction: column;
    }

    .gxa-modal-footer .gxa-btn {
        width: 100%;
    }

    .gxa-widget-footer.gxa-modal-footer {
        flex-direction: column;
    }

    .gxa-widget-footer.gxa-modal-footer .gxa-btn {
        width: 100%;
    }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .gxa-toggle-slider,
    .gxa-toggle-slider::before,
    .gxa-btn {
        transition: none;
    }
}
