/* =========================
   FLOATING ACTION BUTTON CARDS
   ========================= */

/* FAB Card Container - Support both IDs for compatibility */
.fab-card,
#fabCard.fab-card,
#invoiceFabCard.fab-card {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12), 0 -2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(100%) translateZ(0);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 1060; /* Higher than bottom-bar (1000) and modals (1050) */
    max-height: 60vh;
    overflow: hidden;
    /* Modern mobile viewport handling */
    padding-bottom: max(env(safe-area-inset-bottom, 0), 20px);
    /* Ensure smooth animations */
    will-change: transform;
}

/* FAB Card when open - higher specificity */
.fab-card.fab-card.open {
    transform: translateY(0) translateZ(0) !important;
}

/* Show a small handle/indicator when closed to indicate swipeable area */
.fab-card:not(.open) {
    transform: translateY(calc(100% - 48px)) translateZ(0);
}

/* On mobile, show handle more visible when closed */
@media (max-width: 576px) {
    .fab-card:not(.open) {
        transform: translateY(calc(100% - 56px)) translateZ(0);
    }
    
    /* Adjust bottom-bar z-index to be below FAB */
    .bottom-bar {
        z-index: 1000;
    }
}

/* FAB Card Handle */
.fab-card-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40px;
    cursor: pointer;
    padding: 12px 0;
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    /* Make handle more visible when closed */
    position: relative;
    z-index: 10;
}

.drag-indicator {
    width: 48px;
    height: 5px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.fab-card-handle:hover .drag-indicator {
    background: rgba(0, 0, 0, 0.6);
}

.fab-card-handle:active .drag-indicator {
    background: rgba(0, 0, 0, 0.8);
    transform: scaleY(0.8);
}

/* FAB Card Content */
.fab-card-content {
    padding: 16px 20px;
    max-height: calc(60vh - 32px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.fab-card-content ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.fab-card-content li {
    margin: 0;
}

.fab-card-content a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: #333;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 16px;
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.fab-card-content a:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.fab-card-content a:active {
    background: rgba(0, 0, 0, 0.1);
    transform: translateY(0);
}

.fab-card-content a i {
    font-size: 20px;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 360px) {
    .fab-card-content {
        padding: 12px 16px;
    }
    
    .fab-card-content a {
        font-size: 15px;
        padding: 10px 12px;
    }
    
    .fab-card-content a i {
        font-size: 18px;
        margin-right: 10px;
    }
}

/* Safe area handling for modern phones */
@supports (padding: max(0px)) {
    .fab-card {
        padding-bottom: max(env(safe-area-inset-bottom, 0), 20px);
    }
}

/* Enhanced touch support */
@media (hover: none) and (pointer: coarse) {
    .fab-card-content a {
        min-height: 52px; /* Larger touch targets on mobile */
    }
    
    .fab-card-content a:hover {
        transform: none; /* Disable hover animations on touch devices */
    }
}

/* =========================
   FAB CARD INTERACTIONS
   ========================= */

/* Action items animation states */
.fab-card-content li {
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .fab-card {
        background: rgba(30, 30, 30, 0.98);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .fab-card-content a {
        color: #e2e8f0;
    }
    
    .fab-card-content a:hover {
        background: rgba(255, 255, 255, 0.08);
    }
    
    .fab-card-content a:active {
        background: rgba(255, 255, 255, 0.12);
    }
    
    .drag-indicator {
        background: rgba(255, 255, 255, 0.4);
    }
    
    .fab-card-handle:hover .drag-indicator {
        background: rgba(255, 255, 255, 0.6);
    }
}
