/* Custom Styles for Real Estate Collection Dashboard */

/* Variables */
:root {
    --primary-color: #1e40af;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--light-color);
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

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

/* Editable Fields Styles */
.editable-field {
    transition: all 0.2s ease;
    cursor: pointer;
}

.editable-field:hover {
    background-color: #f3f4f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.editable-field:focus {
    background-color: white;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
    outline: none;
}

/* Inline Edit Input Styles */
#tenantsTableBody input[type="text"],
#tenantsTableBody input[type="number"],
#tenantsTableBody select {
    transition: all 0.2s ease;
    background-color: transparent;
}

#tenantsTableBody input[type="text"]:hover,
#tenantsTableBody input[type="number"]:hover,
#tenantsTableBody select:hover {
    background-color: #f9fafb;
}

#tenantsTableBody input[type="text"]:focus,
#tenantsTableBody input[type="number"]:focus,
#tenantsTableBody select:focus {
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Success Animation */
@keyframes successPulse {
    0% { background-color: #10b981; }
    50% { background-color: #34d399; }
    100% { background-color: transparent; }
}

.field-saved {
    animation: successPulse 0.5s ease;
}

.spinner {
    animation: spin 1s linear infinite;
}

/* Sidebar Navigation */
.nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: #ffffff;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.paid {
    background-color: #dcfce7;
    color: #166534;
}

.status-badge.regular {
    background-color: #d1fae5;
    color: #065f46;
}

.status-badge.late-minor {
    background-color: #fef3c7;
    color: #92400e;
}

.status-badge.late {
    background-color: #fed7aa;
    color: #9a3412;
}

.status-badge.late-major {
    background-color: #ffedd5;
    color: #c2410c;
}

.status-badge.defaulter {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-badge.critical {
    background-color: #fecaca;
    color: #7f1d1d;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Progress Bars */
.progress-bar {
    position: relative;
    width: 100%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    transition: width 0.5s ease;
}

.progress-bar-fill.excellent {
    background: linear-gradient(90deg, #10b981, #059669);
}

.progress-bar-fill.good {
    background: linear-gradient(90deg, #84cc16, #65a30d);
}

.progress-bar-fill.average {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.progress-bar-fill.poor {
    background: linear-gradient(90deg, #fb923c, #ea580c);
}

.progress-bar-fill.bad {
    background: linear-gradient(90deg, #f87171, #dc2626);
}

/* Card Hover Effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Table Hover Effects */
tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: #f9fafb;
}

/* Alert Animations */
.alert-item {
    animation: slideInRight 0.5s ease;
}

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

/* Modal Animations */
.modal-enter {
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Tooltip Styles */
.tooltip {
    position: relative;
}

.tooltip .tooltip-text {
    visibility: hidden;
    background-color: var(--dark-color);
    color: white;
    text-align: center;
    padding: 5px 10px;
    border-radius: 6px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
    font-size: 0.75rem;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

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

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .page-break {
        page-break-after: always;
    }
    
    body {
        font-size: 12pt;
    }
    
    table {
        font-size: 10pt;
    }
}

/* Responsive Styles */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(100%);
        position: fixed;
        z-index: 40;
        height: 100vh;
    }
    
    #sidebar.active {
        transform: translateX(0);
    }
    
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
    
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #111827;
        --dark-color: #f9fafb;
    }
}

/* Custom Animations */
.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Action Buttons */
.action-btn {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    outline: none;
}

.action-btn:hover {
    transform: scale(1.05);
}

.action-btn.view {
    background-color: #3b82f6;
    color: white;
}

.action-btn.edit {
    background-color: #10b981;
    color: white;
}

.action-btn.delete {
    background-color: #ef4444;
    color: white;
}

.action-btn.send {
    background-color: #f59e0b;
    color: white;
}

.action-btn.status {
    background-color: #8b5cf6;
    color: white;
}

.action-btn.status:hover {
    background-color: #7c3aed;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: bold;
    animation: pulse 2s infinite;
}

/* Search Highlight */
.search-highlight {
    background-color: #fef3c7;
    padding: 0 2px;
    border-radius: 2px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
}

.empty-state i {
    font-size: 4rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #6b7280;
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(90deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Custom Checkbox */
.custom-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.custom-checkbox:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.custom-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

/* Data Grid */
.data-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* Timeline */
.timeline {
    position: relative;
    padding-right: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #e5e7eb;
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    right: -6px;
    top: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: 2px solid white;
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}