/* Enhanced Dashboard Styles - Optimized for Performance */

/* Custom Indigo Color */
.text-indigo { color: #6366f1 !important; }
.bg-indigo { background-color: #6366f1 !important; }
.btn-outline-indigo { 
    color: #6366f1; 
    border-color: #6366f1; 
}
.btn-outline-indigo:hover { 
    color: #fff; 
    background-color: #6366f1; 
    border-color: #6366f1; 
}

/* Gray Color Variations */
.text-gray-700 { color: #374151 !important; }
.text-gray-600 { color: #4b5563 !important; }
.text-gray-500 { color: #6b7280 !important; }

/* Quick Actions - Optimized for Performance */
.quick-action-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    will-change: transform, box-shadow;
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.quick-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: #6366f1;
}

.quick-action-card:active {
    transform: translateY(0);
    transition: transform 0.1s ease;
}

.quick-action-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: white;
    font-size: 1.5rem;
    transition: transform 0.2s ease;
    will-change: transform;
}

.quick-action-card:hover .quick-action-icon {
    transform: scale(1.1);
}

.quick-action-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin: 0;
    line-height: 1.2;
}

/* Search Box Optimization */
.search-box {
    position: relative;
    max-width: 400px;
}

.search-box .form-control {
    padding-right: 3rem;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box .form-control:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    pointer-events: none;
}

/* Card Optimizations */
.card {
    transition: box-shadow 0.2s ease;
    will-change: box-shadow;
}

.card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Table Optimizations */
.table-hover tbody tr {
    transition: background-color 0.15s ease;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

/* Badge Optimizations */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ef4444;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease;
}

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

/* Notification Container */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

/* Chart Container Optimizations */
.chart-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.chart-container canvas {
    max-width: 100% !important;
    height: auto !important;
}

/* Specific chart sizing */
#occupancyChart {
    max-height: 300px !important;
    height: 300px !important;
    width: 100% !important;
    max-width: 100% !important;
}

#revenueChart {
    max-height: 500px !important;
    height: 500px !important;
    width: 100% !important;
    max-width: 100% !important;
}

#expenseChart {
    max-height: 400px !important;
    height: 400px !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Ensure charts don't overflow their containers */
.card-body {
    overflow: hidden;
}

/* Responsive chart adjustments */
@media (max-width: 768px) {
    #occupancyChart {
        height: 250px !important;
        max-height: 250px !important;
    }
    
    #revenueChart {
        height: 400px !important;
        max-height: 400px !important;
    }
    
    #expenseChart {
        height: 300px !important;
        max-height: 300px !important;
    }
}

@media (max-width: 576px) {
    #occupancyChart {
        height: 200px !important;
        max-height: 200px !important;
    }
    
    #revenueChart {
        height: 300px !important;
        max-height: 300px !important;
    }
    
    #expenseChart {
        height: 250px !important;
        max-height: 250px !important;
    }
}

/* Form Select Optimizations */
.form-select {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Button Optimizations */
.btn {
    transition: all 0.2s ease;
    will-change: transform, box-shadow;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

/* Responsive Optimizations */
@media (max-width: 768px) {
    .quick-action-card {
        padding: 1rem;
    }
    
    .quick-action-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .search-box {
        max-width: 100%;
        margin-top: 1rem;
    }
    
    .offline-indicator {
        top: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
    }
}

@media (max-width: 576px) {
    .quick-action-card {
        padding: 0.75rem;
    }
    
    .quick-action-icon {
        width: 45px;
        height: 45px;
        font-size: 1.125rem;
    }
    
    .quick-action-title {
        font-size: 0.75rem;
    }
}

/* Performance Optimizations */
* {
    box-sizing: border-box;
}

.quick-action-card,
.card,
.table-hover tbody tr,
.btn {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus styles for accessibility */
.quick-action-card:focus,
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .quick-action-card,
    .card,
    .btn,
    .table-hover tbody tr,
    .loading-spinner {
        transition: none;
        animation: none;
    }
    
    .quick-action-card:hover {
        transform: none;
    }
    
    .quick-action-card:hover .quick-action-icon {
        transform: none;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .quick-action-card {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .quick-action-title {
        color: #f9fafb;
    }
    
    .search-box .form-control {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .search-box .form-control:focus {
        background: #1f2937;
        border-color: #6366f1;
    }
    
    .loading-overlay {
        background: rgba(17, 24, 39, 0.9);
    }
    
    .loading-spinner {
        border-color: #374151;
        border-top-color: #6366f1;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .quick-action-card {
        border-width: 2px;
    }
    
    .quick-action-card:hover {
        border-color: #000;
    }
    
    .btn-outline-indigo {
        border-width: 2px;
    }
}

/* Print styles */
@media print {
    .quick-action-card,
    .loading-overlay,
    .offline-indicator,
    .notification-container {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}
