/* ===================================================================
   MJAD Consent Manager — Frontend Styles
   All colors come from CSS custom properties set by PHP.
   =================================================================== */

/* ── Reset / base ─────────────────────────────────────────────── */
.mjad-consent *,
.mjad-modal * {
    box-sizing: border-box;
}

/* ── Banner wrapper ───────────────────────────────────────────── */
.mjad-consent {
    position: fixed;
    z-index: 999999;
    background: var(--mjad-bg);
    color: var(--mjad-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    transition: transform .3s ease, opacity .3s ease;
}

.mjad-consent[hidden] {
    display: none !important;
}

/* Positions */
.mjad-bottom-bar {
    bottom: 0;
    left: 0;
    right: 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,.25);
}

.mjad-bottom-left,
.mjad-bottom-right {
    bottom: 20px;
    max-width: 420px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.3);
}
.mjad-bottom-left  { left: 20px; }
.mjad-bottom-right { right: 20px; }

.mjad-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 520px;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,.4);
}

/* Inner padding */
.mjad-inner {
    padding: 18px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.mjad-bottom-bar .mjad-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* Typography */
.mjad-title {
    font-weight: 700;
    font-size: 15px;
    margin: 0 0 6px;
}

.mjad-bottom-bar .mjad-title {
    width: 100%;
}

.mjad-body {
    margin: 0;
    flex: 1;
    min-width: 200px;
}

.mjad-links {
    font-size: 12px;
    margin: 6px 0 0;
    width: 100%;
}

.mjad-links a,
.mjad-consent a {
    color: var(--mjad-link);
    text-decoration: underline;
}

.mjad-powered {
    font-size: 11px;
    color: var(--mjad-link);
    display: block;
    margin-top: 8px;
    opacity: .7;
}
.mjad-powered a { color: inherit; }

/* ── Action buttons ───────────────────────────────────────────── */
.mjad-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    flex-shrink: 0;
}

.mjad-btn {
    display: inline-block;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition: opacity .15s, filter .15s;
    white-space: nowrap;
}
.mjad-btn:hover   { opacity: .85; }
.mjad-btn:focus   { outline: 2px solid var(--mjad-btn-accept-bg); outline-offset: 2px; }
.mjad-btn:active  { filter: brightness(.92); }

.mjad-btn-accept {
    background: var(--mjad-btn-accept-bg);
    color:      var(--mjad-btn-accept-fg);
    border-color: var(--mjad-btn-accept-bg);
}

.mjad-btn-reject {
    background: var(--mjad-btn-reject-bg);
    color:      var(--mjad-btn-reject-fg);
    border-color: var(--mjad-btn-reject-bg);
}

.mjad-btn-manage {
    background:   var(--mjad-btn-manage-bg);
    color:        var(--mjad-btn-manage-fg);
    border-color: var(--mjad-btn-manage-bd);
}

/* ── Overlay ──────────────────────────────────────────────────── */
.mjad-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.mjad-overlay[hidden] { display: none !important; }

/* ── Modal ────────────────────────────────────────────────────── */
.mjad-modal {
    background: var(--mjad-modal-bg);
    color:      var(--mjad-modal-text);
    border-radius: 10px;
    padding: 28px 32px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 8px 40px rgba(0,0,0,.35);
}

.mjad-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--mjad-modal-text);
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}
.mjad-modal-close:hover { background: rgba(0,0,0,.08); }

.mjad-modal-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--mjad-modal-text);
}

.mjad-modal-intro {
    font-size: 13px;
    margin: 0 0 20px;
    opacity: .8;
}

/* ── Category rows ────────────────────────────────────────────── */
.mjad-cat-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(0,0,0,.1);
}
.mjad-cat-row:last-of-type { border-bottom: none; }

.mjad-cat-info strong {
    display: block;
    font-size: 14px;
    margin-bottom: 3px;
    color: var(--mjad-modal-text);
}
.mjad-cat-info p {
    margin: 0;
    font-size: 12px;
    opacity: .75;
    color: var(--mjad-modal-text);
}

/* ── Toggle switch ────────────────────────────────────────────── */
.mjad-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

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

.mjad-toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 24px;
    cursor: pointer;
    transition: background .2s;
}

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

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

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

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

.mjad-toggle-locked {
    opacity: .5;
    cursor: not-allowed;
}

/* ── Modal footer ─────────────────────────────────────────────── */
.mjad-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
    flex-wrap: wrap;
}

/* ── Animation ────────────────────────────────────────────────── */
@keyframes mjadSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
@keyframes mjadFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.mjad-bottom-bar.mjad-visible  { animation: mjadSlideUp .35s ease forwards; }
.mjad-bottom-left.mjad-visible,
.mjad-bottom-right.mjad-visible,
.mjad-center.mjad-visible      { animation: mjadFadeIn .3s ease forwards; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 600px) {
    .mjad-bottom-bar .mjad-inner { flex-direction: column; align-items: flex-start; }
    .mjad-actions { width: 100%; }
    .mjad-btn { width: 100%; text-align: center; padding: 11px; }
    .mjad-bottom-left,
    .mjad-bottom-right { left: 10px; right: 10px; bottom: 10px; max-width: none; }
    .mjad-modal { padding: 20px 18px; }
}
