/* SDGs Activity System - Custom Styles */

/* Smooth scrolling + prevent horizontal overflow */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}
body {
    overflow-x: hidden;
}

/* SDG Wheel animation */
.sdg-wheel-spin {
    animation: spin 60s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Card hover effects */
.card-hover {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* SDG Goal glow effect */
.sdg-glow {
    transition: all 0.3s ease;
}
.sdg-glow:hover {
    box-shadow: 0 0 20px currentColor;
    transform: scale(1.05);
}

/* Particle container */
.particles-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.3;
    animation: float 15s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.3; }
    50% { transform: translateY(-30px) rotate(180deg); opacity: 0.6; }
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* SweetAlert2 custom styling */
.swal2-popup {
    font-family: 'Sarabun', sans-serif !important;
}

/* Line clamp utilities */
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Prose styling for activity details */
.prose p { margin-bottom: 1rem; line-height: 1.75; }
.prose h2 { font-size: 1.25rem; font-weight: 700; margin-top: 1.5rem; margin-bottom: 0.75rem; }
.prose h3 { font-size: 1.1rem; font-weight: 600; margin-top: 1.25rem; margin-bottom: 0.5rem; }
.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.prose li { margin-bottom: 0.25rem; }
.prose img { max-width: 100%; height: auto; border-radius: 0.5rem; margin: 1rem 0; }
.prose a { color: #2563eb; text-decoration: underline; }
.prose a:hover { color: #1d4ed8; }

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Page transition */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp 0.5s ease-out; }

/* Mobile responsive adjustments */
@media (max-width: 640px) {
    .sdg-wheel-container { max-width: 250px; margin: 0 auto; }
}

/* ═══ Page Transition Overlay ═══ */
.page-transition {
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Overlay background */
.page-transition .pt-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #1e40af 100%);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.6s cubic-bezier(0.86, 0, 0.07, 1);
}
.page-transition.pt-entering .pt-overlay {
    transform: scaleY(1);
    transform-origin: bottom;
    pointer-events: all;
}
.page-transition.pt-leaving .pt-overlay {
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.6s 0.15s cubic-bezier(0.86, 0, 0.07, 1);
}

/* Floating particles on overlay */
.pt-particles {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s 0.3s;
}
.page-transition.pt-entering .pt-particles { opacity: 1; }
.page-transition.pt-leaving .pt-particles { opacity: 0; transition: opacity 0.2s; }

.pt-dot {
    position: absolute;
    border-radius: 50%;
    opacity: 0.4;
    animation: ptFloat 3s ease-in-out infinite alternate;
}
@keyframes ptFloat {
    0%   { transform: translateY(0) scale(1); opacity: 0.3; }
    100% { transform: translateY(-30px) scale(1.3); opacity: 0.6; }
}

/* Center content */
.page-transition .pt-center {
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s 0.35s, transform 0.4s 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
}
.page-transition.pt-entering .pt-center {
    opacity: 1;
    transform: scale(1);
}
.page-transition.pt-leaving .pt-center {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.15s, transform 0.15s;
}

/* SDG Wheel spinner */
.pt-wheel {
    width: 64px; height: 64px;
    margin: 0 auto 16px;
    animation: ptSpin 4s linear infinite;
    filter: drop-shadow(0 0 15px rgba(255,255,255,0.2));
}
.pt-wheel svg { width: 100%; height: 100%; }

@keyframes ptSpin {
    to { transform: rotate(360deg); }
}

.pt-text {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    opacity: 0.8;
}
.pt-text span {
    display: inline-block;
    animation: ptPulse 1.5s ease-in-out infinite;
}
@keyframes ptPulse {
    0%, 100% { opacity: 0.6; }
    50%      { opacity: 1; }
}

/* Horizontal SDG color bar at bottom */
.pt-sdg-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    display: flex;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.3s 0.4s;
}
.page-transition.pt-entering .pt-sdg-bar { opacity: 1; }
.page-transition.pt-leaving .pt-sdg-bar { opacity: 0; transition: opacity 0.1s; }

.pt-sdg-bar div {
    flex: 1;
    animation: ptBarGrow 0.8s ease-out both;
}
@keyframes ptBarGrow {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* Page enter animation (content fades in) */
.page-loaded main {
    animation: ptContentIn 0.6s 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}
@keyframes ptContentIn {
    from { opacity: 0; transform: translateY(15px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Print styles */
@media print {
    nav, footer, .no-print, .page-transition { display: none !important; }
    body { background: white !important; }
}
