/* Custom CSS for Real Estate Payment Tracker */

* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
}

.d-flex {
    width: 100%;
    max-width: 100%;
}

/* Sidebar Styles */
.sidebar {
    min-height: 100vh;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%) !important;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1050;
    width: 280px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.sidebar.show {
    transform: translateX(0);
}

/* Mobile Navigation States */
@media (max-width: 767.98px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1049;
    backdrop-filter: blur(2px);
}

@media (max-width: 768px) {
    .mobile-overlay.show {
        display: block;
    }
}

.sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem 1rem !important;
}

.sidebar-icon {
    width: 40px;
    height: 40px;
    background: rgba(0, 123, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-link {
    padding: 0.75rem 1rem;
    margin: 0.25rem 0;
    border-radius: 6px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff !important;
    transform: translateX(5px);
}

.nav-link.active {
    background-color: rgba(0, 123, 255, 0.2);
    border-left-color: #007bff;
    color: #fff !important;
}

.nav-link i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: 280px;
    padding: 0;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    width: calc(100% - 280px);
    max-width: calc(100% - 280px);
}

.main-content.sidebar-open {
    margin-left: 280px;
}

/* Mobile Menu Button - In mobile header */
.mobile-menu-btn {
    display: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
}

@media (max-width: 767.98px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.mobile-menu-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.mobile-menu-btn:active {
    transform: translateY(0);
}

.mobile-menu-btn i {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.mobile-menu-btn.active i {
    transform: rotate(90deg);
}

/* Content spacing - Remove h2 top spacing */
.main-content h2 {
    padding-top: 0;
    margin-top: 0;
}

/* Mobile Header */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    border-bottom: 1px solid #e3e6f0;
    z-index: 1040;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    padding: 0 1rem;
}

.mobile-header h3 {
    margin: 0;
    color: #5a5c69;
    font-weight: 600;
    margin-left: 60px;
}

@media (max-width: 767.98px) {
    .main-content {
        margin-left: 0;
        padding-top: 60px;
        width: 100%;
        max-width: 100%;
    }
    
    .main-content h2 {
        padding-top: 0;
        margin-top: 0;
    }
    
    .header-section {
        padding-left: 90px !important;
    }
    
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Header Section */
.header-section {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: #fff !important;
}

.user-info {
    display: flex;
    align-items: center;
    font-weight: 500;
    color: #495057;
}

/* Content Section */
.content-section {
    background: #fff;
    margin: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

/* Payment Summary */
.payment-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.summary-item {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.progress-section {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.progress {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.progress-bar {
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%) !important;
    border-radius: 10px;
    transition: width 0.6s ease;
}

/* Table Styles */
.table {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
}

.table thead th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: none;
    font-weight: 600;
    color: #495057;
    padding: 1rem;
    white-space: nowrap;
    border-bottom: 2px solid #dee2e6;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-color: #e9ecef;
    background: white;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
    transform: scale(1.005);
    transition: all 0.2s ease;
}

/* Responsive Table Enhancements */
.table-responsive {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: white;
    overflow: hidden;
}

/* Mobile Table Cards - Redesigned */
@media (max-width: 768px) {
    .table-responsive {
        box-shadow: none;
        background: transparent;
    }
    
    .table {
        display: none !important;
    }
    
    .mobile-table-cards {
        display: block !important;
    }
    
    .mobile-card {
        background: white;
        border-radius: 12px;
        margin-bottom: 1rem;
        padding: 0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        border: 1px solid #e9ecef;
        overflow: hidden;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    
    .mobile-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    }
    
    .mobile-card-header {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        padding: 1rem;
        font-weight: 600;
        font-size: 1rem;
        display: flex;
        align-items: center;
        min-height: 60px;
        border-bottom: none;
    }
    
    .mobile-card-header .badge {
        background: rgba(255, 255, 255, 0.2);
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .mobile-card-body {
        padding: 1rem;
    }
    
    .mobile-card-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 0;
        border-bottom: 1px solid #f1f1f1;
    }
    
    .mobile-card-row:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .mobile-card-label {
        font-weight: 600;
        color: #5a5c69;
        font-size: 0.9rem;
        flex: 1;
        min-width: 120px;
    }
    
    .mobile-card-value {
        text-align: right;
        flex: 1;
        font-size: 0.9rem;
        color: #333;
    }
    
    .mobile-card-value .badge {
        font-size: 0.8rem;
    }
    
    .mobile-card-value .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .mobile-card-status {
        padding: 1rem;
        background: #f8f9fc;
        border-top: 1px solid #e3e6f0;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .mobile-card-status .btn {
        flex: 1;
        max-width: 200px;
    }
    
    /* Money formatting */
    .mobile-card-value .text-success,
    .mobile-card-value .text-primary {
        font-weight: 600;
    }
    
    /* Button adjustments for mobile cards */
    .mobile-card-value .btn-sm,
    .mobile-card-status .btn {
        white-space: nowrap;
        min-width: 80px;
    }
}

@media (max-width: 576px) {
    .table {
        font-size: 0.8rem;
    }
    
    .table thead th {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }
    
    .table tbody td {
        padding: 0.5rem 0.25rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Badge Styles */
.badge {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-weight: 500;
}

.badge.bg-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
}

.badge.bg-danger {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%) !important;
}

/* Button Styles */
.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.4);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* Modal Enhancements */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1.5rem;
}

.modal-body {
    padding: 2rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
}

/* QR Code Styling */
.qr-code-container {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.qr-code-image {
    transition: transform 0.3s ease;
}

.qr-code-image:hover {
    transform: scale(1.05);
}

.payment-details {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.payment-details ul li {
    padding: 0.25rem 0;
    border-bottom: 1px solid #e9ecef;
}

.payment-details ul li:last-child {
    border-bottom: none;
}

.payment-breakdown {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.payment-breakdown .table {
    margin-bottom: 0;
}

/* Modal size adjustments */
.modal-lg {
    max-width: 800px;
}

@media (max-width: 768px) {
    .modal-lg {
        max-width: 95%;
        margin: 1rem auto;
    }
    
    .qr-code-container {
        margin-top: 1rem;
        padding: 1rem;
    }
    
    .qr-code-image {
        max-width: 150px !important;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .content-section {
        margin: 1rem;
        padding: 1rem !important;
    }
    
    .payment-summary {
        padding: 1.5rem;
    }
    
    .summary-item {
        font-size: 1rem;
        margin-bottom: 1rem;
        text-align: center;
    }
    
    .progress-section .d-flex {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .header-section h2 {
        font-size: 1.5rem;
    }
    
    .user-info {
        text-align: center;
        gap: 0.5rem;
    }
    
    .user-info span {
        margin: 0 !important;
    }
}

@media (max-width: 576px) {
    .content-section {
        margin: 0.5rem;
        padding: 0.75rem !important;
    }
    
    .payment-summary {
        padding: 1rem;
    }
    
    .summary-item {
        font-size: 0.9rem;
    }
    
    .header-section {
        padding: 1rem !important;
    }
    
    .header-section h2 {
        font-size: 1.25rem;
    }
    
    .sidebar-header {
        padding: 1rem !important;
    }
    
    .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .modal-lg {
        max-width: 95%;
        margin: 0.5rem auto;
    }
    
    .modal-body {
        padding: 1rem !important;
    }
    
    .qr-code-container {
        margin-top: 1rem;
        padding: 1rem;
    }
    
    .qr-code-image {
        max-width: 150px !important;
    }
    
    .alert {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
