/**
 * Frontend Styles for ShelterPopups & User Settings Shortcode
 * File: assets/css/popup-frontend.css
 */

/* ==========================================================================
   1. Modal Overlay & Container
   ========================================================================== */
.sp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(17, 24, 39, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sp-modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.sp-modal-overlay.is-closing {
    opacity: 0;
    pointer-events: none;
}

/* Modal Inner Container */
.sp-modal-container {
    position: relative;
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    transform-origin: center center;
    box-sizing: border-box;
}

/* Close Button */
.sp-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.55);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    z-index: 10;
    transition: background-color 0.2s ease, transform 0.2s ease;
    padding: 0;
}

.sp-modal-close:hover,
.sp-modal-close:focus {
    background-color: rgba(0, 0, 0, 0.85);
    transform: scale(1.08);
    outline: 2px solid #ffffff;
}

/* ==========================================================================
   2. Content Presentation (Graphic & Rich Text Modes)
   ========================================================================== */
.sp-banner-wrap {
    display: block;
    line-height: 0;
}

.sp-banner-link {
    display: block;
    line-height: 0;
    text-decoration: none;
}

.sp-banner-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Rich Text Mode */
.sp-rich-wrap {
    padding: 36px 32px;
    color: #ffffff;
}

.sp-rich-wrap .sp-headline {
    margin: 0 0 16px 0;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.25;
    color: inherit;
}

.sp-rich-wrap .sp-body-text {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 24px;
    color: inherit;
}

.sp-rich-wrap .sp-body-text p {
    margin: 0 0 12px 0;
}

.sp-cta-wrap {
    display: flex;
    justify-content: flex-start;
}

.sp-cta-button {
    display: inline-block;
    background-color: var(--sp-fg, #ffffff);
    color: var(--sp-bg, #111827);
    font-weight: 700;
    font-size: 1rem;
    padding: 12px 28px;
    border-radius: 6px;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sp-cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    color: #000000;
}

/* ==========================================================================
   3. Animations (Spring, Fade, Slide Up)
   ========================================================================== */
/* Spring Animation */
.sp-anim-spring.is-open .sp-modal-container {
    animation: spSpringExpand 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.sp-anim-spring.is-closing .sp-modal-container {
    animation: spSpringShrink 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes spSpringExpand {
    0% {
        transform: scale(0.85) translateY(-30px);
        opacity: 0;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes spSpringShrink {
    0% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
    100% {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }
}

/* Fade Scale Animation */
.sp-anim-fade.is-open .sp-modal-container {
    animation: spFadeIn 0.35s ease forwards;
}
.sp-anim-fade.is-closing .sp-modal-container {
    animation: spFadeOut 0.25s ease forwards;
}

@keyframes spFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes spFadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.95); }
}

/* Slide Up Animation */
.sp-anim-slide_up.is-open .sp-modal-container {
    animation: spSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.sp-anim-slide_up.is-closing .sp-modal-container {
    animation: spSlideDown 0.3s ease forwards;
}

@keyframes spSlideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes spSlideDown {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(40px); }
}

/* ==========================================================================
   4. Device Responsive Exclusions
   ========================================================================== */
@media (max-width: 768px) {
    .sp-hide-mobile {
        display: none !important;
    }
    .sp-modal-overlay {
        padding: 12px;
    }
    .sp-rich-wrap {
        padding: 24px 20px;
    }
}

@media (min-width: 769px) {
    .sp-hide-desktop {
        display: none !important;
    }
}

/* Prevent body scroll when modal is active */
body.sp-modal-active {
    overflow: hidden !important;
}

/* ==========================================================================
   5. User Settings Shortcode Card ([user-settings])
   ========================================================================== */
.sp-user-settings-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 24px 28px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    max-width: 680px;
    margin: 24px 0;
    font-family: inherit;
    box-sizing: border-box;
}

.sp-us-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 18px;
    margin-bottom: 20px;
}

.sp-us-icon {
    font-size: 28px;
    line-height: 1;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 10px;
    border-radius: 8px;
}

.sp-us-title {
    margin: 0 0 6px 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
}

.sp-us-subtitle {
    margin: 0;
    font-size: 0.92rem;
    color: #64748b;
    line-height: 1.5;
}

.sp-us-control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.sp-us-info strong {
    display: block;
    font-size: 1rem;
    color: #0f172a;
    margin-bottom: 4px;
}

.sp-us-info span {
    font-size: 0.88rem;
    color: #64748b;
    line-height: 1.4;
    display: block;
}

/* iOS Style Switch */
.sp-us-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 30px;
    flex-shrink: 0;
}

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

.sp-us-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.25s;
    border-radius: 30px;
}

.sp-us-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.25s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sp-us-switch input:checked + .sp-us-slider {
    background-color: #10b981;
}

.sp-us-switch input:checked + .sp-us-slider:before {
    transform: translateX(22px);
}

.sp-us-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px dashed #e2e8f0;
}

.sp-us-badge {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
}

.sp-us-badge-enabled {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.sp-us-badge-disabled {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.sp-us-btn-link {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.sp-us-btn-link:hover {
    color: #4f46e5;
}

.sp-us-toast {
    margin-top: 14px;
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    font-size: 0.88rem;
    border-radius: 6px;
    animation: spFadeIn 0.2s ease;
}

/* ==========================================================================
   6. Embedded Active Announcements List View (Inside User Settings)
   ========================================================================== */
.sp-us-announcements-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.sp-us-sec-header h4 {
    margin: 0 0 4px 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

.sp-us-sec-desc {
    margin: 0 0 14px 0;
    font-size: 0.88rem;
    color: #64748b;
    display: block;
    line-height: 1.45;
}

.sp-us-announcement-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
    flex-wrap: wrap;
}

.sp-us-ai-thumb {
    width: 64px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #cbd5e1;
    background: #ffffff;
}

.sp-us-ai-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sp-us-ai-icon {
    width: 48px;
    height: 48px;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    flex-shrink: 0;
}

.sp-us-ai-info {
    flex: 1;
    min-width: 180px;
}

.sp-us-ai-title {
    display: block;
    font-size: 0.98rem;
    color: #0f172a;
    margin-bottom: 4px;
    line-height: 1.35;
}

.sp-us-ai-meta {
    font-size: 0.82rem;
    color: #64748b;
}

.sp-us-ai-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.sp-us-btn-primary {
    background: #2563eb !important;
    color: #ffffff !important;
    border: none !important;
    padding: 6px 14px !important;
    font-size: 0.85rem !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    display: inline-block;
}

.sp-us-btn-primary:hover {
    background: #1d4ed8 !important;
    color: #ffffff !important;
}

.sp-us-btn-secondary {
    background: #ffffff !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
    padding: 6px 12px !important;
    font-size: 0.85rem !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    display: inline-block;
}

.sp-us-btn-secondary:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}

.sp-us-empty-announcements {
    padding: 16px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    font-size: 0.88rem;
    color: #64748b;
    text-align: center;
}

/* ==========================================================================
   7. Dedicated Public Announcements Page (/active-announcements/)
   ========================================================================== */
.sp-active-announcements-container {
    max-width: 860px;
    margin: 40px auto 60px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.sp-aac-header {
    text-align: center;
    margin-bottom: 32px;
}

.sp-aac-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 3px 12px;
    border-radius: 12px;
    margin-bottom: 10px;
}

.sp-aac-title {
    margin: 0 0 10px 0;
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.sp-aac-subtitle {
    margin: 0 auto;
    max-width: 600px;
    font-size: 1.05rem;
    color: #64748b;
    line-height: 1.6;
}

/* Public Card */
.sp-public-announcement-card {
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    color: #ffffff;
    box-sizing: border-box;
}

.sp-pac-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.88rem;
    flex-wrap: wrap;
    gap: 8px;
}

.sp-pac-badge {
    font-weight: 700;
    color: #a7f3d0;
}

.sp-pac-expiry {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.82rem;
}

.sp-pac-media {
    line-height: 0;
}

.sp-pac-link {
    display: block;
}

.sp-pac-image {
    width: 100%;
    height: auto;
    display: block;
}

.sp-pac-content {
    padding: 36px 32px;
}

.sp-pac-title {
    margin: 0 0 16px 0;
    font-size: 1.8rem;
    font-weight: 800;
    color: #ffffff;
}

.sp-pac-body {
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 24px;
}

.sp-pac-footer {
    padding: 20px 24px 28px 24px;
    text-align: center;
    background: rgba(0, 0, 0, 0.15);
}

.sp-pac-btn-cta {
    display: inline-block;
    background: #ffffff;
    color: #0f172a;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 13px 32px;
    border-radius: 8px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sp-pac-btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    color: #000000;
}

/* Empty Card */
.sp-pac-empty-card {
    background: #ffffff;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 48px 32px;
    text-align: center;
    color: #475569;
}

.sp-pac-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.sp-pac-empty-card h2 {
    margin: 0 0 10px 0;
    font-size: 1.4rem;
    color: #0f172a;
}

.sp-pac-empty-card p {
    max-width: 500px;
    margin: 0 auto;
    font-size: 0.95rem;
    line-height: 1.6;
}

.sp-pac-footer-note {
    text-align: center;
    margin-top: 28px;
    font-size: 0.9rem;
    color: #64748b;
}

.sp-pac-footer-note a {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 500;
}

.sp-pac-footer-note a:hover {
    color: #1d4ed8;
}
