/* Confess India - Ultimate Unified Design System 
    Theme: London-Hyderabad Hybrid (Indigo/Red/Deep Slate)
    Architecture by: Sanjeev Raju (MSc Advanced CS)
*/

/* 1. ANIMATIONS & MICRO-INTERACTIONS */
@keyframes pulse-green {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

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

@keyframes slideUp {
    from { transform: translate(-50%, 20px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes highlight-section {
    0% { background-color: rgba(99, 102, 241, 0.1); border-radius: 10px; }
    100% { background-color: transparent; }
}

/* FIX: Refined Interaction Pulse to stop emoji font/size issues */
@keyframes interact-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); filter: brightness(1.2); }
    100% { transform: scale(1); }
}

.animate-pulse-green { animation: pulse-green 2s infinite; }

.animate-interact {
    animation: interact-pulse 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    display: inline-block; /* Essential for scale to work correctly on spans */
}

.shake-active { 
    animation: shake 0.3s ease-in-out; 
    border: 3px solid #ef4444 !important; 
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.4) !important;
}

/* 2. CORE LAYOUT & MOUSE GLOW */
html { scroll-behavior: smooth; }

#mouse-glow {
    position: fixed;
    top: 0; left: 0;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, rgba(168, 85, 247, 0.02) 50%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: -1; 
    filter: blur(60px);
    transition: opacity 0.5s ease;
}

/* 3. COMPONENT STYLING */
.confession-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* STABILITY FIXES: Stops card from jumping/shaking during inner animation */
    backface-visibility: hidden;
    transform: translateZ(0);
    contain: layout; 
    will-change: transform, box-shadow;
}

.confession-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    z-index: 10;
}

.confession-card { position: relative; }
[id^="report-wrap-"] { 
    position: relative; 
    z-index: 99 !important; 
    pointer-events: auto !important; 
}
[id^="report-wrap-"] button {
    cursor: pointer !important;
}

.cat-active, .lang-active {
    background: #4f46e5 !important;
    color: white !important;
    border-color: #4f46e5 !important;
    transform: scale(1.05);
}

/* 4. NOTIFICATIONS (TOAST) */
#toast { 
    position: fixed; 
    bottom: 30px; 
    left: 50%; 
    transform: translateX(-50%); 
    z-index: 9999;
    display: none;
}

#toast.show { 
    display: block;
    animation: slideUp 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

/* 5. SHARE MODAL & BLUR */
#shareModal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px) saturate(180%);
    z-index: 10000;
    display: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
#shareModal.show { opacity: 1; pointer-events: auto; display: flex !important; }

.share-pill {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    transition: all 0.3s ease;
}
.share-pill:hover {
    filter: brightness(1.1);
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
}

/* 6. CUSTOM SCROLLBAR */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #6366f1; }

/* 7. REFINED DARK MODE CORE */
.dark body { 
    background-color: #0b1120 !important; 
    color: #f1f5f9 !important; 
}

.dark input, .dark textarea, .dark select {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: white !important;
}

.dark ::-webkit-scrollbar-thumb { background: #334155; }
.dark ::-webkit-scrollbar-thumb:hover { background: #4f46e5; }

/* 8. UTILS */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* 9. GLOBAL BRANDED HEADER */
.global-header {
    position: relative;
    border-bottom: none !important;
    overflow: visible !important;
}

.global-header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #ef4444 0%, #4f46e5 25%, #ef4444 50%, #4f46e5 75%, #ef4444 100%);
    background-size: 200% auto;
    animation: flow-gradient 5s linear infinite;
    z-index: 100;
}

.dark .global-header {
    background-color: rgba(11, 17, 32, 0.9) !important;
}

/* 10. PREVIEW BOX DARK FIX */
.dark #previewContainer {
    background-color: #1e293b !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
    color: #f1f5f9 !important;
}

/* 11. SUBMIT BUTTON & RADIANT GLOW */
#submitBtn {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#submitBtn.glow-red {
    background-color: #ef4444 !important;
    border: 1px solid #ef4444 !important;
    color: white !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5), 0 0 40px rgba(239, 68, 68, 0.2) !important;
    transform: translateY(-2px);
}

/* 12. MANIFESTO & SIGNATURE STYLES */
.legal-section h2 {
    background: linear-gradient(135deg, #1e293b 0%, #4f46e5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dark .legal-section h2 {
    background: linear-gradient(135deg, #f8fafc 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.privacy-stamp {
    transition: all 0.3s ease;
    border: 1px solid rgba(35, 134, 54, 0.2) !important;
}

.privacy-stamp:hover {
    background: rgba(35, 134, 54, 0.1) !important;
    transform: translateY(-3px);
    border-color: #238636 !important;
    box-shadow: 0 10px 20px -5px rgba(35, 134, 54, 0.2);
}

/* 13. POST OF THE DAY - PRESTIGE SYSTEM */
@keyframes gold-glow {
    0% { box-shadow: 0 0 5px rgba(251, 191, 36, 0.2); border-color: rgba(251, 191, 36, 0.3); }
    50% { box-shadow: 0 0 20px rgba(251, 191, 36, 0.4); border-color: rgba(251, 191, 36, 0.8); }
    100% { box-shadow: 0 0 5px rgba(251, 191, 36, 0.2); border-color: rgba(251, 191, 36, 0.3); }
}

.potd-card {
    animation: gold-glow 3s infinite ease-in-out;
    border: 2px solid #fbbf24 !important;
    position: relative;
}

/* 14. DEEP LINK HIGHLIGHTING - REFINED */
@keyframes highlight-pulse {
    0% { outline: 3px solid #6366f1; outline-offset: 8px; box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { outline: 3px solid #818cf8; outline-offset: 12px; box-shadow: 0 0 20px 10px rgba(99, 102, 241, 0.1); }
    100% { outline: 3px solid transparent; outline-offset: 4px; box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.highlight-post {
    animation: highlight-pulse 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    scroll-margin-top: 180px; /* Adjusts the scroll position so header doesn't hide it */
    z-index: 50;
}

/* 15. BRANDED SHARE BUTTON */
.btn-brand {
    background-color: #4f46e5 !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-brand:hover {
    background-color: #4338ca !important; 
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.4);
}

/* FIX: Stability for counters */
.count {
    display: inline-block;
    transition: transform 0.2s ease;
    font-variant-numeric: tabular-nums;
}

.active-interact .count {
    transform: scale(1.3);
}

/* 16. HD CAPTURE AREA - FIXED & STABLE */
#capture-area {
    position: fixed; /* Better for html2canvas than absolute */
    left: -2000px;  /* Move off-screen */
    top: 0;
    width: 1080px !important; 
    height: 1080px !important; /* Force a square, don't use min-height */
    padding: 100px;
    background: radial-gradient(circle, #1e293b 0%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-sizing: border-box; /* Crucial to keep padding inside the 1080px */
    z-index: -9999;
    overflow: hidden; /* Prevents text from leaking out */
}
/* 17. READ MORE / LINE CLAMP LOGIC */
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 19. IMPROVED DEEP LINK LANDING */
.confession-card {
    scroll-margin-top: 160px;
}

/* 20. BUTTON & POINTER FIXES */
button, .cursor-pointer {
    cursor: pointer !important;
    user-select: none;
}

.active-interact {
    pointer-events: none;
    opacity: 0.6;
}

/* 21. DYNAMIC SCROLL NAV */
#dynamic-scroll-btn {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.report-success {
    color: #ef4444 !important;
    font-weight: 800 !important;
    animation: reportFadeIn 0.3s ease-out;
}

@keyframes reportFadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 22. DIALECT GLOW & NATIVE BADGE SYSTEM */
.dialect-glow {
    position: relative;
    border-color: var(--glow-color) !important;
    background-color: var(--glow-bg) !important;
    box-shadow: 0 0 30px var(--glow-bg), inset 0 0 15px var(--glow-bg) !important;
    transform: scale(1.02);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.dark .dialect-glow {
    background-color: var(--glow-bg-dark) !important;
    box-shadow: 0 0 40px var(--glow-bg-dark) !important;
    border: 1px solid var(--glow-color) !important; /* Forces the color in dark mode */
}

.badge-pulse {
    animation: badge-pulse-anim 2s infinite;
}

@keyframes badge-pulse-anim {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

/* 23. VIBE ENGINE VISUALS */
#vibe-chip {
    transition: all 0.4s ease;
    backdrop-filter: blur(4px);
}

.vibe-glow {
    display: inline-block;
    filter: drop-shadow(0 0 5px var(--vibe-color));
    animation: vibe-float 2s ease-in-out infinite;
}

@keyframes vibe-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

/* 24. GEN-Z PREVIEW REFINEMENTS */
#previewContainer {
    transition: background-color 0.5s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#p-msg {
    word-break: break-word;
    white-space: pre-wrap;
}

/* 25. SAFETY WARNINGS */
.conflict-shake {
    animation: shake 0.4s ease-in-out;
    border-color: #ef4444 !important;
}

/* 26. CUSTOM BUTTON OVERRIDES */
#submitBtn:active {
    transform: scale(0.96);
}

#submitBtn:disabled {
    opacity: 0.5;
    filter: grayscale(1);
    cursor: not-allowed;
}

/* 27. NATIVE LEGEND PREVIEW SYSTEM */
@keyframes strike {
    0% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); filter: drop-shadow(0 0 5px #facc15); }
    100% { opacity: 0.3; transform: scale(0.8); }
}

.bolt-active { 
    animation: strike 1s infinite; 
    display: inline-block; 
    margin-right: 4px; 
}

.native-legend-preview-tag {
    background: linear-gradient(90deg, #facc15, #fbbf24);
    color: #000;
    font-size: 8px;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    box-shadow: 0 4px 12px rgba(250, 204, 21, 0.3);
    margin-right: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
}

/* 28. GUARDIAN APPRECIATION SYSTEM */
.report-success-glow {
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.4) !important;
    border: 2px solid #6366f1 !important;
    transition: all 0.5s ease;
}

#reportSuccess {
    animation: reportSuccessFadeIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes reportSuccessFadeIn {
    from { 
        opacity: 0; 
        transform: scale(0.9) translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

/* Fix for the Submit Button scaling on Post page */
#submitBtn:disabled { 
    background-color: #94a3b8 !important; 
    cursor: not-allowed; 
    transform: none !important; 
    box-shadow: none !important; 
    opacity: 0.6;
}

/* --- ADD TO DEDICATED STYLESHEET --- */

/* Report Modal & Overlay */
#reportModal {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.8); 
    backdrop-filter: blur(12px); display: none; align-items: center; 
    justify-content: center; z-index: 5000; padding: 20px;
}

/* Dynamic Scroll Button */
#dynamic-scroll-btn { 
    position: fixed; right: 25px; bottom: 30px; z-index: 1000; opacity: 0; 
    pointer-events: none; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    transform: translateY(20px);
}
#dynamic-scroll-btn.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }

.custom-scroll-pill { 
    background: #6366f1; color: white; width: 54px; height: 54px; 
    display: flex; align-items: center; justify-content: center; 
    border-radius: 18px; box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4); 
    transition: all 0.3s ease; 
}

#scrollIcon { transition: transform 0.4s ease, opacity 0.3s ease; }
.icon-flip { transform: rotate(180deg); }
.icon-fade { opacity: 0; }

/* --- POST.HTML REFINEMENTS & DYNAMIC THEMING --- */

/* 1. Enhanced Dialect Glow System */
/* This handles the smooth color transition when the AI detects a language */
.dialect-glow {
    position: relative;
    border-color: var(--glow-color) !important;
    background-color: var(--glow-bg) !important;
    box-shadow: 0 10px 40px -10px var(--glow-bg), inset 0 0 20px var(--glow-bg) !important;
    transform: translateY(-4px) scale(1.01);
    transition: all 0.7s cubic-bezier(0.23, 1, 0.32, 1);
}

/* 2. Dark Mode Support for Glow */
/* In dark mode, we use a slightly more opaque background tint so the color pops */
.dark .dialect-glow {
    background-color: rgba(30, 41, 59, 0.7) !important; /* Slate-800 with transparency */
    border-color: var(--glow-color) !important;
    box-shadow: 0 0 30px -5px var(--glow-color), inset 0 0 10px var(--glow-color) !important;
}

/* 3. Vibe Chip & Emoji Glow */
/* Makes the vibe emoji glow with its specific mood color */
.vibe-glow {
    display: inline-block;
    filter: drop-shadow(0 0 8px var(--vibe-color));
    animation: vibe-float 2s ease-in-out infinite;
}

@keyframes vibe-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* 4. Smooth Preview Transitions */
/* Prevents the preview box from "jumping" when the text content expands */
#previewContainer {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 200px;
    position: relative;
    overflow: hidden;
}

/* 5. Character Count Warning */
/* Changes color when the user is approaching the 2000 limit */
.char-limit-near {
    color: #ef4444 !important;
    font-weight: 800;
}

/* 6. Fix for Mobile Safari Input Zoom */
@media screen and (max-width: 768px) {
    input, textarea, select {
        font-size: 16px !important; /* Prevents auto-zoom on focus */
    }
}