/* Small visual enhancements on top of Tailwind utility classes. */
.glass-card {
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.85);
}

section h3 + p,
section h4 + p,
section h1 + p {
    margin-top: 0.35rem;
    line-height: 1.45;
}

.app-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    overflow-y: auto;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
}

.app-modal.is-open {
    display: block;
}

.app-modal-dialog {
    min-height: calc(100vh - 2rem);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0.25rem 0;
}

.app-modal-panel {
    position: relative;
    z-index: 10000;
    display: flex;
    width: 100%;
    flex-direction: column;
    overflow: hidden;
    border-radius: 28px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    max-height: calc(100vh - 2rem);
    animation: modalSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.app-modal-body {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
}

.app-modal-footer {
    flex-shrink: 0;
}

/* --- Premium CSS Design Extensions for CRM --- */

/* Animations */
@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0.5;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulseGlowing {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 0 12px 4px rgba(99, 102, 241, 0.2);
    }
}

@keyframes floatIndicator {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* Premium Card metrics */
.crm-stats-card {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(226, 232, 240, 0.8);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.crm-stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    border-color: rgba(99, 102, 241, 0.3);
}

.crm-stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.3), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.crm-stats-card:hover::before {
    opacity: 1;
}

.crm-glow-indicator {
    animation: pulseGlowing 2.5s infinite;
}

/* Interactive Table Overhaul */
.lead-row {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.lead-row:hover {
    background-color: rgba(248, 250, 252, 0.95) !important;
    transform: scale(1.002);
}

.lead-row:hover .lead-inline-actions {
    opacity: 1;
}

/* Vibrant dynamic badges */
.badge-vibrant {
    position: relative;
    overflow: hidden;
    font-weight: 700 !important;
}

.badge-vibrant::after {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        to right,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    transform: skewX(-25deg);
    transition: 0.75s;
}

.badge-vibrant:hover::after {
    left: 125%;
}

/* Premium Filter Drawer (Slide-In) */
.filter-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 100vw;
    background: #ffffff;
    box-shadow: -10px 0 30px rgba(15, 23, 42, 0.08);
    z-index: 10050;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.filter-drawer.is-open {
    transform: translateX(0);
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(4px);
    z-index: 10040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.drawer-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

/* Quick Actions Card Details */
.quick-view-meta-item {
    padding: 0.75rem;
    border-radius: 1rem;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
}

@media (min-width: 640px) {
    .app-modal {
        padding: 1.5rem;
    }

    .app-modal-dialog {
        min-height: calc(100vh - 3rem);
        padding: 0.5rem 0;
    }

    .app-modal-panel {
        max-height: calc(100vh - 4rem);
    }
}
