/* 
   GLASSMORPHISM DESIGN SYSTEM 
   Inspired by iOS 18, VisionOS, and Modern AI Apps
*/

:root {
    --glass-border: 1px solid rgba(255, 255, 255, 0.2);
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    --font-family: 'Outfit', sans-serif;
}

/* Dark Mode Overrides - Premium Onyx 2025 */
.dark {
    /* Deep, rich dark background for panels */
    --glass-bg: rgba(20, 20, 20, 0.7);
    /* Subtle white border for definition */
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    /* Deep shadow for depth */
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);

    --primary-gradient: linear-gradient(135deg, #333333 0%, #666666 100%);
    --accent-glow: 0 0 20px rgba(255, 255, 255, 0.05);
}

body {
    font-family: var(--font-family);
    background-color: #f0f2f5;
    color: #1f2937;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.dark {
    /* Pure Black Base - Transparent to show fixed bg */
    background-color: transparent;
    color: #ededed;
}

/* --- UTILITIES --- */

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dark .glass-panel {
    background: linear-gradient(145deg, rgba(30, 30, 30, 0.6) 0%, rgba(10, 10, 10, 0.8) 100%);
    box-shadow:
        inset 0 1px 0 0 rgba(255, 255, 255, 0.05),
        /* Top highlight */
        0 10px 30px -10px rgba(0, 0, 0, 0.8);
    /* Deep shadow */
}

.glass-card {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border-radius: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .glass-card {
    background: rgba(255, 255, 255, 0.02);
    /* More transparent */
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.glass-card:hover {
    /* transform: translateY(-4px); Removed by user request */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.dark .glass-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.05);
    /* Glow effect */
}

/* Buttons */
.glass-button {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 500;
}

.dark .glass-button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
}

.glass-button:hover {
    /* transform: scale(1.02); Removed by user request */
    background: rgba(255, 255, 255, 0.95);
}

.dark .glass-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.glass-button-primary {
    background: rgba(150, 41, 100, 0.75);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(150, 41, 100, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.dark .glass-button-primary {
    background: rgba(150, 41, 100, 0.39);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(150, 41, 100, 0.4);
    color: white;
}

.dark .glass-button-primary:hover {
    background: rgba(150, 41, 100, 0.69);
    box-shadow: 0 0 25px rgba(150, 41, 100, 0.6);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.glass-button-primary:hover {
    background: rgba(150, 41, 100, 0.9);
    transform: translateY(-1px);
    filter: brightness(1.1);
    box-shadow: 0 0 25px rgba(150, 41, 100, 0.6);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Mobile Revolut Style Redesign */
.glass-group {
    @apply flex flex-col space-y-1 mb-6;
}

.glass-group-item {
    @apply flex items-center gap-3 px-4 py-3.5 text-gray-300 hover:text-white transition-all duration-200;
}

/* Floating Bottom Nav - Premium Glass Pill */
.nav-pill-floating {
    background: rgba(20, 20, 25, 0.75) !important;
    backdrop-filter: blur(25px) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    /* Internal Highlight */
    border-radius: 9999px;
    margin-bottom: 2rem;
    /* Lifted slightly more */
    width: calc(100% - 3rem);
    /* Narrower for floating effect */
    left: 1.5rem;
}


/* Sidebar Mobile Wrapper - Maintained */
.mobile-revolut-container {
    background: rgb(22 16 32 / 0%) !important;
    backdrop-filter: blur(30px) !important;
    -webkit-backdrop-filter: blur(30px) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

/* Mobile Navbar - Premium Floating Pill (Dynamic Island Style) */
@media (max-width: 1024px) {
    .mobile-glass-nav {
        background: rgba(20, 20, 25, 0.75) !important;
        backdrop-filter: blur(25px) !important;
        -webkit-backdrop-filter: blur(25px) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        box-shadow:
            0 8px 25px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
        border-radius: 9999px !important;
        margin: 1rem 1rem 0 1rem !important;
        /* Detached from edges */
        width: auto !important;
    }
}

/* Inputs */
.glass-input {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(209, 213, 219, 0.5);
    border-radius: 0.75rem;
    transition: all 0.2s;
    padding: 0.625rem 1rem;
    width: 100%;
    display: block;
}

.dark .glass-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.glass-input:focus {
    background: rgba(255, 255, 255, 0.9);
    border-color: #a855f7;
    outline: none;
}

.dark .glass-input:focus {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

/* Tables */
.glass-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

/* Premium Card Style for Divs using .glass-table (Container Mode) */
div.glass-table {
    /* Base Glass Style */
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border-radius: 1.5rem;
    /* Standardize specific radius */

    /* Interactive/Premium Behavior */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

div.glass-table::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
    pointer-events: none;
    z-index: 50;
}

div.glass-table:hover {
    /* Hover removed by user request */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    /* Keep original shadow or none? Base has shadow. */
}



/* Dark Mode Overrides for Divs */
.dark div.glass-table {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}





/* Utility to disable hover effects on specific tables */
div.glass-table.no-hover-effect:hover {
    transform: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.dark div.glass-table.no-hover-effect:hover {
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

div.glass-table.no-hover-effect:hover::after {
    border-color: transparent;
}

.dark div.glass-table.no-hover-effect:hover::after {
    border-color: transparent;
}

.glass-table th {
    background-color: rgba(249, 250, 251, 0.5);
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
}

.dark .glass-table th {
    background-color: rgba(255, 255, 255, 0.02);
    color: #9ca3af;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-table td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(243, 244, 246, 0.5);
}

.dark .glass-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    color: #e5e7eb;
}

.glass-table tbody tr:hover {
    background-color: rgba(249, 250, 251, 0.8);
}

.dark .glass-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Filter Buttons */
.filter-period-btn,
.filter-state-btn,
.filter-category-btn,
.filter-daily-btn {
    font-weight: 500;
    color: #4b5563;
    transition: all 0.3s;
    background: transparent;
    border: none;
    cursor: pointer;
}

.dark .filter-period-btn,
.dark .filter-state-btn,
.dark .filter-category-btn,
.dark .filter-daily-btn {
    color: #9ca3af;
}

.filter-period-btn:hover,
.filter-state-btn:hover,
.filter-category-btn:hover,
.filter-daily-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #111827;
}

.dark .filter-period-btn:hover,
.dark .filter-state-btn:hover,
.dark .filter-category-btn:hover,
.dark .filter-daily-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.filter-period-btn.active,
.filter-state-btn.active,
.filter-category-btn.active,
.filter-daily-btn.active {
    background: var(--primary-gradient);
    color: white !important;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.dark .filter-period-btn.active,
.dark .filter-state-btn.active,
.dark .filter-category-btn.active,
.dark .filter-daily-btn.active {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
}

/* Animations */
.fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animation-delay-200 {
    animation-delay: 0.2s;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.5);
}

/* Modals */
/* Modals */
.glass-modal {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.dark .glass-modal {
    background: rgba(30, 30, 30, 0.5) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.1), 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

/* Removed the conflicting "Off-White Theme Overrides" */

/* WhatsApp Floating Button */
.whatsapp-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 60;
    background-color: #25D366;
    color: white;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.whatsapp-float:hover {
    /* transform: translateY(-4px); Removed by user request */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Adjust for mobile bottom nav */
@media (max-width: 1024px) {
    .whatsapp-float {
        bottom: calc(120px + env(safe-area-inset-bottom));
        /* Nav (80px) + Margin (24px) + Gap (16px) + Safe Area */
    }
}

/* Interactive KPI Cards (Filters) */
.kpi-card-interactive.active {
    border-color: rgba(99, 102, 241, 0.5);
    /* indigo-500/50 */
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.6));
    transform: translateY(-2px);
}

.dark .kpi-card-interactive.active {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.6));
}

/* Main Tabs (Histórico / Recorrências) */
.glass-tabs-container {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.35rem;
    border-radius: 1rem;
    display: inline-flex;
    gap: 0.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.dark .glass-tabs-container {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.glass-tab-btn {
    padding: 0.5rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.dark .glass-tab-btn {
    color: #9ca3af;
}

.glass-tab-btn:hover {
    color: #374151;
    background-color: rgba(255, 255, 255, 0.3);
}

.dark .glass-tab-btn:hover {
    color: #e5e7eb;
    background-color: rgba(255, 255, 255, 0.05);
}

.glass-tab-btn.active {
    background: var(--primary-gradient);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.dark .glass-tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Mobile Modal Slide Up Animation */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

/* --- Gridstack Customization --- */
.grid-stack-item-content {
    /* height: 100% !important;  <-- Removed to allow Gridstack margin to work */
    overflow: hidden !important;
    border-radius: 1rem;
    /* match rounded-2xl */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Edit Mode Visuals */
.grid-stack.edit-mode .grid-stack-item-content {
    cursor: grab;
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.4);
    /* Purple outline */
    transform: scale(0.98);
}

.grid-stack.edit-mode .grid-stack-item-content:active {
    cursor: grabbing;
    transform: scale(0.96);
}

/* Hide resize handles by default */
.ui-resizable-handle {
    opacity: 0;
    transition: opacity 0.2s;
}

/* Show resize handles in edit mode */
.grid-stack.edit-mode .ui-resizable-handle {
    opacity: 1;
    background-color: rgba(168, 85, 247, 0.2) !important;
    border-radius: 50%;
}

/* Mobile Resize Handles Customization */
/* Mobile Resize Handles Customization */
@media (max-width: 768px) {

    .grid-stack.edit-mode .ui-resizable-n,
    .grid-stack.edit-mode .ui-resizable-s {
        border-radius: 0 !important;
        width: 100px !important;
        /* Larger touch width */
        height: 40px !important;
        /* Larger touch height (hit area) */
        left: 50% !important;
        transform: translateX(-50%);
        background-color: transparent !important;
        /* Invisible touch area */
        bottom: -10px !important;
        /* Position relative to edge */
        z-index: 100 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        touch-action: none;
        /* Prevent scrolling while dragging */
    }

    .grid-stack.edit-mode .ui-resizable-n {
        top: -10px !important;
        bottom: auto !important;
    }

    /* Visual Bar using pseudo-element */
    .grid-stack.edit-mode .ui-resizable-n::after,
    .grid-stack.edit-mode .ui-resizable-s::after {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background-color: rgba(168, 85, 247, 0.8);
        border-radius: 4px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
}

/* Placeholder style */
.grid-stack-placeholder>.placeholder-content {
    background-color: rgba(168, 85, 247, 0.1) !important;
    border: 2px dashed rgba(168, 85, 247, 0.4) !important;
    border-radius: 1rem;
}

/* Widget Management Styles */

/* Remove Widget Button */
.btn-remove-widget {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    /* Subtle Glass Style */
    background: rgba(0, 0, 0, 0.05);
    color: #9ca3af;
    /* Gray-400 */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    transition: all 0.2s ease;
    border: none;
    font-size: 12px;
}

.dark .btn-remove-widget {
    background: rgba(255, 255, 255, 0.1);
    color: #6b7280;
    /* Gray-500 */
}

.grid-stack.edit-mode .btn-remove-widget {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.btn-remove-widget:hover {
    background: #ef4444;
    /* Red-500 */
    color: white;
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.dark .btn-remove-widget:hover {
    color: white;
}

/* Mobile Move Controls */
.widget-mobile-move-controls {
    position: absolute;
    top: 8px;
    right: 40px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
    z-index: 20;
    transition: all 0.2s ease;
}

.grid-stack.edit-mode .widget-mobile-move-controls.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.btn-move-widget {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.dark .btn-move-widget {
    background: rgba(255, 255, 255, 0.1);
    color: #6b7280;
}

.btn-move-widget:hover:not(:disabled) {
    background: rgba(168, 85, 247, 0.25);
    color: #a855f7;
}

.btn-move-widget:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@media (min-width: 768px) {
    .widget-mobile-move-controls {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .btn-remove-widget {
        top: -10px;
        right: 16px;
    }

    .widget-mobile-move-controls {
        top: -10px;
        right: 56px;
    }

    .grid-stack.edit-mode .ui-resizable-handle {
        display: none !important;
    }
}

/* Floating Action Button (FAB) */
.fab-add-widget {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 56px;
    height: 56px;
    /* Navbar Style (Glassmorphism) */
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    color: #4b5563;
    /* Gray-600 */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, background 0.3s ease, color 0.3s ease;
}

.dark .fab-add-widget {
    color: #e5e7eb;
    /* Gray-200 */
}

.fab-add-widget:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.8);
    color: #111827;
    /* Gray-900 */
}

.dark .fab-add-widget:hover {
    background: rgba(30, 30, 30, 0.8);
    color: white;
}

.fab-add-widget.active {
    transform: rotate(135deg) scale(1.1);
    /* Navbar Active Style (Light Mode) */
    background: #111827;
    /* Gray-900 */
    color: white;
    border-color: transparent;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    /* shadow-lg */
}

.dark .fab-add-widget.active {
    /* Navbar Active Style (Dark Mode) */
    background: rgba(255, 255, 255, 0.1);
    /* bg-white/10 */
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 15px -3px rgba(88, 28, 135, 0.2);
    /* shadow-purple-900/20 */
}

/* Speed Dial Menu Container */
.menu-add-widget {
    position: fixed;
    bottom: 168px;
    right: 28px;
    width: auto;
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    z-index: 49;
    pointer-events: none;
    padding-bottom: 10px;
}

.menu-add-widget.open {
    pointer-events: auto;
}

/* Speed Dial Item Container */
.widget-list-item {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    height: 50px;
    /* Fixed height for stability */
}

.menu-add-widget.open .widget-list-item {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* The Bubble (Icon) - Filter Style */
.widget-bubble {
    width: 48px;
    height: 48px;
    /* Filter Style: bg-white/50 dark:bg-white/5 backdrop-blur-md border border-white/20 */
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    color: #4b5563;
    /* Gray-600 */
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center center;
    position: relative;
    z-index: 10;
}

.dark .widget-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #d1d5db;
    /* Gray-300 */
}

.widget-bubble:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.25);
    color: #111827;
    /* Gray-900 */
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.dark .widget-bubble:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

/* The Label - Filter Style */
.widget-label {
    margin-right: 16px;
    /* Match Bubble Style */
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #4b5563;
    /* Gray-600 */
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    opacity: 1;
    transform: translateX(0);
    pointer-events: none;
}

.dark .widget-label {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #d1d5db;
    /* Gray-300 */
}

/* Mobile Spacing Fix */
@media (max-width: 768px) {
    .grid-stack-item {
        margin-bottom: 16px !important;
        position: relative !important;
        /* Ensure static/relative stacking */
        top: auto !important;
        left: auto !important;
        width: 100% !important;
    }
}

/* Mobile Positioning for FAB and Menu */
@media (max-width: 1024px) {
    .fab-add-widget {
        bottom: calc(192px + env(safe-area-inset-bottom));
        /* WhatsApp + 56px + 16px */
    }

    .menu-add-widget {
        bottom: calc(264px + env(safe-area-inset-bottom));
        /* FAB + 56px + 16px */
    }
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 20px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(156, 163, 175, 0.8);
}

/* Fix for Flatpickr Mobile Input Width */
.flatpickr-mobile {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: block !important;
    margin: 0 !important;
    min-width: 0 !important;
    -webkit-appearance: none;
    appearance: none;
    /* Remove default iOS styling */
}

/* Interactive Widget Hover Effect */
.interactive-widget {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.interactive-widget::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1.5rem;
    /* match rounded-2xl */
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
    pointer-events: none;
    z-index: 50;
}





/* Glass Border Glow on Hover */




/* === Skeleton Loader Styles === */
@keyframes skeleton-pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 0.3;
    }

    100% {
        opacity: 0.6;
    }
}

.skeleton-pulse {
    animation: skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    background-color: rgb(209 213 219);
    /* gray-300 */
    border-radius: 0.5rem;
}

.dark .skeleton-pulse {
    background-color: rgba(255, 255, 255, 0.1);
}

.skeleton-text {
    height: 0.75rem;
    margin-bottom: 0.5rem;
}

.skeleton-circle {
    border-radius: 9999px;
}

/* Utility to hide content when loading */
.loading .content-view {
    display: none !important;
}

/* High specificity to override .flex !important utility */
.interactive-widget .skeleton-view {
    display: none !important;
}

/* Ensure it shows when loading (0,2,0 specificity + !important) */
/* Ensure it shows when loading (0,2,0 specificity + !important) */
.interactive-widget.loading .skeleton-view {
    display: flex !important;
}

/* Allow table skeletons to behave as blocks */
.interactive-widget.loading .skeleton-view.table-skeleton-view {
    display: block !important;
}

/* --- ANIMATIONS --- */
@keyframes blob {
    0% {
        transform: translate(0px, 0px) scale(1);
    }

    25% {
        transform: translate(20px, -30px) scale(1.1, 0.9);
    }

    50% {
        transform: translate(-20px, 20px) scale(0.9, 1.1);
    }

    75% {
        transform: translate(20px, 20px) scale(1.05, 0.95);
    }

    100% {
        transform: translate(0px, 0px) scale(1);
    }
}

.animate-blob {
    animation: blob 7s infinite;
}

.animation-delay-2000 {
    animation-delay: 2s;
}

.animation-delay-4000 {
    animation-delay: 4s;
}

/* === Conciliacao Isolated Skeleton Styles === */
/* Avoids conflicts with .interactive-widget .skeleton-view */

.conciliacao-loading-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    /* space-y-4 equivalent */
}

/* Force display flex even if parent has conflicting rules */
.conciliacao-loading-container {
    display: flex !important;
}

.conciliacao-skeleton-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.4);
    /* match glass-table light */
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    border-radius: 1rem;
    /* rounded-2xl */
    padding: 1rem;
    /* p-4 */
    display: block !important;
    position: relative;
    overflow: hidden;
}

@media (min-width: 640px) {
    .conciliacao-skeleton-card {
        padding: 1.25rem;
        /* sm:p-5 */
    }
}

.dark .conciliacao-skeleton-card {
    background: rgba(255, 255, 255, 0.05);
    /* match glass-table dark */
    border-color: rgba(255, 255, 255, 0.1);
}

.conciliacao-skeleton-shimmer {
    background-color: rgb(229 231 235);
    /* gray-200 */
    border-radius: 0.5rem;
    /* rounded-lg */
    animation: skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.dark .conciliacao-skeleton-shimmer {
    background-color: rgba(255, 255, 255, 0.05);
}

/* --- Mobile Redesign (Revolut Style) --- */

/* Grouped Lists (Sidebar) */
.glass-group {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 1.5rem;
    overflow: hidden;
    margin-bottom: 1rem;
}

.dark .glass-group {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-group-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: inherit;
    transition: background-color 0.2s;
}

.dark .glass-group-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-group-item:last-child {
    border-bottom: none;
}

.glass-group-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.dark .glass-group-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}



/* Sidebar Full Screen Override */
#menuLateral.mobile-revolut {
    width: 100% !important;
    border-radius: 0 !important;
    /* Almost solid deep purple */
}

/* Audio Message UI */
.audio-message-bubble {
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* Reduced from 8px */
    width: 100%;
    /* Take full available width of parent */
}

.audio-player-ui {
    display: flex;
    align-items: center;
    gap: 10px;
    /* Reduced from 12px */
}

.audio-icon-circle {
    width: 36px;
    /* Reduced from 40px */
    height: 36px;
    border-radius: 50%;
    background-color: #10B981;
    /* Green-500 */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.audio-waveform {
    display: flex;
    align-items: center;
    gap: 3px;
    /* Slightly wider gap for better definition */
    height: 20px;
    /* Reduced from 24px */
    flex: 1;
    /* Take remaining space */
    justify-content: space-between;
    /* Spread bars across width */
    padding-right: 8px;
    /* Slight padding to avoid hitting edge */
    mask-image: linear-gradient(to right, black 90%, transparent 100%);
    /* Fade out edge */
    -webkit-mask-image: linear-gradient(to right, black 90%, transparent 100%);
    overflow: hidden;
}

.wave-bar {
    width: 3px;
    background-color: rgba(255, 255, 255, 0.6);
    /* More visible */
    border-radius: 2px;
    animation: wave 1.2s ease-in-out infinite;
}

/* Quote style for transcription */
.audio-transcription {
    font-size: 0.85rem;
    /* Slightly smaller */
    line-height: 1.4;
    font-style: italic;
    color: rgba(255, 255, 255, 0.95);
    margin-top: 2px;
    padding-left: 8px;
    /* More indentation */
    border-left: 2px solid rgba(255, 255, 255, 0.3);
}

@keyframes wave {

    0%,
    100% {
        height: 6px;
    }

    50% {
        height: 18px;
    }
}
@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
    100% {
        transform: translateY(0px);
    }
}
