/*
 * EnhancedBox CSS Styles
 * Version: 7.2
 * Description: Comprehensive stylesheet for EnhancedBox notification library
 * Author: EnhancedBox Team
 * 
 * Table of Contents:
 * 1. Particle Effects
 * 2. Core Message Box Styles
 * 3. Positioning Classes
 * 4. Type-based Styling
 * 5. Interactive Elements (Forms, Buttons, etc.)
 * 6. Tooltip and Attachment Styles
 * 7. Animations and Transitions
 * 8. Responsive Design
 */

/* ========================================================================
   1. PARTICLE EFFECTS
   ========================================================================
   Visual effects system for celebrations, snow, fireworks, etc.
   Uses CSS custom properties for dynamic sizing and positioning.
   ======================================================================== */

/* Celebration particles - burst effect with scaling and rotation */
    .particle {
        position: absolute;
        left: 50%;                /* Center horizontally */
        top: 50%;                 /* Center vertically */
        width: var(--size, 8px);  /* Dynamic size via CSS custom properties */
        height: var(--size, 8px); /* Square particles by default */
        border-radius: var(--radius, 50%); /* Circular by default, can be overridden */
        opacity: 0;               /* Start invisible for animation */
        animation: celebrate 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }
    /* Celebration animation - particles burst outward with rotation and scaling */
    @keyframes celebrate {
        0% { 
            opacity: 1; 
            transform: translate(0, 0) scale(1) rotate(0deg); 
        }
        60% { 
            transform: translate(calc(var(--x) * 0.8), calc(var(--y) * 0.8)) scale(1.2) rotate(var(--rotation)); 
        }
        100% { 
            opacity: 0; 
            transform: translate(var(--x), var(--y)) scale(0.5) rotate(calc(var(--rotation) * 2)); 
        }
    }

    /* Confetti particles - fall from top with horizontal drift and rotation */
    .confetti {
        position: absolute;
        width: var(--size, 8px);
        height: var(--size, 8px);
        border-radius: var(--radius, 50%);
        opacity: 0;
        animation: fallConfetti linear forwards;
    }
    /* Confetti animation - vertical fall with horizontal drift and rotation */
    @keyframes fallConfetti {
        0% { 
            opacity: 1; 
            transform: translateX(0) rotate(0deg); 
        }
        50% { 
            transform: translateX(var(--drift)) rotate(180deg); /* Mid-fall drift */
        }
        100% { 
            top: 110%; 
            opacity: 0; 
            transform: translateX(0) rotate(360deg); /* Complete rotation */
        }
    }

    /* Snow particles - gentle falling motion with subtle drift */
    .snowflake {
        position: absolute;
        width: var(--size, 6px);
        height: var(--size, 6px);
        opacity: 0.9;
        animation: fallSnow linear forwards;
    }
    /* Snowfall animation - slow, drifting descent */
    @keyframes fallSnow {
        0% { 
            opacity: 1; 
            transform: translateX(0); 
        }
        50% { 
            transform: translateX(var(--drift)); /* Gentle horizontal drift */
        }
        100% { 
            top: 110%; 
            opacity: 0.7; 
            transform: translateX(0); 
        }
    }

    /* Sparkle particles - twinkling effect with scale animation */
    .sparkle {
        position: absolute;
        width: var(--size, 4px);
        height: var(--size, 4px);
        opacity: 0;
        animation: sparkleAnim ease-in-out forwards;
    }
    /* Sparkle animation - fade in/out with scaling for twinkling effect */
    @keyframes sparkleAnim {
        0%, 100% { 
            opacity: 0; 
            transform: scale(0.5); 
        }
        50% { 
            opacity: 1; 
            transform: scale(1); /* Peak brightness and size */
        }
    }



    /* Firework trail particles - vertical launch effect */
    .firework {
        position: absolute;
        bottom: 0;
        width: 4px;
        height: 12px;
        border-radius: 2px;
        animation: fireworkLaunch 1.2s ease-out forwards;
    }

    /* Firework launch animation - shoots upward before exploding */
    @keyframes fireworkLaunch {
        0% { 
            transform: translateY(0); 
            opacity: 1; 
        }
        100% { 
            transform: translateY(-300px); /* Launch height */
            opacity: 0; 
        }
    }


    /* Bubble particles - rising from bottom with floating motion */
    .bubble {
        position: absolute;
        bottom: -20px;
        width: var(--size);
        height: var(--size);
        border-radius: 50%;
        background: rgba(173, 216, 230, 0.5);
        animation: bubbleRise linear forwards;
    }

    /* Bubble rise animation - float upward with gentle side-to-side motion */
    @keyframes bubbleRise {
        0% { 
            transform: translateX(0) translateY(0); 
            opacity: 0.6; 
        }
        50% { 
            transform: translateX(-10px) translateY(-50vh); /* Mid-rise drift */
        }
        100% { 
            transform: translateX(10px) translateY(-100vh); /* Full rise */
            opacity: 0; 
        }
    }


    /* Leaf particles - natural falling motion with rotation */
    .leaf {
        position: absolute;
        width: 20px;
        height: 20px;
        transform-origin: center center;
        animation: leafFall var(--duration) ease-in-out forwards;
    }

    /* Leaf fall animation - realistic swaying motion as leaves fall */
    @keyframes leafFall {
        0% { 
            transform: translateX(0) translateY(0) rotate(0deg); 
            opacity: 1; 
        }
        25% { 
            transform: translateX(calc(var(--drift)/2)) translateY(25vh) rotate(calc(var(--rotation)/4)); 
        }
        50% { 
            transform: translateX(calc(var(--drift))) translateY(50vh) rotate(calc(var(--rotation)/2)); 
        }
        75% { 
            transform: translateX(calc(var(--drift)/1.5)) translateY(75vh) rotate(calc(var(--rotation)*0.75)); 
        }
        100% { 
            transform: translateX(0) translateY(100vh) rotate(var(--rotation)); 
            opacity: 0; 
        }
    }


    /* Water ripple effect particles */
    .ripple {
        position: absolute;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        border: 2px solid rgba(0,150,255,0.5);
        opacity: 0.7;
        animation: rippleEffect 2s ease-out forwards;
    }

    /* Ripple effect animation - expanding circles that fade out */
    @keyframes rippleEffect {
        0% { 
            transform: scale(0); 
            opacity: 0.7; 
        }
        50% { 
            transform: scale(2); 
            opacity: 0.5; 
        }
        100% { 
            transform: scale(3); /* Maximum expansion */
            opacity: 0; 
        }
    }

    /* Water drip particles - falling droplets */
    .drip {
        position: absolute;
        top: -30px;
        border-radius: 50% 50% 100% 100%;
        animation: dripFall linear forwards;
        opacity: 0.8;
    }

    /* Drip fall animation - water droplets falling with deformation */
    @keyframes dripFall {
        0% { 
            transform: translateY(0) scaleY(1); 
            opacity: 0.8; 
        }
        50% { 
            transform: translateY(50vh) scaleY(1.2); /* Elongate mid-fall */
        }
        100% { 
            transform: translateY(100vh) scaleY(0.8); /* Compress on impact */
            opacity: 0; 
        }
    }

    /* Spark particles - electric/energy effect with shake animation */
    .spark {
        position: absolute;
        border-radius: 50%;
        animation: shake 0.4s ease-in-out infinite alternate;
    }

    /* Shake animation - rapid vibration effect for sparks */
    @keyframes shake {
        0% { transform: translate(0,0); }
        25% { transform: translate(2px,-2px); }
        50% { transform: translate(-2px,2px); }
        75% { transform: translate(1px,-1px); }
        100% { transform: translate(-1px,1px); }
    }

/* ========================================================================
   2. CORE MESSAGE BOX STYLES
   ========================================================================
   Main styling for message boxes including backdrop, containers, and
   base appearance. Uses glassmorphism design with blur effects.
   ======================================================================== */


        /* Modal backdrop - semi-transparent overlay with blur effect */
        .message-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);  /* Semi-transparent black */
            backdrop-filter: blur(5px);       /* Blur background content */
            z-index: 9998;                    /* Below message box */
            opacity: 0;                       /* Start invisible */
            transition: opacity 0.3s ease;    /* Smooth fade in/out */
        }

        /* Backdrop visible state */
        .message-backdrop.show {
            opacity: 1;
        }

        /* Main message box container - glassmorphism design */
        .message-box {
            position: fixed;
            z-index: 9999;                              /* Above backdrop */
            width: 80%;
            max-width: 500px;                           /* Reasonable max size */
            padding: 20px;
            border-radius: 15px;                        /* Rounded corners */
            backdrop-filter: blur(20px);                /* Strong glass effect */
            border: 1px solid rgba(255, 255, 255, 0.2); /* Subtle border */
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);  /* Depth shadow */
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            transform: translateY(-50px);               /* Start position (above) */
            opacity: 0;                                  /* Start invisible */
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Smooth animation */
        }

        /* Message box visible state - slide in from top */
        .message-box.show {
            transform: translateY(0);  /* Final position */
            opacity: 1;                /* Fully visible */
        }

        /* Message box hide state - slide out to top */
        .message-box.hide {
            transform: translateY(-50px); /* Exit position */
            opacity: 0;                    /* Fade out */
        }

/* ========================================================================
   3. POSITIONING CLASSES
   ========================================================================
   Predefined positions for message boxes on screen. Each position has
   specific transform handling for proper animation entry/exit.
   ======================================================================== */
        /* Top center positioning with horizontal centering */
        .message-box.top-center {
            top: 20px;
            left: 50%;
            transform: translateX(-50%) translateY(-50px); /* Center horizontally, start above */
        }

        /* Top center visible state */
        .message-box.top-center.show {
            transform: translateX(-50%) translateY(0); /* Maintain horizontal center */
        }

        /* Top center hide state */
        .message-box.top-center.hide {
            transform: translateX(-50%) translateY(-50px); /* Exit upward, maintain center */
        }

        /* Top right positioning - fixed to upper right corner */
        .message-box.top-right {
            top: 20px;
            right: 20px; /* Fixed distance from edge */
        }

        /* Center positioning - perfect center of viewport */
        .message-box.center {
            top: 50%;
            left: 50%;
            transform: translateX(-50%) translateY(-50%) translateY(-50px); /* Center both axes, start above */
        }

        /* Center visible state */
        .message-box.center.show {
            transform: translateX(-50%) translateY(-50%) translateY(0); /* Maintain center, no vertical offset */
        }

        /* Center hide state */
        .message-box.center.hide {
            transform: translateX(-50%) translateY(-50%) translateY(-50px); /* Exit upward from center */
        }

        /* Bottom center positioning with horizontal centering */
        .message-box.bottom-center {
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%) translateY(50px); /* Center horizontally, start below */
        }

        /* Bottom center visible state */
        .message-box.bottom-center.show {
            transform: translateX(-50%) translateY(0); /* Slide up to final position */
        }

        /* Bottom center hide state */
        .message-box.bottom-center.hide {
            transform: translateX(-50%) translateY(50px); /* Exit downward */
        }

/* ========================================================================
   4. TYPE-BASED STYLING
   ========================================================================
   Different message types (info, success, warning, etc.) with distinct
   color schemes using gradient backgrounds for glassmorphism effect.
   ======================================================================== */
        /* Info type - blue theme for informational messages */
        .message-box.info {
            background: linear-gradient(135deg, rgba(23, 162, 184, 0.3) 0%, rgba(23, 162, 184, 0.1) 100%);
        }

        /* Success type - green theme for success confirmations */
        .message-box.success {
            background: linear-gradient(135deg, rgba(40, 167, 69, 0.3) 0%, rgba(40, 167, 69, 0.1) 100%);
        }

        /* Warning type - yellow/orange theme for warnings */
        .message-box.warning {
            background: linear-gradient(135deg, rgba(255, 193, 7, 0.3) 0%, rgba(255, 193, 7, 0.1) 100%);
        }

        /* Danger type - red theme for errors and critical alerts */
        .message-box.danger {
            background: linear-gradient(135deg, rgba(220, 53, 69, 0.3) 0%, rgba(220, 53, 69, 0.1) 100%);
        }

        /* Primary type - blue theme for primary actions */
        .message-box.primary {
            background: linear-gradient(135deg, rgba(0, 123, 255, 0.3) 0%, rgba(0, 123, 255, 0.1) 100%);
        }

        /* Loading type - gray theme for loading states */
        .message-box.loading {
            background: linear-gradient(135deg, rgba(108, 117, 125, 0.3) 0%, rgba(108, 117, 125, 0.1) 100%);
        }

/* ========================================================================
   5. INTERACTIVE ELEMENTS
   ========================================================================
   Styling for buttons, forms, inputs, and other interactive components
   within message boxes. Includes hover states and transitions.
   ======================================================================== */

/* Action buttons - primary and secondary button styling */
.action-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;    /* Smooth hover effects */
    padding: 10px;
    margin: 5px 0;
}

/* Primary action button - main call-to-action styling */
.action-btn.primary {
    height: 42px;
    width: 140px;
    background: rgba(0, 123, 255, 0.5); /* Semi-transparent blue */
}

/* Secondary action button - cancel/dismiss styling */
.action-btn.secondary {
    height: 42px;
    width: 140px;
    background: rgba(255, 255, 255, 0.2); /* Semi-transparent white */
}

/* Container for action buttons with flexbox layout */
.message-actions {
    display: flex;
    gap: 10px;                    /* Space between buttons */
    row-gap: 10px;
    column-gap: 10px;
    margin-top: 10px;
    flex-direction: row;          /* Horizontal layout */
    flex-wrap: nowrap;            /* Keep buttons on same line */
    align-content: flex-start;
    justify-content: space-between; /* Distribute buttons evenly */
}

/* Container for custom buttons */
.message-button-container {
    margin-top: 15px;
    text-align: center; /* Center align custom buttons */
}

/* Containers for form elements with consistent spacing */
.message-rating-container,
.message-slider-container {
    margin: 15px 0; /* Vertical spacing around form elements */
}
/* Labels for form elements - consistent styling */
.toggle-label,
.rating-label,
.slider-label {
    display: block;
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 500; /* Semi-bold for better visibility */
}

/* Star rating system - interactive star selection */
.message-rating {
    display: flex;
    justify-content: center; /* Center align stars */
    gap: 5px;                /* Space between stars */
}

/* Individual rating star styling */
.rating-star {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.3); /* Dim when unselected */
    cursor: pointer;
    transition: color 0.2s ease;      /* Smooth color transition */
    user-select: none;                /* Prevent text selection */
}

/* Rating star hover and selected states */
.rating-star:hover,
.rating-star.selected {
    color: #ffd700; /* Gold color for active/hovered stars */
}

/* Tooltip-specific star styling */
.message-box .tooltip-stars .tooltip-star.selected {
    color: #ffc107; /* Slightly different gold for tooltips */
}


/* Range slider container with flexbox layout */
.message-slider {
    display: flex;
    align-items: center; /* Vertically center slider and value */
    gap: 10px;           /* Space between slider and value display */
    width: 100%;
}

/* Range input slider styling */
.slider-input {
    flex: 1;                              /* Take available space */
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.3); /* Semi-transparent track */
    outline: none;                        /* Remove focus outline */
    -webkit-appearance: none;             /* Remove default styling */
    cursor: pointer;
}

/* Webkit slider thumb (Chrome, Safari) */
.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;           /* Circular thumb */
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Subtle shadow for depth */
}

/* Firefox slider thumb */
.slider-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;           /* Circular thumb */
    background: white;
    cursor: pointer;
    border: none;                 /* Remove default border */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Match webkit styling */
}

/* Slider value display - shows current value */
.slider-value {
    min-width: 30px;                          /* Minimum width for alignment */
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.2);     /* Semi-transparent background */
    padding: 4px 8px;
    border-radius: 4px;                       /* Rounded corners */
}



/* Toggle switch container */
.message-toggle {
    display: flex;
    align-items: center;           /* Vertically center label and switch */
    justify-content: space-between; /* Push label left, switch right */
    margin: 15px 0;
    border-radius: 6px;
    cursor: pointer;               /* Entire area is clickable */
}

/* Toggle switch label */
.toggle-label {
    font-size: 14px;
    cursor: pointer;
    flex: 1;           /* Take available space */
    user-select: none; /* Prevent text selection */
}

/* Toggle switch container dimensions */
.toggle-switch {
    position: relative;
    width: 50px;  /* Switch width */
    height: 24px; /* Switch height */
}

/* Hidden toggle input - we style the label instead */
.toggle-input {
    opacity: 0;  /* Invisible but still functional */
    width: 0;
    height: 0;
}

/* Toggle slider track - the background of the switch */
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.5); /* Default off state */
    transition: .3s;                             /* Smooth state changes */
    border-radius: 24px;                         /* Rounded pill shape */
}

/* Toggle slider thumb - the moveable circle */
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #6b748187;  /* Neutral gray thumb */
    transition: .3s;              /* Smooth movement */
    border-radius: 50%;           /* Perfect circle */
}


/* Toggle switch active state - when checked */
.toggle-input:checked + .toggle-slider {
    background-color: rgba(255, 255, 255, 0.8); /* Brighter background when on */
}

/* Toggle thumb active position - slide to right when checked */
.toggle-input:checked + .toggle-slider:before {
    transform: translateX(26px); /* Move thumb to right side */
}
/* Alternative checkbox styling for toggle */
.message-toggle input[type="checkbox"] {
    cursor: pointer;
    transform: scale(1.2); /* Slightly larger for easier clicking */
}



/* Custom buttons and link buttons - consistent styling */
.message-link-button,
.message-custom-button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3); /* Subtle border */
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;    /* Smooth hover effects */
    float: right;                 /* Align to right */
    border-color: #ffffff26;
    margin-right: 7px;
}
/* ========================================================================
   6. TOOLTIP AND ATTACHMENT STYLES
   ========================================================================
   Specialized styling for tooltips attached to DOM elements.
   Includes arrow indicators, positioning, and compact display modes.
   ======================================================================== */

/* Tooltip mode base styling - compact and unobtrusive */
.message-box.tooltip-mode {
    /* Start completely invisible */
    opacity: 0;
    visibility: hidden;

    /* Ensure NO animation or transition runs on this element initially */
    transition: none;
    transform: none; /* Keep this to override any lingering default transforms */
}

/* Attachment base styling - for boxes attached to DOM elements */
.message-box.attached {
    position: fixed !important; /* Override any other positioning */
    z-index: 10000;            /* Above regular message boxes */
    max-width: 300px;          /* Reasonable max size for attachments */
}

/* Arrow base styling - creates pointing triangle for attachments */
.message-box.attached::before {
    content: '';             /* Required for pseudo-elements */
    position: absolute;
    width: 0;
    height: 0;
    border: 8px solid transparent; /* Creates triangle shape */
    z-index: 1;
}

/* CSS Custom Properties for dynamic arrow colors */
.message-box.attached {
    --arrow-color: rgba(0, 0, 0, 0.0); /* Default transparent, overridden by JS */
}

/* Secondary arrow styling for enhanced arrow effect */
.message-box.attached::after {
    content: '';             /* Required for pseudo-elements */
    position: absolute;
    border-width: 6px;       /* Smaller than ::before for layered effect */
    border-style: solid;
    border-color: transparent; /* Default transparent */
}

/* Arrow pointing down - for tooltips appearing ABOVE the target element */
.message-box.attached.attach-top::after {
    top: 100%;                              /* Position below the tooltip box */
    left: 15px;                             /* 15px from left edge (not centered) */
    transform: none;                        /* No centering transform */
    border-top-color: var(--arrow-color, #333); /* Arrow points down */
}

/* Arrow pointing up - for tooltips appearing BELOW the target element */
.message-box.attached.attach-bottom::after {
    bottom: 100%;                           /* Position above the tooltip box */
    left: 15px;                             /* 15px from left edge (not centered) */
    transform: none;                        /* No centering transform */
    border-bottom-color: var(--arrow-color, #333); /* Arrow points up */
}

/* Arrow pointing right - for tooltips appearing to the LEFT of the target element */
.message-box.attached.attach-left::after {
    left: 100%;                             /* Position to the right of tooltip box */
    top: 15px;                              /* 15px from top edge (not centered) */
    transform: none;                        /* No centering transform */
    border-left-color: var(--arrow-color, #333); /* Arrow points right */
}

/* Arrow pointing left - for tooltips appearing to the RIGHT of the target element */
.message-box.attached.attach-right::after {
    right: 100%;                            /* Position to the left of tooltip box */
    top: 15px;                              /* 15px from top edge (not centered) */
    transform: none;                        /* No centering transform */
    border-right-color: var(--arrow-color, #333); /* Arrow points left */
}





/* Light mode arrow colors - overrides for light theme */
.message-box.light-mode.attached {
    --arrow-color: #f8f9fa; /* Light background color for arrows */
}

/* ========================================================================
   7. ANIMATIONS AND TRANSITIONS
   ========================================================================
   Specialized animations for tooltips, including fade in/out effects
   and responsive mobile animations.
   ======================================================================== */
.message-box.tooltip-mode.show {
    animation: tooltipFadeIn 0.2s ease-out;
}





.message-box.tooltip-mode.hide {
    animation: tooltipFadeOut 0.2s ease-in;
}

/* Tooltip fade-in animation - scale and slide effect */
@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);        /* Start slightly smaller */
    }
    to {
        opacity: 1;
        transform: scale(1);          /* End at normal size */
    }
}

/* Tooltip fade-out animation - reverse of fade-in */
@keyframes tooltipFadeOut {
    from {
        opacity: 1;
        transform: scale(1);          /* Start at normal size */
    }
    to {
        opacity: 0;
        transform: scale(0.9);        /* End slightly smaller */
    }
}

/* Responsive adjustments for tooltips */
@media (max-width: 768px) {
    .message-box.tooltip-mode {
        max-width: 200px;
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .message-box.tooltip-mode .message-title {
        font-size: 12px;
    }
    
    .message-box.tooltip-mode .message-text {
        font-size: 11px;
    }
    
    .message-box.attached::before {
        border-width: 6px;
    }
    
    .message-box.attached.attach-top::before {
        bottom: -12px;
    }
    
    .message-box.attached.attach-bottom::before {
        top: -12px;
    }
    
    .message-box.attached.attach-left::before {
        right: -12px;
    }
    
    .message-box.attached.attach-right::before {
        left: -12px;
    }
}
   






.tooltip-stars {
    display: block;
    margin-bottom: 5px;
    color: #ccc; /* Color for empty stars */
    font-size: 16px;
}

.tooltip-star.selected {
    color: #ffc107; /* Gold color for filled stars */
}

/* Tooltip Mode Compact Styling */
.message-box.tooltip-mode {
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 250px;
    word-wrap: break-word;
    overflow: visible; /* **ADD THIS LINE** */

}
.message-box.tooltip-mode {
    /* Reset any inherited fixed width or min-width */
    width: auto;
    min-width: 0;
    
    /* This is the key: it makes the box shrink to fit its text */
    width: max-content; 
    
    /* Set a sensible max-width to prevent very long tooltips */
    max-width: 250px; 
}

.message-box.tooltip-mode .message-header {
    margin: 0;
}

.message-box.tooltip-mode .message-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.message-box.tooltip-mode .message-text {
    font-size: 12px;
    line-height: 1.3;
    margin: 0;
}

.message-box.tooltip-mode .message-icon {
    width: 16px;
    height: 16px;
    font-size: 12px;
    margin-right: 6px;
}

.message-box.tooltip-mode .message-close {
    display: none; /* Hide close button in tooltip mode */
}

/* Swipe to Dismiss Visual Feedback */
.message-box[style*="transform"] {
    user-select: none;
    -webkit-user-select: none;
}

/* Swipe indicators (optional visual cues) */
.message-box.swipe-enabled::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    opacity: 0.7;
}

/* Light mode arrow colors */
.message-box.light-mode.attached.attach-top::before {
    border-top-color: #f8f9faa2;
}

.message-box.light-mode.attached.attach-bottom::before {
    border-bottom-color:#f8f9faa2;
}

.message-box.light-mode.attached.attach-left::before {
    border-left-color:#f8f9faa2;
}

.message-box.light-mode.attached.attach-right::before {
    border-right-color:#f8f9faa2;
}

/* Animation improvements for tooltips */
.message-box.tooltip-mode.show {
    animation: tooltipFadeIn 0.2s ease-out;
}

.message-box.tooltip-mode.hide {
    animation: tooltipFadeOut 0.2s ease-in;
}

/* Enhanced tooltip fade-in animation with vertical slide */
@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(5px); /* Start smaller and slightly below */
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);     /* End at normal size and position */
    }
}

/* Enhanced tooltip fade-out animation with vertical slide */
@keyframes tooltipFadeOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);     /* Start at normal size and position */
    }
    to {
        opacity: 0;
        transform: scale(0.9) translateY(5px); /* End smaller and slightly below */
    }
}

/* ========================================================================
   8. RESPONSIVE DESIGN
   ========================================================================
   Mobile-first responsive adjustments for better usability on smaller
   screens. Includes tooltip sizing and arrow positioning adjustments.
   ======================================================================== */
@media (max-width: 768px) {
    .message-box.tooltip-mode {
        max-width: 200px;
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .message-box.tooltip-mode .message-title {
        font-size: 12px;
    }
    
    .message-box.tooltip-mode .message-text {
        font-size: 11px;
    }
    
    .message-box.attached::before {
        border-width: 6px;
    }
    
    .message-box.attached.attach-top::before {
        bottom: -12px;
    }
    
    .message-box.attached.attach-bottom::before {
        top: -12px;
    }
    
    .message-box.attached.attach-left::before {
        right: -12px;
    }
    
    .message-box.attached.attach-right::before {
        left: -12px;
    }
}




        /* ========================================================================
           MESSAGE CONTENT STRUCTURE
           ========================================================================
           Core layout and styling for message box content including headers,
           icons, text, and close button positioning.
           ======================================================================== */

        /* Message header container - holds icon and content */
        .message-header {
            display: flex;
            align-items: center;      /* Vertically center icon and content */
            margin-bottom: 10px;
        }

        /* Message type icons - circular backgrounds with centered content */
        .message-icon {
            width: 34px;
            height: 34px;
            border-radius: 50%;               /* Perfect circle */
            display: flex;
            align-items: center;              /* Center icon vertically */
            justify-content: center;          /* Center icon horizontally */
            font-weight: bold;
            font-size: 16px;
            margin-right: 12px;               /* Space between icon and content */
            flex-shrink: 0;                   /* Don't shrink when space is limited */
            transition: opacity 2s ease;      /* Smooth fade-in effect */
        }

        /* Icon type-specific styling */
        .message-icon.blank { display: none; }                     /* Hidden for blank type */
        .message-icon.info { background: #17a2b8c4; }             /* Teal for info */
        .message-icon.success { background: #28a745c4; }          /* Green for success */
        .message-icon.warning { background: #ffc107c4; color: #212529; } /* Yellow with dark text */
        .message-icon.danger { background: #dc3545c4; }           /* Red for danger */
        .message-icon.primary { background: #007bffc4; }          /* Blue for primary */
        .message-icon.loading { background: #6c757dc4; }          /* Gray for loading */

        /* Content area container - flexible to take remaining space */
        .message-content {
            flex: 1; /* Take all available space after icon */
        }

        /* Message title styling */
        .message-title {
            font-size: 18px;
            font-weight: 600;        /* Semi-bold */
            margin-bottom: 5px;
        }

        .message-text {
            font-size: 14px;
            line-height: 1.4;
            opacity: 0.9;
        }

        .message-close {
            position: absolute;
            top: 10px;
            right: 10px;
            width: 24px;
            height: 24px;
            border: none;
            background: none;
            cursor: pointer;
            font-size: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: all 0.2s ease;
            opacity: 0.7;
        }

        .message-close:hover {
            opacity: 1;
            background: rgba(255, 255, 255, 0.1);
        }

        /* Progress bar for timer */
        .message-progress {
            position: absolute;
            bottom: 5px;
            left: 5px;
            right: 5px;
            height: 3px;
            background: transparent;
            border-radius: 2px;
            overflow: hidden;
        }

        .message-progress-bar {
            height: 100%;
            background: linear-gradient(90deg, #007bff, #00ff7f);
            transition: width linear;
            border-radius: 2px;
        }

       .message-progress-bar.info {
            background: linear-gradient(to right, rgba(23, 162, 184, 0) 0%, rgba(23, 162, 184, 0.77) 100%);
        }

        .message-progress-bar.success {
            background: linear-gradient(to right, rgba(40, 167, 69, 0) 0%, rgba(40, 167, 69, 0.77) 100%);
        }

        .message-progress-bar.warning {
            background: linear-gradient(to right, rgba(255, 193, 7, 0) 0%, rgba(255, 193, 7, 0.77) 100%);
        }

        .message-progress-bar.danger {
            background: linear-gradient(to right, rgba(220, 53, 69, 0) 0%, rgba(220, 53, 69, 0.77) 100%);
        }

        .message-progress-bar.primary {
            background: linear-gradient(to right, rgba(0, 123, 255, 0) 0%, rgba(0, 123, 255, 0.77) 100%);
        }

        .message-progress-bar.loading {
            background: linear-gradient(to right, rgba(108, 117, 125, 0) 0%, rgba(108, 117, 125, 0.77) 100%);
        }

        /* Loading specific styles */
        .loading-fill {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(40, 167, 69, 0.1);
            border-radius: 15px;
            transform: scaleX(0);
            transform-origin: left;
            transition: transform 0.5s ease;
        }

        .loading-fill.complete {
            transform: scaleX(1);
        }

        /* Input fields in message box */
        .message-inputs {
            margin-top: 15px;
        }

        .message-input {
            width: 100%;
            padding: 8px 12px;
            margin: 5px 0;
            border: 1px solid rgba(255, 255, 255, 0.3);
            border-radius: 5px;
            background: rgba(255, 255, 255, 0.1);
            font-size: 14px;
            box-sizing: border-box;
        }

        .message-input:focus {
            outline: none;
            border-color: #007bff;
            box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.3);
        }

        /* Options picker */
        .options-picker {
            margin-top: 15px;
        }

        .option-item {
            padding: 10px;
            margin: 5px 0;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 5px;
            cursor: pointer;
            transition: all 0.2s ease;
            border: 1px solid transparent;
        }

        .option-item:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        .option-item.selected {
            background: rgba(0, 123, 255, 0.3);
            border-color: #007bff;
        }

     .options-actions {
        display: flex;
        gap: 10px;
        row-gap: 10px;
        column-gap: 10px;
        margin-top: 15px;
        flex-direction: row;
        flex-wrap: nowrap;
        align-content: flex-start;
        justify-content: space-between;
    }
            .option-btn {
            padding: 8px 16px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.2s ease;
            padding: 10px;
            margin: 5px 0;
        }

        .option-btn.primary { height: 36px;width:100px;    background: rgba(0, 123, 255, 0.5);  }
        .option-btn.secondary {height: 36px;width:100px;background:rgba(255, 255, 255, 0.2);  }

        .option-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
        }

        .message-table {
        width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.message-table th,
.message-table td {
    border: 1px solid #dddddd33;
    padding: 8px;
    text-align: left;
}

.message-table th {
    background-color: #f2f2f230;
    font-weight: bold;
}

.message-table tr:nth-child(even) {
    background-color: #f9f9f913;
}

.message-input.error {
    border-color: #ff4444bd;
    background-color: #ff0c0c1a;
}




.option-item.selected:hover {
    background-color: #0057b38a;
}

        /* Mobile optimizations */
        @media (max-width: 768px) {
            .message-box {
                width: 85%;
                max-width: 85vw;
                padding: 16px;
            }

            .message-box.compact {
                width: 85%;
                max-width: 85vw;
            }

            .message-title {
                font-size: 16px;
            }

            .message-text {
                font-size: 14px;
            }

            .demo-buttons {
                flex-direction: column;
            }

            .demo-btn {
                width: 100%;
                margin-bottom: 10px;
            }
        }

