/* ============================================================
   Cookie Consent (PDPA) — นิวกาญจน์ แทรกเตอร์
   ใช้ design token ชุดเดียวกับ css/style.css
   ============================================================ */

.nk-cc,
.nk-cc * {
    box-sizing: border-box;
}

.nk-cc {
    font-family: var(--font-thai, 'IBM Plex Sans Thai', sans-serif);
}

/* ---------- แถบแจ้งเตือนด้านล่าง ---------- */
.nk-cc-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 100000;
    max-width: 1120px;
    margin: 0 auto;
    padding: 22px 24px;
    background: var(--white, #FFFFFF);
    border: 1px solid var(--gray-200, #E9ECEF);
    border-radius: var(--radius-md, 16px);
    box-shadow: var(--shadow-lg, 0 16px 48px rgba(0, 0, 0, 0.18));
    display: flex;
    align-items: center;
    gap: 24px;
    transform: translateY(140%);
    opacity: 0;
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.45s ease;
}

.nk-cc-banner.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.nk-cc-banner-text {
    flex: 1 1 auto;
    min-width: 0;
}

.nk-cc-banner-title {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary, #1A2340);
    display: flex;
    align-items: center;
    gap: 9px;
}

.nk-cc-banner-title svg {
    width: 22px;
    height: 22px;
    flex: none;
    color: var(--blue, #003DA6);
}

.nk-cc-banner-desc {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--text-secondary, #4A5568);
}

.nk-cc-banner-actions {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------- ปุ่ม ---------- */
.nk-cc-btn {
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 12px 22px;
    border-radius: var(--radius-pill, 999px);
    border: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.nk-cc-btn:focus-visible {
    outline: 3px solid var(--blue-light, #1A5CD6);
    outline-offset: 2px;
}

.nk-cc-btn-primary {
    background: var(--yellow, #FFD200);
    color: var(--text-primary, #1A2340);
    box-shadow: 0 4px 16px rgba(255, 210, 0, 0.35);
}

.nk-cc-btn-primary:hover {
    background: var(--yellow-light, #FFE14D);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 210, 0, 0.45);
}

.nk-cc-btn-secondary {
    background: var(--white, #FFFFFF);
    color: var(--text-primary, #1A2340);
    border-color: var(--gray-300, #DEE2E6);
}

.nk-cc-btn-secondary:hover {
    background: var(--gray-50, #F8F9FA);
    border-color: var(--gray-500, #ADB5BD);
}

.nk-cc-btn-link {
    background: none;
    border: none;
    padding: 12px 8px;
    color: var(--blue, #003DA6);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.nk-cc-btn-link:hover {
    color: var(--blue-light, #1A5CD6);
}

/* ---------- หน้าต่างตั้งค่า ---------- */
.nk-cc-overlay {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(26, 35, 64, 0.55);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nk-cc-overlay.is-visible {
    opacity: 1;
}

.nk-cc-modal {
    width: 100%;
    max-width: 620px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    background: var(--white, #FFFFFF);
    border-radius: var(--radius-lg, 24px);
    box-shadow: var(--shadow-xl, 0 24px 64px rgba(0, 0, 0, 0.24));
    overflow: hidden;
    transform: translateY(24px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.nk-cc-overlay.is-visible .nk-cc-modal {
    transform: translateY(0) scale(1);
}

.nk-cc-modal-head {
    flex: none;
    padding: 24px 26px 18px;
    border-bottom: 1px solid var(--gray-200, #E9ECEF);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.nk-cc-modal-title {
    flex: 1 1 auto;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #1A2340);
}

.nk-cc-modal-subtitle {
    margin: 6px 0 0;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-secondary, #4A5568);
}

.nk-cc-close {
    flex: none;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: var(--gray-100, #F1F3F5);
    color: var(--text-secondary, #4A5568);
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease;
}

.nk-cc-close:hover {
    background: var(--gray-200, #E9ECEF);
    color: var(--text-primary, #1A2340);
}

.nk-cc-close:focus-visible {
    outline: 3px solid var(--blue-light, #1A5CD6);
    outline-offset: 2px;
}

.nk-cc-close svg {
    width: 18px;
    height: 18px;
}

.nk-cc-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 26px 20px;
}

/* ---------- รายการหมวดคุกกี้ ---------- */
.nk-cc-group {
    padding: 18px 0;
    border-bottom: 1px solid var(--gray-100, #F1F3F5);
}

.nk-cc-group:last-child {
    border-bottom: none;
}

.nk-cc-group-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nk-cc-group-name {
    flex: 1 1 auto;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #1A2340);
}

.nk-cc-group-desc {
    margin: 8px 0 0;
    font-size: 0.86rem;
    line-height: 1.65;
    color: var(--text-secondary, #4A5568);
}

.nk-cc-always {
    flex: none;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1E7B45;
    background: #E6F5EC;
    padding: 6px 14px;
    border-radius: var(--radius-pill, 999px);
}

/* สวิตช์เปิด/ปิด */
.nk-cc-switch {
    flex: none;
    position: relative;
    width: 52px;
    height: 30px;
}

.nk-cc-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.nk-cc-switch-track {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-pill, 999px);
    background: var(--gray-300, #DEE2E6);
    transition: background 0.25s ease;
    pointer-events: none;
}

.nk-cc-switch-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--white, #FFFFFF);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nk-cc-switch input:checked + .nk-cc-switch-track {
    background: var(--blue, #003DA6);
}

.nk-cc-switch input:checked + .nk-cc-switch-track::after {
    transform: translateX(22px);
}

.nk-cc-switch input:focus-visible + .nk-cc-switch-track {
    outline: 3px solid var(--blue-light, #1A5CD6);
    outline-offset: 2px;
}

.nk-cc-modal-foot {
    flex: none;
    padding: 18px 26px 22px;
    border-top: 1px solid var(--gray-200, #E9ECEF);
    background: var(--gray-50, #F8F9FA);
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

/* ---------- ลิงก์ "ตั้งค่าคุกกี้" ใน footer ---------- */
.nk-cc-footer-link {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    opacity: 0.9;
    transition: opacity 0.25s ease, color 0.25s ease;
}

.nk-cc-footer-link:hover {
    opacity: 1;
    color: var(--yellow, #FFD200);
}

/* ---------- จอเล็ก ---------- */
@media (max-width: 860px) {
    .nk-cc-banner {
        left: 12px;
        right: 12px;
        bottom: 12px;
        padding: 20px;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .nk-cc-banner-actions {
        flex-wrap: wrap;
    }

    .nk-cc-banner-actions .nk-cc-btn-primary,
    .nk-cc-banner-actions .nk-cc-btn-secondary {
        flex: 1 1 auto;
        text-align: center;
    }

    .nk-cc-btn-link {
        flex: 1 1 100%;
        text-align: center;
    }

    .nk-cc-modal-foot .nk-cc-btn {
        flex: 1 1 auto;
    }
}

/* ---------- ลดการเคลื่อนไหว ---------- */
@media (prefers-reduced-motion: reduce) {
    .nk-cc-banner,
    .nk-cc-overlay,
    .nk-cc-modal,
    .nk-cc-btn,
    .nk-cc-switch-track,
    .nk-cc-switch-track::after {
        transition: none !important;
    }
}
