﻿/* ===== Floating Popup Styles ===== */

.floating-popup {
    position: fixed;
    min-width: 200px;
    min-height: 150px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color:var(--rz-black);
}

    /* Header */
    .floating-popup .popup-header {
        color: white;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        min-height: 48px;
    }

        .floating-popup .popup-header.draggable {
            cursor: move;
            user-select: none;
        }

    .floating-popup .popup-title {
        font-weight: 600;
        font-size: 14px;
        flex: 1;
    }

    /* Body */
    .floating-popup .popup-body {
        flex: 1;
        overflow: auto;
        padding: 16px;
    }

    /* Resize Handle */
    .floating-popup .resize-handle {
        position: absolute;
        right: 0;
        bottom: 0;
        width: 20px;
        height: 20px;
        cursor: nwse-resize;
        background: linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, 0.1) 50%);
    }

        .floating-popup .resize-handle:hover {
            background: linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, 0.2) 50%);
        }

/* ===== Popup Close Button Styles ===== */

/* Default close button */



/* Generic popup-close class - can be applied to any element */
.popup-close {
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s ease;
}

    .popup-close:hover {
        opacity: 0.8;
    }

    .popup-close:active {
        opacity: 0.6;
    }

    /* Close icon variants */
    .popup-close.close-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        border-radius: 4px;
    }

        .popup-close.close-icon:hover {
            background: rgba(0, 0, 0, 0.05);
        }

    /* Close button variants */
    .popup-close.close-button {
        padding: 8px 16px;
        border: 1px solid #ddd;
        border-radius: 4px;
        background: white;
        color: #333;
    }

        .popup-close.close-button:hover {
            background: #f5f5f5;
            border-color: #999;
        }

    /* Close text link */
    .popup-close.close-link {
        color: #1976d2;
        text-decoration: underline;
    }

        .popup-close.close-link:hover {
            color: #1565c0;
        }

    /* Close badge */
    .popup-close.close-badge {
        display: inline-block;
        padding: 4px 8px;
        background: #f44336;
        color: white;
        border-radius: 12px;
        font-size: 12px;
        font-weight: 600;
    }

        .popup-close.close-badge:hover {
            background: #d32f2f;
        }

/* ===== Draggable Areas ===== */

/* Base draggable styling */
.draggable {
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

    .draggable:active {
        cursor: grabbing;
    }

    /* Draggable indicators */
    .draggable::before {
        content: '';
        pointer-events: none;
    }

    /* Hover effect cho draggable areas */
    .draggable:hover {
        transition: background-color 0.2s ease;
    }

/* Disable hover khi đang drag */
body.dragging .draggable:hover {
    background-color: transparent;
}

/* ===== Draggable Handle Patterns ===== */

/* Pattern 1: Dots indicator */
.draggable.handle-dots {
    position: relative;
}

    .draggable.handle-dots::before {
        content: '⋮⋮';
        position: absolute;
        left: 8px;
        top: 50%;
        transform: translateY(-50%);
        color: rgba(0, 0, 0, 0.3);
        font-size: 16px;
        letter-spacing: -2px;
    }

/* Pattern 2: Grip lines */
.draggable.handle-lines {
    position: relative;
    padding-left: 20px;
}

    .draggable.handle-lines::before {
        content: '';
        position: absolute;
        left: 8px;
        top: 50%;
        transform: translateY(-50%);
        width: 4px;
        height: 16px;
        background: repeating-linear-gradient( 0deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3) 2px, transparent 2px, transparent 4px );
    }

/* Pattern 3: Move icon */
.draggable.handle-icon::before {
    content: '⌖';
    margin-right: 8px;
    opacity: 0.5;
    font-size: 18px;
}

/* ===== Specific Draggable Area Styles ===== */

/* Toolbar draggable */
.draggable-toolbar {
    background: #f8f9fa;
    padding: 10px 16px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Sidebar draggable */
.draggable-sidebar {
    background: #f5f5f5;
    padding: 16px;
    border-right: 1px solid #e0e0e0;
    min-width: 200px;
}

/* Footer draggable */
.draggable-footer {
    background: #f8f9fa;
    padding: 10px 16px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Header draggable (alternative styling) */
.draggable-header {
    background: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 14px 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===== Drag State Styles ===== */

/* When actively dragging */
.floating-popup.dragging {
    opacity: 0.9;
    transition: none;
}

/* Prevent text selection during drag */
body.dragging {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ===== Interactive Elements Inside Draggable ===== */

/* Ensure buttons, inputs work normally */
.draggable button,
.draggable input,
.draggable select,
.draggable textarea,
.draggable a {
    cursor: auto;
    user-select: auto;
}

.draggable button {
    cursor: pointer;
}

/* popup-close inside draggable should still work */
.draggable .popup-close {
    cursor: pointer;
}

/* ===== Accessibility ===== */

/* Focus styles for draggable areas */
.draggable:focus-visible {
    outline: 2px solid #4facfe;
    outline-offset: -2px;
}

/* Focus styles for close buttons */
.popup-close:focus-visible {
    outline: 2px solid #4facfe;
    outline-offset: 2px;
}

/* Screen reader text */
.draggable .sr-only,
.popup-close .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Responsive Styles ===== */

@media (max-width: 768px) {
    .floating-popup {
        min-width: 280px;
        max-width: calc(100vw - 20px);
    }

    .draggable-toolbar,
    .draggable-footer {
        padding: 8px 12px;
        font-size: 14px;
    }

    .draggable-sidebar {
        min-width: 150px;
    }

   
}

/* ===== Animation Effects ===== */

/* Smooth transitions */
.floating-popup {
    transition: box-shadow 0.2s ease;
}

   

/* Close button ripple effect */
@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.popup-close:active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: ripple 0.6s ease-out;
}

/* ===== Custom Scrollbar for Popup Body ===== */

.floating-popup .popup-body::-webkit-scrollbar {
    width: 8px;
}

.floating-popup .popup-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.floating-popup .popup-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

    .floating-popup .popup-body::-webkit-scrollbar-thumb:hover {
        background: #555;
    }

/* ===== Dark Mode Support ===== */

@media (prefers-color-scheme: dark) {
    .floating-popup {
        background: #2d2d2d;
        color: #e0e0e0;
    }

     

  
    .draggable-toolbar,
    .draggable-footer {
        background: #1a1a1a;
        border-color: #404040;
    }

    .draggable-sidebar {
        background: #1a1a1a;
        border-color: #404040;
    }

    .popup-close.close-button {
        background: #333;
        color: #e0e0e0;
        border-color: #555;
    }

        .popup-close.close-button:hover {
            background: #404040;
        }

    .floating-popup .popup-body::-webkit-scrollbar-track {
        background: #1a1a1a;
    }

    .floating-popup .popup-body::-webkit-scrollbar-thumb {
        background: #555;
    }
}

/* ===== Utility Classes ===== */

/* Prevent dragging */
.no-drag {
    cursor: default !important;
    user-select: auto !important;
}

/* Force drag cursor */
.force-drag {
    cursor: move !important;
}

/* Prevent closing */
.no-close {
    pointer-events: none !important;
}

/* Highlight draggable area */
.draggable-highlight {
    position: relative;
}

    .draggable-highlight::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(102, 126, 234, 0.1);
        border: 2px dashed rgba(102, 126, 234, 0.3);
        pointer-events: none;
        border-radius: 4px;
    }

/* Highlight close area */
.popup-close-highlight {
    position: relative;
}

    .popup-close-highlight::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(244, 67, 54, 0.1);
        border: 2px dashed rgba(244, 67, 54, 0.3);
        pointer-events: none;
        border-radius: 4px;
    }
