/* ============================================
   Cookie Consent Banner Styles - PDPA Compliance
   โรงเรียนสาธิตมหาวิทยาลัยพะเยา
   ============================================ */

/* ===== Cookie Banner ===== */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    background: rgba(30, 30, 50, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(139, 122, 168, 0.3);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.35);
    padding: 0;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.5s ease;
    opacity: 0;
    font-family: 'Sarabun', sans-serif;
}

.cookie-consent-banner.show {
    transform: translateY(0);
    opacity: 1;
}

.cookie-consent-banner.hiding {
    transform: translateY(100%);
    opacity: 0;
}

.cookie-banner-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 30px;
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Cookie Icon */
.cookie-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #8B7AA8, #A698BC);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 15px rgba(139, 122, 168, 0.4);
    animation: cookiePulse 2s ease-in-out infinite;
}

@keyframes cookiePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Text Content */
.cookie-text {
    flex: 1;
    color: #e0e0e0;
}

.cookie-text h4 {
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
    font-family: 'Kanit', sans-serif;
}

.cookie-text p {
    font-size: 0.88rem;
    line-height: 1.6;
    margin: 0;
    color: #b0b0c0;
}

.cookie-text a {
    color: #A698BC;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.cookie-text a:hover {
    color: #d4c8e8;
}

/* Buttons Container */
.cookie-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    align-items: center;
}

/* Button Base */
.cookie-btn {
    padding: 10px 22px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    white-space: nowrap;
    font-family: 'Sarabun', sans-serif;
    position: relative;
    overflow: hidden;
}

.cookie-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.cookie-btn:active::after {
    width: 200px;
    height: 200px;
}

/* Accept All Button */
.cookie-btn-accept {
    background: linear-gradient(135deg, #8B7AA8, #6A5C82);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(139, 122, 168, 0.4);
}

.cookie-btn-accept:hover {
    background: linear-gradient(135deg, #9A89B7, #7A6C92);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(139, 122, 168, 0.5);
}

/* Necessary Only Button */
.cookie-btn-necessary {
    background: rgba(255, 255, 255, 0.08);
    color: #d0d0e0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.cookie-btn-necessary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Settings Button */
.cookie-btn-settings {
    background: transparent;
    color: #a0a0b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    padding: 8px 18px;
}

.cookie-btn-settings:hover {
    color: #ffffff;
    border-color: rgba(139, 122, 168, 0.5);
    background: rgba(139, 122, 168, 0.1);
}

/* ===== Cookie Settings Modal ===== */
.cookie-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    padding: 20px;
}

.cookie-settings-overlay.show {
    opacity: 1;
    visibility: visible;
}

.cookie-settings-modal {
    background: #1e1e32;
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5),
                0 0 40px rgba(139, 122, 168, 0.1);
    border: 1px solid rgba(139, 122, 168, 0.2);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cookie-settings-overlay.show .cookie-settings-modal {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.cookie-settings-header {
    padding: 24px 28px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cookie-settings-header h3 {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    font-family: 'Kanit', sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cookie-settings-header h3 i {
    color: #8B7AA8;
}

.cookie-settings-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: #a0a0b8;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cookie-settings-close:hover {
    background: rgba(231, 74, 59, 0.15);
    color: #e74a3b;
    transform: rotate(90deg);
}

/* Modal Body */
.cookie-settings-body {
    padding: 20px 28px;
}

.cookie-settings-description {
    color: #b0b0c0;
    font-size: 0.88rem;
    line-height: 1.7;
    margin-bottom: 20px;
}

/* Cookie Category */
.cookie-category {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 14px;
    transition: all 0.3s;
}

.cookie-category:hover {
    border-color: rgba(139, 122, 168, 0.2);
    background: rgba(139, 122, 168, 0.04);
}

.cookie-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.cookie-category-title {
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cookie-category-title i {
    color: #8B7AA8;
    font-size: 0.9rem;
}

.cookie-category-badge {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 50px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.cookie-badge-required {
    background: rgba(139, 122, 168, 0.15);
    color: #A698BC;
}

.cookie-badge-optional {
    background: rgba(255, 255, 255, 0.06);
    color: #808090;
}

.cookie-category-desc {
    color: #9090a8;
    font-size: 0.82rem;
    line-height: 1.6;
    margin: 0;
}

/* Custom Toggle Switch */
.cookie-toggle {
    position: relative;
    width: 46px;
    height: 24px;
    flex-shrink: 0;
}

.cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    transition: all 0.3s ease;
}

.cookie-toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #606070;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    background: linear-gradient(135deg, #8B7AA8, #6A5C82);
    box-shadow: 0 0 12px rgba(139, 122, 168, 0.3);
}

.cookie-toggle input:checked + .cookie-toggle-slider::before {
    transform: translateX(22px);
    background: #ffffff;
}

.cookie-toggle input:disabled + .cookie-toggle-slider {
    opacity: 0.6;
    cursor: not-allowed;
}

.cookie-toggle input:disabled:checked + .cookie-toggle-slider {
    background: linear-gradient(135deg, #8B7AA8, #6A5C82);
    opacity: 0.8;
}

/* Modal Footer */
.cookie-settings-footer {
    padding: 16px 28px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.cookie-settings-footer .cookie-btn {
    padding: 10px 24px;
}

/* ===== Footer Cookie Link ===== */
.cookie-manage-link {
    cursor: pointer;
    transition: color 0.3s;
}

.cookie-manage-link:hover {
    color: #fff !important;
}

/* ===== Scrollbar for Modal ===== */
.cookie-settings-modal::-webkit-scrollbar {
    width: 6px;
}

.cookie-settings-modal::-webkit-scrollbar-track {
    background: transparent;
}

.cookie-settings-modal::-webkit-scrollbar-thumb {
    background: rgba(139, 122, 168, 0.3);
    border-radius: 3px;
}

.cookie-settings-modal::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 122, 168, 0.5);
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .cookie-banner-inner {
        flex-wrap: wrap;
        padding: 20px 24px;
        gap: 16px;
    }

    .cookie-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
        border-radius: 14px;
    }

    .cookie-buttons {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 768px) {
    .cookie-banner-inner {
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
        gap: 14px;
    }

    .cookie-icon {
        display: none;
    }

    .cookie-text h4 {
        font-size: 0.95rem;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .cookie-text h4::before {
        content: '🍪';
        font-size: 1.2rem;
    }

    .cookie-text p {
        font-size: 0.82rem;
    }

    .cookie-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .cookie-btn {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
    }

    .cookie-btn-settings {
        padding: 10px 20px;
    }

    /* Modal */
    .cookie-settings-overlay {
        padding: 10px;
        align-items: flex-end;
    }

    .cookie-settings-modal {
        max-height: 90vh;
        border-radius: 20px 20px 0 0;
    }

    .cookie-settings-header {
        padding: 20px 20px 14px;
    }

    .cookie-settings-body {
        padding: 16px 20px;
    }

    .cookie-settings-footer {
        padding: 14px 20px 20px;
        flex-direction: column;
    }

    .cookie-settings-footer .cookie-btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .cookie-text h4 {
        font-size: 0.9rem;
    }

    .cookie-text p {
        font-size: 0.8rem;
    }

    .cookie-category {
        padding: 14px 16px;
    }

    .cookie-category-title {
        font-size: 0.88rem;
    }

    .cookie-category-desc {
        font-size: 0.78rem;
    }
}
