* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    min-height: 100dvh;
    overscroll-behavior-y: none;
    transition: background-color 0.3s ease, color 0.3s ease;
    
    /* Locks the screen like a native app */
    -webkit-user-select: none; 
    user-select: none; 
    -webkit-touch-callout: none; 
}

/* Ensures users can still type and edit text */
input, textarea {
    -webkit-user-select: auto !important;
    user-select: auto !important;
}

/* Scrollbar Control */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Animations */
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

.animate-slideUp {
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-fadeIn {
    animation: fadeIn 0.2s ease-out forwards;
}

/* Dark Mode Inputs */
.dark input[type="text"],
.dark input[type="email"],
.dark input[type="url"],
.dark input[type="password"] {
    background-color: #1e1e1e !important;
    color: #f5f5f5 !important;
    border-color: #333333 !important;
}

.glass-effect {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

@keyframes fill-progress {
    from { width: 0%; }
    to { width: 100%; }
}

.filter-btn {
    background-color: rgba(0, 0, 0, 0.4);
    color: white;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    backdrop-filter: blur(5px);
}

/* Hotpost Text Overlay */
.hotpost-text-overlay-input {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    text-shadow: 0px 4px 16px rgba(0,0,0,0.9), 0px 1px 4px rgba(0,0,0,0.6);
    outline: none;
    width: 90%;
    z-index: 25;
}

.hotpost-text-overlay-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* =========================================================
   ULTIMATE HOTPOSTS ENGINE (Native UI & Gestures)
   ========================================================= */

/* 1. Bulletproof Touch Locks */
#modal-hotpost-camera,
#modal-view-hotpost,
#modal-story-details {
    touch-action: none !important;
    overscroll-behavior: none !important;
    -webkit-user-select: none;
    user-select: none;
}

/* ==========================================
   2. HOTPOST TEXT BOUNDING BOX TOOL
   ========================================== */
.text-widget {
    position: absolute;
    transform-origin: center center;
    z-index: 50;
}
.text-widget-box {
    position: relative;
    border: 1.5px solid transparent;
    padding: 10px 16px;
}
/* Show borders and handles only when active */
.text-widget.active .text-widget-box {
    border-color: rgba(255, 255, 255, 0.9);
}
.text-handle {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 60;
    cursor: pointer;
}
.text-widget.active .text-handle {
    display: flex;
}

/* Position the 5 Tool Handles */
.handle-tl { top: -16px; left: -16px; background: #1f1f1f; border: 2px solid #444; } /* Delete X */
.handle-tr { top: -16px; right: -16px; background: #ff2a5f; } /* Edit Pencil */
.handle-bl { bottom: -16px; left: -16px; background: #ff2a5f; } /* Duplicate */
.handle-br { bottom: -16px; right: -16px; background: #ff2a5f; } /* Scale Arrows */
.handle-rm { top: 50%; right: -12px; transform: translateY(-50%); background: #ff2a5f; width: 24px; height: 24px; } /* Width Adjuster */

/* The Text Itself */
.text-widget-content {
    word-wrap: break-word;
    white-space: pre-wrap;
    text-align: center;
    color: white;
    font-weight: 800;
    line-height: 1.2;
    text-shadow: 0 0 20px rgba(0,0,0,0.9);
    min-width: 50px;
    min-height: 28px;
}

/* 3. Doodle Canvas Layer */
#hotpost-doodle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Container handles the drawing touches */
    z-index: 40;
}

/* 4. Snapchat-Style Filter Toast Animations */
@keyframes fadeOutUp {
    0% { opacity: 0; transform: translate(-50%, -40%) scale(0.9); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -60%) scale(0.9); }
}

.filter-name-toast {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 2.5rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-shadow: 0px 4px 25px rgba(0, 0, 0, 0.9), 0px 0px 15px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 60;
    opacity: 0; 
}

/* 5. Custom Modal Animations */
@keyframes popIn {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

.animate-popIn {
    animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 6. Native 3D Push-Back Effect for Stories */
#hotpost-viewer-content {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease, border-radius 0.4s ease;
    transform-origin: center top; 
    background-color: #000;
}

.viewer-pushed-back {
    transform: scale(0.92) translateY(2vh) !important;
    opacity: 0.4 !important;
    border-radius: 24px !important;
    overflow: hidden;
}

/* =========================================================
   NATIVE SAFE AREA (NOTCH & HOME BAR) SUPPORT
   ========================================================= */
.safe-pt {
    padding-top: env(safe-area-inset-top, 0px) !important;
}

.safe-pb {
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px)) !important;
}

.modal-header-safe {
    padding-top: env(safe-area-inset-top, 0px) !important;
    min-height: calc(4rem + env(safe-area-inset-top, 0px));
}

/* =========================================================
   PROFESSIONAL SHIMMER LOADING ENGINE
   ========================================================= */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.shimmer-bg {
    background: linear-gradient(to right, rgba(130, 130, 130, 0.1) 8%, rgba(130, 130, 130, 0.25) 18%, rgba(130, 130, 130, 0.1) 33%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear forwards;
}

.dark .shimmer-bg {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.05) 8%, rgba(255, 255, 255, 0.12) 18%, rgba(255, 255, 255, 0.05) 33%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear forwards;
}

/* The satisfying Like Pop Animation */
.like-pop {
    animation: heartPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes heartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}
@keyframes storyDoubleTapHeart {
    0% { transform: scale(0) rotate(-15deg); opacity: 0; }
    15% { transform: scale(1.2) rotate(0deg); opacity: 1; }
    30% { transform: scale(1) rotate(0deg); opacity: 1; }
    80% { transform: scale(1) rotate(0deg); opacity: 1; }
    100% { transform: scale(0.8) translateY(-20px); opacity: 0; }
}
/* =========================================================
   MODERN CONTEXT-AWARE PULL-TO-REFRESH STYLES
   ========================================================= */
@keyframes ptr-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ptr-loading-icon {
    animation: ptr-spin 0.8s linear infinite !important;
    color: #6200ee !important; 
}

#ptr-container {
    user-select: none;
    -webkit-user-select: none;
    will-change: transform, opacity;
}

.ptr-dragging-active {
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
}

/* Pen Size Slider */
.pen-size-slider {
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;
    width: 8px;
    height: 120px;
    background: rgba(0, 0, 0, 0.4);
    outline: none;
    border-radius: 10px;
    backdrop-filter: blur(4px);
}
.pen-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* Draggable Background Image */
#hotpost-preview-img {
    transform-origin: center center;
    transition: filter 0.3s ease;
    will-change: transform, filter;
}

/* Dashboard Hotpost Upload Spinner */
@keyframes uploadSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.hotpost-uploading-ring {
    border: 2px dashed #006e1c !important;
    background: transparent !important;
    animation: uploadSpin 2s linear infinite;
}
/* =========================================================
   QUILL.JS MENTIONS LISTVIEW ENHANCEMENT
   ========================================================= */
.ql-mention-list-container {
    width: 260px !important;
    border: 1px solid rgba(150, 150, 150, 0.2) !important;
    border-radius: 16px !important;
    background-color: #ffffff !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1) !important;
    overflow: hidden !important;
    z-index: 200 !important;
    padding: 4px !important;
}

.dark .ql-mention-list-container {
    background-color: #1e1e1e !important;
    border-color: #333333 !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
}

.ql-mention-list-item {
    padding: 10px 12px !important;
    cursor: pointer !important;
    border-radius: 12px !important;
    transition: background-color 0.2s ease, transform 0.1s;
    margin-bottom: 2px;
}

.ql-mention-list-item:last-child {
    margin-bottom: 0;
}

.ql-mention-list-item.selected,
.ql-mention-list-item:hover {
    background-color: rgba(0, 110, 28, 0.1) !important; /* Primary color hint */
    transform: scale(0.98);
}

.dark .ql-mention-list-item.selected,
.dark .ql-mention-list-item:hover {
    background-color: rgba(120, 220, 119, 0.15) !important;
}

/* Fix mention tag pill inside the actual text editor */
.mention {
    background-color: rgba(0, 110, 28, 0.15);
    color: #006e1c;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: bold;
}

.dark .mention {
    background-color: rgba(120, 220, 119, 0.2);
    color: #78dc77;
}
/* =========================================================
   INTERACTIVE FEED & COMMENT MENTIONS (Instagram Style)
   ========================================================= */
.rich-text-content .mention {
    background-color: transparent !important;
    color: #006e1c;
    padding: 0 !important;
    border-radius: 0 !important;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease;
    text-decoration: none !important;
    display: inline;
}

.rich-text-content .mention:hover {
    background-color: transparent !important;
    opacity: 0.7;
    transform: none !important;
}

.dark .rich-text-content .mention {
    background-color: transparent !important;
    color: #78dc77;
}

/* Ensure the @ symbol inside the mention matches the styling */
.rich-text-content .mention .ql-mention-denotation-char {
    margin-right: 0px;
}

/* =========================================================
   MINI QUILL EDITOR FOR COMMENTS
   ========================================================= */
#comment-rich-text-wrapper .ql-container.ql-snow {
    border: none !important;
    font-family: inherit;
    font-size: 13px;
}
#comment-rich-text-wrapper .ql-editor {
    padding: 12px 16px;
    min-height: 44px;
    max-height: 100px;
    overflow-y: auto;
}
#comment-rich-text-wrapper .ql-editor.ql-blank::before {
    left: 16px;
    font-style: normal;
    font-weight: 500;
    color: rgba(150,150,150,0.8);
}
/* =========================================================
   QUILL TOOLBAR MOBILE FIXES
   ========================================================= */
.ql-toolbar.ql-snow {
    display: block !important;
    border: none !important;
    border-bottom: 1px solid rgba(150, 150, 150, 0.2) !important;
    background-color: transparent !important;
    padding: 10px 8px !important;
    white-space: normal !important; /* Prevents wrapping bugs on mobile */
    border-radius: 16px 16px 0 0 !important;
}

.ql-container.ql-snow {
    border: none !important;
}

/* Ensure toolbar buttons have enough touch space */
.ql-toolbar.ql-snow button {
    width: 32px !important;
    height: 32px !important;
    margin-right: 2px !important;
}

/* Comment Swipe-to-Delete Physics */
.comment-swipe-container {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}
.comment-swipe-track {
    position: relative;
    z-index: 10;
    transition: transform 0.2s ease-out;
    background-color: inherit;
}
.comment-delete-bg {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 100%;
    background-color: #ff3b30;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 20px;
    z-index: 1;
}
/* Prevent text highlighting when tapping mentions */
.rich-text-content .mention {
    -webkit-user-select: none !important;
    user-select: none !important;
}
