/**
 * Apollo Cookie Consent — Frontend Styles v1.0.0
 */

/* ─── Custom Properties ───────────────────────────────────────────────────── */

.acc-banner,
.acc-reopen {
    --acc-accent: #3B82F6;
    --acc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --acc-transition: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Dark Theme ──────────────────────────────────────────────────────────── */

.acc-theme-dark {
    --acc-bg: rgba(17, 17, 17, 0.97);
    --acc-text: #d4d4d4;
    --acc-text-muted: #a0a0a0;
    --acc-border: rgba(255, 255, 255, 0.08);
    --acc-surface: rgba(255, 255, 255, 0.05);
    --acc-surface-hover: rgba(255, 255, 255, 0.08);
    --acc-btn-secondary-bg: rgba(255, 255, 255, 0.08);
    --acc-btn-secondary-hover: rgba(255, 255, 255, 0.14);
    --acc-btn-secondary-text: #e0e0e0;
}

/* ─── Light Theme ─────────────────────────────────────────────────────────── */

.acc-theme-light {
    --acc-bg: rgba(255, 255, 255, 0.98);
    --acc-text: #374151;
    --acc-text-muted: #6b7280;
    --acc-border: rgba(0, 0, 0, 0.08);
    --acc-surface: rgba(0, 0, 0, 0.03);
    --acc-surface-hover: rgba(0, 0, 0, 0.06);
    --acc-btn-secondary-bg: rgba(0, 0, 0, 0.06);
    --acc-btn-secondary-hover: rgba(0, 0, 0, 0.1);
    --acc-btn-secondary-text: #374151;
}

/* ─── Banner ──────────────────────────────────────────────────────────────── */

.acc-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    font-family: var(--acc-font);
    font-size: 13px;
    line-height: 1.5;
    color: var(--acc-text);
    background: var(--acc-bg);
    border-top: 1px solid var(--acc-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(100%);
    opacity: 0;
    transition: transform var(--acc-transition), opacity var(--acc-transition);
    box-sizing: border-box;
}

.acc-banner *,
.acc-banner *::before,
.acc-banner *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.acc-banner.acc-visible {
    transform: translateY(0);
    opacity: 1;
}

.acc-banner.acc-hiding {
    transform: translateY(100%);
    opacity: 0;
}

/* ─── Banner Inner ────────────────────────────────────────────────────────── */

.acc-banner-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 14px 24px;
}

@media (max-width: 768px) {
    .acc-banner-inner {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
        text-align: center;
    }
}

/* ─── Content ─────────────────────────────────────────────────────────────── */

.acc-content {
    flex: 1;
    min-width: 0;
}

.acc-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--acc-text);
    letter-spacing: -0.01em;
    margin-bottom: 2px !important;
}

.acc-text {
    font-size: 12.5px;
    color: var(--acc-text-muted);
    line-height: 1.55;
}

.acc-privacy-link {
    color: var(--acc-accent);
    text-decoration: none;
    margin-left: 4px;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.acc-privacy-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ─── Actions ─────────────────────────────────────────────────────────────── */

.acc-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .acc-actions {
        width: 100%;
        justify-content: center;
    }
}

/* Banner buttons — use high specificity + !important on dimensional/typographic
   props so theme `button{}` resets can't stretch or uppercase them. */
.acc-banner .acc-btn,
button.acc-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 7px 16px !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    font-family: var(--acc-font) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    letter-spacing: 0.01em !important;
    text-transform: none !important;
    white-space: nowrap !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s ease;
    box-sizing: border-box !important;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    overflow: visible;
}

.acc-btn:focus-visible {
    outline: 2px solid var(--acc-accent);
    outline-offset: 2px;
}

.acc-btn-accept {
    background: var(--acc-accent);
    color: #fff;
}

.acc-btn-accept:hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.acc-btn-reject {
    background: var(--acc-btn-secondary-bg);
    color: var(--acc-btn-secondary-text);
}

.acc-btn-reject:hover {
    background: var(--acc-btn-secondary-hover);
}

.acc-btn-settings {
    background: transparent;
    color: var(--acc-text-muted);
    padding: 7px 12px !important;
}

.acc-btn-settings:hover {
    color: var(--acc-text);
    background: var(--acc-surface);
}

.acc-btn-save {
    background: var(--acc-accent);
    color: #fff;
    padding: 8px 24px !important;
}

.acc-btn-save:hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ─── Preferences Panel ───────────────────────────────────────────────────── */

.acc-preferences {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--acc-transition), padding var(--acc-transition);
    border-top: 0 solid var(--acc-border);
}

.acc-preferences.acc-prefs-open {
    max-height: 500px;
    overflow-y: auto;
    border-top-width: 1px;
}

.acc-preferences-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px 20px;
}

@media (max-width: 768px) {
    .acc-preferences-inner {
        padding: 14px 16px 18px;
    }
}

.acc-preferences-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--acc-text);
    margin-bottom: 4px !important;
}

.acc-preferences-desc {
    font-size: 12px;
    color: var(--acc-text-muted);
    line-height: 1.5;
    margin-bottom: 14px !important;
}

/* ─── Categories ──────────────────────────────────────────────────────────── */

.acc-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

@media (max-width: 640px) {
    .acc-categories {
        grid-template-columns: 1fr;
    }
}

.acc-category {
    background: var(--acc-surface);
    border-radius: 8px;
    padding: 12px 14px;
    transition: background 0.2s ease;
}

.acc-category:hover {
    background: var(--acc-surface-hover);
}

.acc-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.acc-category-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.acc-category-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--acc-text);
}

.acc-badge-required {
    display: inline-block;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 500;
    color: var(--acc-accent);
    border: 1px solid var(--acc-accent);
    border-radius: 3px;
    letter-spacing: 0.02em;
    opacity: 0.8;
}

.acc-category-desc {
    font-size: 11.5px;
    color: var(--acc-text-muted);
    line-height: 1.5;
    margin-bottom: 4px !important;
}

.acc-category-cookies {
    font-size: 10.5px;
    color: var(--acc-text-muted);
    opacity: 0.7;
}

.acc-category-cookies strong {
    font-weight: 600;
}

/* ─── Toggle ──────────────────────────────────────────────────────────────── */

.acc-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
}

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

.acc-toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--acc-btn-secondary-bg);
    border-radius: 10px;
    transition: background 0.25s ease;
}

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

.acc-toggle-input:checked + .acc-toggle-slider {
    background: var(--acc-accent);
}

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

.acc-toggle-input:focus-visible + .acc-toggle-slider {
    outline: 2px solid var(--acc-accent);
    outline-offset: 2px;
}

/* ─── Preferences Actions ─────────────────────────────────────────────────── */

.acc-preferences-actions {
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .acc-preferences-actions {
        justify-content: center;
    }
}

/* ─── Re-open Button ──────────────────────────────────────────────────────── */

/* Floating re-open button — hardened against theme button-resets. The button
   lives on arbitrary sites whose themes commonly set padding/width/height on
   every `button`. We lock dimensions with !important and use ID specificity
   to beat most theme selectors, then explicitly size the child SVG so it
   can't collapse to 0px when the theme enforces `svg { width:100% }`. */
button#acc-reopen,
.acc-reopen {
    position: fixed !important;
    bottom: 16px !important;
    left: 16px !important;
    z-index: 999998;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: var(--acc-bg) !important;
    border: 1px solid var(--acc-border) !important;
    border-radius: 50% !important;
    color: var(--acc-text-muted);
    cursor: pointer !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.25s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0.6;
    box-sizing: border-box !important;
    line-height: 1 !important;
    font-size: 16px !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    white-space: nowrap !important;
    overflow: visible !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

/* Child icon — explicit dimensions so it can't get squashed or stretched by
   global `svg { width:100%; max-width:100% }` rules common in modern themes. */
.acc-reopen > svg,
button#acc-reopen > svg {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    min-height: 16px !important;
    max-height: 16px !important;
    flex: 0 0 16px !important;
    flex-shrink: 0 !important;
    display: block !important;
    fill: none;
}

.acc-reopen:hover {
    opacity: 1;
    color: var(--acc-accent);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

/* ─── SR Only ─────────────────────────────────────────────────────────────── */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
