/* ==========================================================================
   COOKIE CONSENT SYSTEM - 2026 GDPR/KVKK Uyumlu
   ========================================================================== */

/* --- Ana Banner Stilleri --- */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 1.25rem 0;
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    max-height: 100vh;
    max-height: 100dvh;
    max-height: var(--visual-viewport-height, 100dvh);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.cookie-consent-banner.show {
    transform: translateY(0);
}

.cookie-consent-banner .container {
    max-width: 1400px;
    margin: 0 auto;
    padding-left: calc(1.5rem + env(safe-area-inset-left, 0px)) !important;
    padding-right: calc(1.5rem + env(safe-area-inset-right, 0px)) !important;
}

.cookie-banner-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

@media (min-width: 992px) {
    .cookie-banner-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* --- Banner Text --- */
.cookie-banner-text {
    flex: 1;
}

.cookie-banner-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cookie-banner-title i {
    font-size: 1.25rem;
    color: #ffc107;
}

.cookie-banner-description {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
    margin: 0;
}

.cookie-banner-description a {
    color: #64b5f6;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cookie-banner-description a:hover {
    color: #90caf9;
}

.cookie-desc-short {
    display: none;
}

.cookie-link-customize {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: #2f6f95;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.cookie-link-customize:hover {
    color: #235675;
}

/* --- Banner Buttons --- */
.cookie-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    white-space: nowrap;
    min-height: 44px;
}

.cookie-btn-accept {
    background: linear-gradient(135deg, #4caf50 0%, #43a047 100%);
    color: #fff;
}

.cookie-btn-accept:hover {
    background: linear-gradient(135deg, #43a047 0%, #388e3c 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft, 0 12px 36px rgba(15, 23, 42, 0.03));
}

.cookie-btn-reject {
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.cookie-btn-reject:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.cookie-btn-customize {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.cookie-btn-customize:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

/* --- Cookie Preferences Modal --- */
.cookie-modal-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cookie-modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.cookie-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    z-index: 10001;
    background: #fff;
    border-radius: var(--radius-2026, 20px);
    width: calc(100% - 2rem);
    max-width: 600px;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    max-height: calc(var(--visual-viewport-height, 100dvh) - 2rem);
    overflow: hidden;
    box-shadow: var(--shadow-soft, 0 12px 36px rgba(15, 23, 42, 0.03));
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.cookie-modal.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.cookie-modal-header {
    padding: 1.5rem calc(1.5rem + env(safe-area-inset-right, 0px)) 1.5rem calc(1.5rem + env(safe-area-inset-left, 0px));
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cookie-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cookie-modal-title i {
    color: #ffc107;
}

.cookie-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.cookie-modal-close:hover {
    color: #23313b;
}

.cookie-modal-body {
    padding: 1.5rem calc(1.5rem + env(safe-area-inset-right, 0px)) 1.5rem calc(1.5rem + env(safe-area-inset-left, 0px));
    overflow-y: auto;
    max-height: none;
    min-height: 0;
    flex: 1 1 auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.cookie-modal-intro {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* --- Cookie Category Cards --- */
.cookie-category {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-2026, 20px);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.cookie-category.active {
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.cookie-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

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

.cookie-category-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #23313b;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cookie-category-name .badge {
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.cookie-category-name .badge-required {
    background: #fef3c7;
    color: #92400e;
}

.cookie-category-desc {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* --- Toggle Switch --- */
.cookie-toggle {
    position: relative;
    width: 48px;
    height: 44px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

.cookie-toggle input {
    opacity: 0;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    margin: 0;
    z-index: 1;
    cursor: pointer;
}

.cookie-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 9px;
    right: 0;
    bottom: 9px;
    left: 0;
    background: #d1d5db;
    border-radius: 26px;
    transition: background 0.3s;
}

.cookie-toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: var(--shadow-soft, 0 12px 36px rgba(15, 23, 42, 0.03));
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    background: #4caf50;
}

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

.cookie-toggle input:disabled + .cookie-toggle-slider {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- Category Details (Expandable) --- */
.cookie-category-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    display: none;
}

.cookie-category.expanded .cookie-category-details {
    display: block;
}

.cookie-category-toggle-details {
    background: none;
    border: none;
    color: #4b5563;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.625rem 0;
    margin-top: 0.125rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-height: 44px;
}

.cookie-category-toggle-details:hover {
    color: #23313b;
}

.cookie-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.8rem;
}

.cookie-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;
    color: #4b5563;
}

.cookie-list li:last-child {
    border-bottom: none;
}

.cookie-list-name {
    font-weight: 500;
    color: #374151;
}

.cookie-list-duration {
    color: #9ca3af;
    font-size: 0.75rem;
}

/* --- Modal Footer --- */
.cookie-modal-footer {
    padding: 1.25rem calc(1.5rem + env(safe-area-inset-right, 0px)) 1.25rem calc(1.5rem + env(safe-area-inset-left, 0px));
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
}

/* Focused identity tasks must remain completable before a cookie choice on
   phones, tablets and short landscape viewports. Keep the banner in normal
   document flow instead of covering the primary CTA. */
html[data-focused-identity-flow="true"] .cookie-consent-banner {
    position: static;
    inset: auto;
    flex: 0 0 auto;
    flex-shrink: 0;
    width: 100%;
    height: auto;
    min-height: max-content;
    max-height: none;
    overflow: visible;
    transform: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
}

html[data-focused-identity-flow="true"] .cookie-consent-banner.show {
    transform: none;
    opacity: 1;
    visibility: visible;
}

.cookie-modal-footer .cookie-btn {
    flex: 1;
    min-width: 120px;
    text-align: center;
}

@media (min-width: 576px) {
    .cookie-modal-footer .cookie-btn {
        flex: none;
    }
}

.cookie-btn-save {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: #fff;
}

.cookie-btn-save:hover {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
}

/* --- Compact Banner (REMOVED - 2026 Best Practice) --- */
/* Sürekli görünen floating button kaldırıldı. */
/* Çerez ayarları artık: Footer linki + Hesap ayarları sekmesi */
.cookie-settings-btn {
    display: none !important; /* 2026: Modern UX - sürekli widget gösterme */
}

/* --- Animation for Category Toggle --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.cookie-category-details {
    animation: fadeIn 0.3s ease;
}

/* --- Dark Mode Support --- */
@media (prefers-color-scheme: dark) and (min-width: 99999px) {
    .cookie-modal {
        background: #23313b;
    }

    .cookie-modal-header {
        border-color: #374151;
    }

    .cookie-modal-title {
        color: #f9fafb;
    }

    .cookie-modal-intro {
        color: #9ca3af;
    }

    .cookie-category {
        background: #23313b;
        border-color: #374151;
    }

    .cookie-category-name {
        color: #f9fafb;
    }

    .cookie-category-desc {
        color: #9ca3af;
    }

    .cookie-category-details {
        border-color: #374151;
    }

    .cookie-modal-footer {
        background: #23313b;
        border-color: #374151;
    }
}

/* --- Mobile Optimizations --- */
@media (max-width: 575.98px) {
    .cookie-consent-banner {
        padding: 0.75rem 0;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    }

    .cookie-consent-banner .container {
        padding-left: calc(1rem + env(safe-area-inset-left, 0px)) !important;
        padding-right: calc(1rem + env(safe-area-inset-right, 0px)) !important;
    }

    .cookie-banner-content {
        gap: 0.75rem;
    }

    .cookie-banner-title {
        margin-bottom: 0.25rem;
        font-size: 1rem;
    }

    .cookie-banner-description {
        font-size: 0.875rem;
        line-height: 1.4;
    }

    .cookie-banner-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
        width: 100%;
    }

    .cookie-btn {
        width: 100%;
        min-width: 0;
        padding: 0.55rem 0.65rem;
        font-size: 0.8125rem;
        line-height: 1.2;
        white-space: normal;
        text-align: center;
    }

    /* Mobil: başlık yok, kısa metin sonunda "Özelleştir" yazı bağlantısı, tek satır iki buton */
    .cookie-banner-title,
    .cookie-desc-full,
    .cookie-banner-actions .cookie-btn-customize {
        display: none;
    }

    .cookie-desc-short {
        display: block;
    }

    .cookie-banner-actions .cookie-btn {
        min-height: 40px;
    }

    .cookie-modal {
        width: 100%;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        top: auto;
        bottom: 0;
        transform: translateX(-50%) translateY(100%);
        max-height: 85vh;
        max-height: calc(100dvh - env(safe-area-inset-top, 0px));
    }

    .cookie-modal.show {
        transform: translateX(-50%) translateY(0);
    }

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

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

html.mobile-keyboard-open .cookie-modal {
    top: calc(var(--visual-viewport-offset-top, 0px) + 8px);
    bottom: auto;
    max-height: calc(var(--visual-viewport-height, 100dvh) - 16px);
    transform: translateX(-50%) scale(0.95);
}

html.mobile-keyboard-open .cookie-modal.show {
    transform: translateX(-50%) scale(1);
}

.cookie-btn:focus,
.cookie-modal-close:focus,
.cookie-category-toggle-details:focus,
.cookie-banner-description a:focus {
    outline: 3px solid #1d4ed8;
    outline-offset: 3px;
}

.cookie-toggle input:focus + .cookie-toggle-slider {
    outline: 3px solid #1d4ed8;
    outline-offset: 3px;
}

@supports selector(:focus-visible) {
    .cookie-btn:focus:not(:focus-visible),
    .cookie-modal-close:focus:not(:focus-visible),
    .cookie-category-toggle-details:focus:not(:focus-visible),
    .cookie-banner-description a:focus:not(:focus-visible) {
        outline: none;
    }

    .cookie-btn:focus-visible,
    .cookie-modal-close:focus-visible,
    .cookie-category-toggle-details:focus-visible,
    .cookie-banner-description a:focus-visible {
        outline: 3px solid #1d4ed8;
        outline-offset: 3px;
    }

    .cookie-toggle input:focus:not(:focus-visible) + .cookie-toggle-slider {
        outline: none;
    }

    .cookie-toggle input:focus-visible + .cookie-toggle-slider {
        outline: 3px solid #1d4ed8;
        outline-offset: 3px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-consent-banner,
    .cookie-modal-backdrop,
    .cookie-modal,
    .cookie-btn,
    .cookie-modal-close,
    .cookie-category,
    .cookie-toggle-slider,
    .cookie-toggle-slider::before {
        transition: none !important;
    }

    .cookie-category-details {
        animation: none !important;
    }
}

/* Pastel production pass: global cookie consent */
.cookie-consent-banner {
    background: #f8fcff;
    border-top: 1px solid rgba(137, 172, 195, 0.32);
    box-shadow: 0 -14px 34px rgba(23, 32, 51, 0.08);
    color: #172033;
}

.cookie-banner-title {
    color: #172033;
}

.cookie-banner-title i {
    color: #7c5a1d;
}

.cookie-banner-description {
    color: #52647a;
}

.cookie-banner-description a {
    color: #2f6f95;
}

.cookie-banner-description a:hover {
    color: #235675;
}

.cookie-btn {
    border: 1px solid transparent;
    box-shadow: none;
}

.cookie-btn-accept {
    background: #edf8f2;
    border-color: #bfdfcc;
    color: #276346;
}

.cookie-btn-accept:hover {
    background: #e1f1e8;
    border-color: #afd7bd;
    color: #22573e;
    box-shadow: none;
}

.cookie-btn-reject {
    background: #ffffff;
    border-color: #c9deeb;
    color: #52647a;
}

.cookie-btn-reject:hover {
    background: #f8fcff;
    border-color: #b9d9ec;
    color: #29455c;
}

.cookie-btn-customize,
.cookie-btn-save {
    background: #e8f4ff;
    border-color: #b9d9ec;
    color: #235675;
}

.cookie-btn-customize:hover,
.cookie-btn-save:hover {
    background: #dceef9;
    border-color: #a9d1e6;
    color: #1f4e6b;
}

.cookie-modal-backdrop {
    background: rgba(23, 32, 51, 0.34);
}

.cookie-modal {
    border: 1px solid rgba(137, 172, 195, 0.28);
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(23, 32, 51, 0.14);
}

.cookie-modal-header,
.cookie-modal-footer {
    border-color: #c9deeb;
}

.cookie-modal-footer {
    background: #f8fcff;
}

.cookie-modal-title {
    color: #172033;
}

.cookie-modal-title i {
    color: #7c5a1d;
}

.cookie-modal-intro,
.cookie-category-desc {
    color: #52647a;
}

.cookie-category {
    background: #ffffff;
    border-color: #c9deeb;
    border-radius: 8px;
}

.cookie-category:hover {
    border-color: #b9d9ec;
}

.cookie-category.active {
    border-color: #bfdfcc;
    box-shadow: 0 0 0 4px rgba(191, 223, 204, 0.28);
}

.cookie-category-name {
    color: #172033;
}

.cookie-category-name .badge-required {
    background: #fff4d8;
    border: 1px solid #ecd99b;
    color: #72551d;
}

.cookie-toggle-slider {
    background: #58788a;
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    background: #26734d;
}

.cookie-category-toggle-details {
    color: #2f6f95;
}

.cookie-category-toggle-details:hover {
    color: #235675;
}

@media (max-width: 575.98px) {
    .cookie-modal {
        border-radius: 8px 8px 0 0;
    }
}
