/* ==========================================================================
   Cookie Consent Banner & Preferences Modal Styles (PDPA Compliant)
   DSD RRU - กองพัฒนานักศึกษา มหาวิทยาลัยราชภัฏราชนครินทร์
   ========================================================================== */

/* 1. Floating Cookie Consent Banner */
.cookie-banner-wrapper {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99998;
    max-width: 420px;
    width: calc(100vw - 48px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 35px -5px rgba(15, 23, 42, 0.22), 0 10px 15px -3px rgba(15, 23, 42, 0.12);
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
    pointer-events: none;
}

.cookie-banner-wrapper.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.cookie-banner-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.cookie-banner-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.cookie-banner-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1.3;
}

.cookie-banner-body {
    font-size: 0.94rem;
    color: #475569;
    line-height: 1.65;
    margin-bottom: 1.25rem;
}

.cookie-banner-body a {
    color: #0284c7;
    text-decoration: underline;
    font-weight: 500;
}

.cookie-banner-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cookie-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}

.cookie-btn-primary {
    background: #2b303a;
    color: #ffffff;
}

.cookie-btn-primary:hover {
    background: #181b21;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.cookie-btn-secondary {
    background: #334155;
    color: #ffffff;
}

.cookie-btn-secondary:hover {
    background: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.cookie-btn-settings {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.cookie-btn-settings:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* 2. Preferences Modal */
.cookie-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.cookie-modal-backdrop.show {
    display: flex;
    animation: cookieFadeIn 0.25s ease-out;
}

.cookie-modal-dialog {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 620px;
    max-height: calc(100dvh - 48px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    animation: cookieSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    flex-shrink: 0;
}

.cookie-modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cookie-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.15s;
}

.cookie-modal-close:hover {
    color: #0f172a;
    background: #e2e8f0;
}

.cookie-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cookie-category-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    background: #ffffff;
    transition: border-color 0.2s ease;
}

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

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

.cookie-category-name {
    font-size: 0.98rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.cookie-category-desc {
    font-size: 0.88rem;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

.cookie-always-active-badge {
    background: #dcfce7;
    color: #15803d;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    white-space: nowrap;
    display: inline-block;
}

/* iOS Style Switch */
.cookie-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.cookie-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #cbd5e1;
    transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 24px;
}

.cookie-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.cookie-switch input:checked + .cookie-slider {
    background-color: var(--primary, #0284c7);
}

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

.cookie-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* 3. Floating Quick Settings Trigger Badge */
.cookie-floating-trigger {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99990;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.cookie-floating-trigger:hover {
    background: #1e293b;
    color: #ffffff;
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* Keyframes */
@keyframes cookieSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cookieFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .cookie-banner-wrapper {
        bottom: 12px;
        left: 12px;
        width: calc(100vw - 24px);
        padding: 1.25rem;
        border-radius: 12px;
    }

    .cookie-floating-trigger {
        bottom: 12px;
        left: 12px;
    }

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

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