/* =====================================================
   RentPro — Main Application Styles
   ===================================================== */

/* Sidebar */
#sidebar-wrapper {
    width: 240px;
    min-height: 100vh;
    background: #2d3748;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.3s ease;
    overflow-y: auto;
}
#sidebar-wrapper .sidebar-brand {
    padding: 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
#sidebar-wrapper .sidebar-brand h5 {
    color: #fff;
    margin: 0;
    font-weight: 700;
}
#sidebar-wrapper .nav-link {
    color: rgba(255,255,255,0.65);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    transition: all 0.15s;
    border-radius: 0;
    font-size: 14px;
}
#sidebar-wrapper .nav-link i {
    width: 20px;
    text-align: center;
    margin-right: 10px;
}
#sidebar-wrapper .nav-link:hover,
#sidebar-wrapper .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}
#sidebar-wrapper .nav-section {
    color: rgba(255,255,255,0.4);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 20px 4px;
}

/* Page wrapper */
#page-content-wrapper {
    margin-left: 240px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.user-navbar-balance {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(260px, 42vw);
    margin: 0 12px 0 8px;
    padding: 7px 12px;
    border: 1px solid rgba(40, 167, 69, 0.25);
    border-radius: 8px;
    background: rgba(40, 167, 69, 0.08);
    color: #1b5e2c;
    line-height: 1.1;
    white-space: nowrap;
    cursor: default;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.user-balance-dropdown {
    flex: 0 0 auto;
    min-width: 0;
}
.user-balance-dropdown .user-navbar-balance {
    cursor: pointer;
}
.user-balance-dropdown .user-navbar-balance:hover,
.user-balance-dropdown .user-navbar-balance:focus,
.user-balance-dropdown.show .user-navbar-balance {
    border-color: rgba(40, 167, 69, 0.5);
    background: rgba(40, 167, 69, 0.14);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.08);
    outline: 0;
}
.user-navbar-balance .balance-icon {
    flex: 0 0 auto;
    margin-right: 7px;
    font-size: 20px;
}
.user-navbar-balance .balance-copy {
    min-width: 0;
}
.user-navbar-balance .balance-label {
    display: block;
    margin-bottom: 2px;
    color: #6c757d;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.user-navbar-balance .balance-amount {
    display: block;
    overflow: hidden;
    font-size: clamp(12px, 1.15vw, 15px);
    font-weight: 700;
    text-overflow: ellipsis;
}
.user-navbar-balance .balance-amount-compact {
    display: none;
}
.user-balance-menu {
    min-width: 270px;
    overflow: hidden;
    border: 0;
    border-radius: 10px;
}
.user-balance-menu .balance-menu-summary {
    padding: 14px 18px 11px;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.12), rgba(40, 167, 69, 0.03));
}
.user-balance-menu .balance-menu-label {
    display: block;
    margin-bottom: 4px;
    color: #6c757d;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.user-balance-menu .balance-menu-amount {
    display: block;
    overflow-wrap: anywhere;
    color: #1b5e2c;
    font-size: 17px;
    line-height: 1.3;
}
@media (max-width: 767.98px) {
    .user-navbar-balance {
        max-width: 120px;
    }
    .user-navbar-balance .balance-label {
        display: none;
    }
    .user-navbar-balance .balance-amount-full {
        display: none;
    }
    .user-navbar-balance .balance-amount-compact {
        display: block;
        overflow: visible;
        font-size: 12px;
        text-overflow: clip;
    }
}
@media (max-width: 575.98px) {
    .navbar .navbar-menu-wrapper {
        padding-left: 8px;
        padding-right: 8px;
    }
    .navbar .navbar-menu-wrapper .navbar-nav.navbar-nav-right .nav-item {
        margin-left: .4rem;
        margin-right: .4rem;
    }
    .user-navbar-balance {
        max-width: 108px;
        margin: 0 3px 0 0;
        padding: 6px 7px;
    }
    .user-navbar-balance .balance-icon {
        margin-right: 4px;
        font-size: 17px;
    }
    .user-navbar-balance .balance-amount {
        font-size: 11px;
    }
    .user-balance-dropdown .dropdown-menu.user-balance-menu {
        position: fixed !important;
        top: 67px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        min-width: 0;
        margin: 0;
        transform: none !important;
    }
}
@media (max-width: 379.98px) {
    .user-navbar-balance {
        width: 38px;
        min-width: 38px;
        height: 38px;
        justify-content: center;
        padding: 0;
        border-radius: 50%;
    }
    .user-navbar-balance .balance-copy {
        display: none;
    }
    .user-navbar-balance .balance-icon {
        margin: 0;
        font-size: 20px;
    }
    .user-navbar-balance.dropdown-toggle::after {
        position: absolute;
        right: 2px;
        bottom: 5px;
        margin: 0;
        border-top-width: 3px;
        border-right-width: 3px;
        border-left-width: 3px;
    }
}

.topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #e3e6f0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 99;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Main content */
.main-content {
    padding: 25px;
    flex: 1;
}

/* Cards */
.card {
    border: none;
    border-radius: 8px;
}
.card.border-left-primary { border-left: 4px solid #4e73df !important; }
.card.border-left-success { border-left: 4px solid #1cc88a !important; }
.card.border-left-info    { border-left: 4px solid #36b9cc !important; }
.card.border-left-warning { border-left: 4px solid #f6c23e !important; }
.card.border-left-danger  { border-left: 4px solid #e74a3b !important; }

/* Stat card hover */
.card.shadow-sm { transition: box-shadow 0.2s; }
.card.shadow-sm:hover { box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1) !important; }

/* Tables */
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

/* Badges */
.badge-lg { padding: 6px 12px; font-size: 13px; }

/* Avatar circle */
.avatar-circle {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; color: #fff;
    flex-shrink: 0;
}

/* Notifications dropdown */
.notification-item {
    border-bottom: 1px solid #f0f0f0;
    padding: 10px 16px;
}
.notification-item:last-child { border-bottom: none; }
.notification-item.unread { background: #f0f7ff; }

/* Opacity helpers */
.opacity-25 { opacity: 0.25; }

/* Flash messages */
.alert { border-radius: 6px; }

/* Mobile sidebar toggle */
#sidebarToggle {
    display: none;
    background: none; border: none; color: #555; font-size: 18px; padding: 4px 8px;
}

/* Responsive */
@media (max-width: 768px) {
    #sidebar-wrapper {
        transform: translateX(-240px);
    }
    #sidebar-wrapper.toggled {
        transform: translateX(0);
    }
    #page-content-wrapper {
        margin-left: 0;
    }
    #sidebarToggle { display: block; }
    .main-content { padding: 15px; }
}

/* Property card image */
.property-img {
    height: 200px;
    object-fit: cover;
    width: 100%;
}

/* Signature canvas */
#signatureCanvas {
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    max-width: 100%;
}

/* Timeline */
.timeline .timeline-item::before {
    content: '';
    position: absolute;
    left: 17px;
    top: 36px;
    bottom: -10px;
    width: 2px;
    background: #e3e6f0;
}

/* Pagination */
.pagination .page-link { border-radius: 4px; margin: 0 2px; }

/* Tenant payment segment chart */
.payment-segment-chart-wrap {
    height: 280px;
    min-height: 280px;
    position: relative;
}
.payment-segment-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 13px;
    color: #4a5568;
}
.payment-segment-legend span {
    display: inline-flex;
    align-items: center;
}
.payment-segment-legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    display: inline-block;
}
.payment-segment-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.payment-segment-pill {
    border: 1px solid #e3e6f0;
    border-left-width: 4px;
    border-radius: 8px;
    padding: 10px;
    min-height: 112px;
    background: #fff;
}
.payment-segment-pill strong,
.payment-segment-pill small,
.payment-segment-pill .badge {
    display: block;
}
.payment-segment-pill small {
    color: #6c7383;
    margin: 4px 0 8px;
}
.payment-segment-number {
    color: #6c7383;
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.payment-segment-success { border-left-color: #1bcfb4; }
.payment-segment-danger { border-left-color: #fe7c96; }
.payment-segment-warning { border-left-color: #fed713; }
.payment-segment-pill.is-current {
    box-shadow: 0 0 0 2px rgba(78, 115, 223, 0.18);
}

/* Footer */
.footer-wrapper {
    background: #fff;
    border-top: 1px solid #e7edf5;
    padding: 0 1.75rem;
    width: 100%;
}
.footer-wrapper .footer {
    background: transparent;
    color: #6c7383;
    padding: 18px 0;
    font-size: 13px;
    line-height: 1.5;
}
.footer-wrapper .footer a {
    color: #4e73df;
    font-weight: 600;
    text-decoration: none;
}
.footer-wrapper .footer a:hover {
    color: #224abe;
    text-decoration: none;
}
@media (max-width: 767.98px) {
    .footer-wrapper {
        padding: 0 1rem;
    }
    .footer-wrapper .footer {
        padding: 16px 0;
    }
}
