/**
 * ClinicIVF — Cookie Consent UI
 * GDPR / CCPA / LGPD / KVKK compliant
 */

/* ══ Banner ════════════════════════════════════════ */
#cookieConsent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #fff;
    border-top: 3px solid var(--teal, #1A5C5E);
    box-shadow: 0 -4px 24px rgba(0,0,0,.12);
    transform: translateY(100%);
    opacity: 0;
    transition: transform .4s cubic-bezier(.4,0,.2,1), opacity .4s;
    font-family: 'Inter', sans-serif;
}
#cookieConsent.visible {
    transform: translateY(0);
    opacity: 1;
}
.cc-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.cc-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}
.cc-icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 0.1rem;
}
.cc-text strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1C1C1C;
    margin-bottom: 0.2rem;
}
.cc-text p {
    font-size: 0.8rem;
    color: #555;
    margin: 0;
    line-height: 1.5;
}
.cc-text a {
    color: var(--teal, #1A5C5E);
    text-decoration: underline;
    font-weight: 500;
}
.cc-actions {
    display: flex;
    gap: 0.6rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    align-items: center;
}
.cc-btn {
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .2s;
    white-space: nowrap;
    font-family: inherit;
}
.cc-btn.cc-accept {
    background: var(--teal, #1A5C5E);
    color: #fff;
}
.cc-btn.cc-accept:hover { background: #2D7A7C; }
.cc-btn.cc-reject {
    background: #f0f0f0;
    color: #555;
    border: 1px solid #ddd;
}
.cc-btn.cc-reject:hover { background: #e0e0e0; }
.cc-btn.cc-settings {
    background: transparent;
    color: var(--teal, #1A5C5E);
    border: 1.5px solid var(--teal, #1A5C5E);
}
.cc-btn.cc-settings:hover {
    background: var(--teal, #1A5C5E);
    color: #fff;
}

/* ══ Overlay ═══════════════════════════════════════ */
.cookie-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99998;
    opacity: 0;
    transition: opacity .3s;
    backdrop-filter: blur(2px);
}
.cookie-overlay.active { opacity: 1; }

/* ══ Preferences Panel ══════════════════════════════ */
#cookiePanel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -48%) scale(.95);
    z-index: 100000;
    background: #fff;
    border-radius: 1.25rem;
    width: min(600px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    opacity: 0;
    transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .3s;
    font-family: 'Inter', sans-serif;
    -webkit-overflow-scrolling: touch;
}
#cookiePanel.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}
.cp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.75rem 1rem;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}
.cp-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    color: #1C1C1C;
}
.cp-close {
    background: #f0f0f0;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background .2s;
    line-height: 1;
}
.cp-close:hover { background: #ddd; }
.cp-body {
    padding: 1.25rem 1.75rem;
}
.cp-intro {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 1.25rem;
    line-height: 1.6;
}
.cp-intro a { color: var(--teal, #1A5C5E); text-decoration: underline; }
.cp-group {
    padding: 1.1rem 0;
    border-bottom: 1px solid #f0f0f0;
}
.cp-group:last-child { border-bottom: none; }
.cp-group-disabled { opacity: .55; }
.cp-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.cp-group-header strong {
    font-size: 0.9rem;
    color: #1C1C1C;
}
.cp-group p {
    font-size: 0.8rem;
    color: #666;
    margin: 0.35rem 0 0;
    line-height: 1.6;
}
.cp-details {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.35rem;
    font-style: italic;
}
.cp-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.4rem;
    background: #f0f0f0;
    color: #666;
}
.cp-badge.cp-always { background: #e6f4e6; color: #2a7a2a; }
.cp-badge.cp-not-used { background: #fff3e0; color: #b36a00; }

/* Toggle switch */
.cp-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}
.cp-toggle.cp-disabled { cursor: not-allowed; opacity: .7; }
.cp-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.cp-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 999px;
    transition: background .3s;
}
.cp-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .3s;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.cp-toggle input:checked + .cp-slider { background: var(--teal, #1A5C5E); }
.cp-toggle input:checked + .cp-slider::before { transform: translateX(20px); }

/* Panel footer */
.cp-footer {
    display: flex;
    gap: 0.65rem;
    padding: 1.25rem 1.75rem;
    border-top: 1px solid #eee;
    justify-content: flex-end;
    flex-wrap: wrap;
    position: sticky;
    bottom: 0;
    background: #fff;
}
.cp-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .2s;
    font-family: inherit;
}
.cp-btn.cp-accept  { background: var(--teal, #1A5C5E); color: #fff; }
.cp-btn.cp-accept:hover  { background: #2D7A7C; }
.cp-btn.cp-reject  { background: #f0f0f0; color: #555; border: 1px solid #ddd; }
.cp-btn.cp-reject:hover  { background: #e0e0e0; }
.cp-btn.cp-save    { background: transparent; color: var(--teal, #1A5C5E); border: 1.5px solid var(--teal, #1A5C5E); }
.cp-btn.cp-save:hover    { background: var(--teal, #1A5C5E); color: #fff; }

/* ══ Responsive ═════════════════════════════════════ */
@media (max-width: 768px) {
    .cc-inner { padding: 1rem 1.25rem; gap: 1rem; }
    .cc-actions { width: 100%; justify-content: flex-end; }
    .cc-btn { font-size: 0.75rem; padding: 0.5rem 0.9rem; }
    .cp-footer { justify-content: stretch; }
    .cp-btn { flex: 1; text-align: center; }
}
@media (max-width: 480px) {
    .cc-content { flex-direction: column; gap: 0.5rem; }
    .cc-icon { font-size: 1.5rem; }
    .cc-actions { gap: 0.5rem; }
    .cc-btn { font-size: 0.72rem; padding: 0.5rem 0.75rem; }
    #cookiePanel { border-radius: 1rem 1rem 0 0; top: auto; bottom: 0; left: 0; right: 0; transform: translateY(100%); width: 100%; max-height: 85vh; }
    #cookiePanel.active { transform: translateY(0); }
}
