/* Mobile-optimized Filament admin */

/* Tables - horizontal scroll on mobile */
@media (max-width: 768px) {
    .fi-ta-content { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .fi-ta-table { min-width: 600px; }
    .fi-ta-header-cell, .fi-ta-cell { padding: 0.5rem 0.4rem !important; font-size: 0.8rem !important; }
    .fi-ta-actions-column { width: auto !important; }
}

/* Buttons - touch friendly */
@media (max-width: 640px) {
    .fi-btn { min-height: 44px !important; min-width: 44px !important; }
    .fi-btn-label { font-size: 0.85rem !important; }
    .fi-header-actions { flex-wrap: wrap; gap: 0.5rem !important; }
    .fi-header-actions .fi-btn { flex: 1; min-width: 100px; }
}

/* Sidebar */
@media (max-width: 768px) {
    .fi-sidebar { width: 280px !important; }
    .fi-sidebar-nav-item { padding: 0.6rem 0.75rem !important; font-size: 0.85rem !important; }
    .fi-sidebar-nav-group-header { font-size: 0.7rem !important; }
}

/* Topbar */
@media (max-width: 640px) {
    .fi-topbar { padding: 0.5rem 0.75rem !important; }
    .fi-topbar-nav-trigger { min-width: 44px !important; min-height: 44px !important; }
}

/* Forms */
@media (max-width: 640px) {
    .fi-fo-field-wrp { margin-bottom: 0.75rem !important; }
    .fi-input-wrp { padding: 0.6rem 0.75rem !important; font-size: 0.9rem !important; }
    .fi-fo-toggle { min-height: 44px !important; }
}

/* Cards & Sections */
@media (max-width: 640px) {
    .fi-wi-stats-overview-stat { padding: 0.75rem !important; }
    .fi-section { padding: 0.75rem !important; }
    .fi-modal-window { margin: 0.5rem !important; max-height: 95vh !important; }
    .fi-modal-content { padding: 0.75rem !important; }
    .fi-modal-footer { padding: 0.75rem !important; flex-wrap: wrap; }
}

/* Notifications */
@media (max-width: 640px) {
    .fi-notification { width: calc(100vw - 1rem) !important; max-width: none !important; }
}

/* Page header */
@media (max-width: 640px) {
    .fi-header { flex-direction: column; align-items: flex-start !important; gap: 0.5rem !important; }
    .fi-header-heading { font-size: 1.25rem !important; }
    .fi-header-subheading { font-size: 0.8rem !important; }
}

/* Badge/Status */
@media (max-width: 640px) {
    .fi-badge { font-size: 0.7rem !important; padding: 0.15rem 0.5rem !important; }
}

/* Pagination */
@media (max-width: 640px) {
    .fi-pagination { flex-direction: column; gap: 0.5rem !important; align-items: stretch !important; }
    .fi-pagination-select { width: 100% !important; }
}

/* Loading indicator for pagination & actions */
.wire-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

/* Prevent infinite scroll bug */
.fi-main { overflow-x: hidden !important; }
.fi-body, body { overflow-x: hidden !important; }
.fi-sidebar-open { overflow: hidden !important; }

.wire-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Livewire loading states */
[wire\:loading] {
    display: none;
}

[wire\:loading].wire-loading {
    display: inline-flex !important;
    align-items: center;
    gap: 0.5rem;
}

/* Pagination buttons loading */
.fi-pagination button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.fi-pagination button:not([disabled]):active {
    transform: scale(0.95);
}

/* Table loading overlay */
.fi-ta-content.wire-loading {
    min-height: 200px;
}

.fi-ta-content.wire-loading::before {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.9);
    color: #f1f5f9;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 10;
    backdrop-filter: blur(8px);
}
