/* Custom styles for Property Management System */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.3rem;
}

.card {
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card-header {
    font-weight: 600;
    border-radius: 10px 10px 0 0 !important;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.table-hover tbody tr:hover {
    background-color: #f5f5f5;
    cursor: pointer;
}

.badge {
    padding: 5px 10px;
    font-size: 0.85rem;
}

.btn {
    border-radius: 5px;
    padding: 8px 16px;
}

.btn-group-sm .btn {
    padding: 4px 8px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.alert {
    border-radius: 8px;
    border: none;
}

.dropdown-menu {
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.timeline {
    position: relative;
    padding: 20px 0;
}

.timeline-item {
    position: relative;
    padding-left: 40px;
    margin-bottom: 20px;
}

.timeline-item:before {
    content: '';
    position: absolute;
    left: 15px;
    top: 24px;
    bottom: -20px;
    width: 2px;
    background: #dee2e6;
}

.timeline-item:last-child:before {
    bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: 10px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.1);
}

.timeline-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.timeline .border-start {
    margin-left: 10px;
    padding-left: 20px;
}

/* Clickable invoice rows */
.invoice-row {
    transition: all 0.2s ease;
}

.invoice-row:hover {
    background-color: rgba(13, 110, 253, 0.05) !important;
    transform: translateX(2px);
    box-shadow: 0 0 8px rgba(13, 110, 253, 0.15);
}

.invoice-row.table-success:hover {
    background-color: rgba(25, 135, 84, 0.15) !important;
}

.invoice-row.table-warning:hover {
    background-color: rgba(255, 193, 7, 0.15) !important;
}

.invoice-row.table-danger:hover {
    background-color: rgba(220, 53, 69, 0.15) !important;
}

/* Dashboard cards */
.card.text-white h2 {
    font-size: 2.5rem;
    margin: 0;
}

.card.text-white h5 {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 10px;
}

/* Status badges */
.badge.bg-warning {
    color: #000;
}

/* Footer */
.footer {
    margin-top: auto;
    background-color: #f8f9fa !important;
    border-top: 1px solid #dee2e6;
}

/* Loading spinner */
.spinner-border {
    width: 2rem;
    height: 2rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card {
        margin-bottom: 15px;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: 5px !important;
        margin-bottom: 2px;
    }
}

/* Print styles */
@media print {
    .navbar, .footer, .btn, .btn-group {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}

/* Animation for alerts */
.alert {
    animation: slideIn 0.3s ease-out;
}

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

/* Chart container */
canvas {
    max-height: 300px;
}

/* Form validation states */
.was-validated .form-control:valid,
.form-control.is-valid {
    border-color: var(--success-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.was-validated .form-control:invalid,
.form-control.is-invalid {
    border-color: var(--danger-color);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

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

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

/* Sortable table headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

th.sortable:hover {
    background-color: #e9ecef;
}

th.sortable i {
    font-size: 0.8rem;
    margin-left: 5px;
    opacity: 0.6;
}

th.sortable:hover i {
    opacity: 1;
}

/* RAG chat interface */
#ragQuery {
    resize: vertical;
    min-height: 50px;
}

#ragResponse {
    max-height: 400px;
    overflow-y: auto;
}

/* Inline manager editing */
.manager-cell {
    min-width: 150px;
}

.manager-display {
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.manager-display:hover {
    background-color: #f0f0f0;
}

.manager-display .manager-name {
    transition: color 0.3s;
}

.manager-display .bi-pencil-square {
    opacity: 0;
    transition: opacity 0.2s;
}

.manager-display:hover .bi-pencil-square {
    opacity: 1;
}

.manager-edit {
    display: none;
    align-items: center;
    gap: 5px;
}

.manager-edit .form-select {
    width: auto;
    min-width: 120px;
}

.manager-edit button {
    padding: 0;
    margin: 0;
    color: #dc3545;
}

.manager-edit button:hover {
    color: #bb2d3b;
}

/* Compact table styles */
.compact-table {
    font-size: 0.875rem;
}

.compact-table thead th {
    padding: 0.4rem 0.3rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

.compact-table tbody td {
    padding: 0.3rem 0.3rem;
    vertical-align: middle;
}

.compact-header {
    font-weight: 600;
    letter-spacing: -0.02em;
}

.compact-cell {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-row:hover {
    background-color: #f8f9fa;
}

/* Make manager cell slightly wider */
.manager-cell {
    min-width: 100px;
    max-width: 130px;
}

/* Responsive adjustments */
@media (max-width: 1400px) {
    .compact-table {
        font-size: 0.8rem;
    }
    
    .compact-table thead th {
        font-size: 0.7rem;
        padding: 0.3rem 0.2rem;
    }
    
    .compact-cell {
        max-width: 100px;
    }
}

/* Ultra-wide screen optimizations */
@media (min-width: 1920px) {
    .compact-cell {
        max-width: 150px;
    }
    
    .compact-table {
        font-size: 0.9rem;
    }
}