/* RentTracker Mockup Styles - App-specific patterns */

/* App Shell Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: var(--primary-blue);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo {
    font-size: 1.25rem;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
    padding: 0 20px;
    margin-bottom: 8px;
}

/* Collapsible section headers: render the title as a full-width button with a
   chevron indicator. The list (<ul>) is hidden via the [hidden] attribute when
   the section is collapsed. */
.sidebar-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    color: inherit;
    font: inherit;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
    padding: 4px 20px;
    margin-bottom: 8px;
    transition: color 0.2s;
}

.sidebar-section-toggle:hover {
    color: rgba(255,255,255,0.85);
}

.sidebar-section-toggle:focus-visible {
    outline: 2px solid var(--action-green);
    outline-offset: -2px;
}

.sidebar-section-toggle .sidebar-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    opacity: 0.8;
}

.sidebar-section.is-collapsible:not(.is-open) .sidebar-chevron {
    transform: rotate(-90deg);
}

.sidebar-section.is-collapsible:not(.is-open) {
    margin-bottom: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-nav a.active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--action-green);
    border-left: 3px solid var(--action-green);
}

.sidebar-nav svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
}

/* Main Content Area (with sidebar) */
.app-main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* The main area is a flex child; without min-width it expands to fit any
       wide descendant (e.g. a multi-column table), pushing the whole page
       past the viewport. Letting it shrink lets .table-wrapper scroll
       internally instead. */
    min-width: 0;
    max-width: calc(100% - 260px);
    overflow-x: hidden;
}

/* Top Header Bar */
.top-bar {
    background: var(--white);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 40;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-bar-left h1 {
    font-size: 1.25rem;
    color: var(--primary-blue);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.breadcrumb a {
    color: var(--text-light);
}

.breadcrumb a:hover {
    color: var(--action-green);
}

.breadcrumb span {
    color: var(--text-dark);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--action-green);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-info {
    text-align: right;
}

.user-info .name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.user-info .role {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Page Content */
.page-content {
    padding: 24px;
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 1.5rem;
    color: var(--primary-blue);
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* Dashboard Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card .stat-icon svg {
    width: 20px;
    height: 20px;
}

.stat-card .stat-icon.green {
    background: var(--light-green);
}

.stat-card .stat-icon.green svg {
    fill: var(--action-green);
}

.stat-card .stat-icon.blue {
    background: #DBEAFE;
}

.stat-card .stat-icon.blue svg {
    fill: var(--info);
}

.stat-card .stat-icon.yellow {
    background: #FEF3C7;
}

.stat-card .stat-icon.yellow svg {
    fill: var(--warning);
}

.stat-card .stat-icon.red {
    background: #FEE2E2;
}

.stat-card .stat-icon.red svg {
    fill: var(--danger);
}

/* Property / Unit Cards */
.property-card {
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.property-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

.property-card-image {
    height: 160px;
    background: linear-gradient(135deg, var(--secondary-blue), var(--primary-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

.property-card-body {
    padding: 20px;
}

.property-card-body h4 {
    font-size: 1.1rem;
    color: var(--primary-blue);
    margin-bottom: 8px;
}

.property-card-body .location {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.property-card-stats {
    display: flex;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.property-card-stats .stat {
    text-align: center;
}

.property-card-stats .stat-num {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.property-card-stats .stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Activity / Timeline List */
.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon svg {
    width: 18px;
    height: 18px;
}

.activity-icon.payment {
    background: var(--light-green);
}

.activity-icon.payment svg {
    fill: var(--action-green);
}

.activity-icon.maintenance {
    background: #FEF3C7;
}

.activity-icon.maintenance svg {
    fill: var(--warning);
}

.activity-icon.lease {
    background: #DBEAFE;
}

.activity-icon.lease svg {
    fill: var(--info);
}

.activity-icon.alert {
    background: #FEE2E2;
}

.activity-icon.alert svg {
    fill: var(--danger);
}

.activity-content {
    flex: 1;
}

.activity-content .title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.activity-content .description {
    font-size: 0.85rem;
    color: var(--text-light);
}

.activity-time {
    font-size: 0.8rem;
    color: var(--text-light);
    white-space: nowrap;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    fill: var(--border-color);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
}

.tab {
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
}

.tab:hover {
    color: var(--text-dark);
}

.tab.active {
    color: var(--action-green);
    border-bottom-color: var(--action-green);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar .search-input {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.filter-bar .search-input input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
}

.filter-bar .search-input svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    fill: var(--text-light);
}

.filter-bar select {
    padding: 10px 32px 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--white);
    cursor: pointer;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.1rem;
    color: var(--primary-blue);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Tenant Portal Specific */
.portal-header {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    padding: 32px;
    color: white;
    border-radius: 16px;
    margin-bottom: 24px;
}

.portal-header h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.portal-header p {
    color: rgba(255,255,255,0.8);
    font-size: 0.95rem;
}

.portal-balance {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 24px;
}

.portal-balance .amount {
    font-size: 2.5rem;
    font-weight: 700;
}

.portal-balance .label {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
}

/* Quick Actions Grid */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.quick-action {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.quick-action:hover {
    border-color: var(--action-green);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.quick-action svg {
    width: 32px;
    height: 32px;
    fill: var(--action-green);
    margin-bottom: 12px;
}

.quick-action span {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-dark);
}

/* Responsive for App Shell */
@media (max-width: 1024px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .app-main {
        margin-left: 0;
        max-width: 100%;
    }
    
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: 1fr 1fr;
    }
    
    .page-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-bar .search-input {
        width: 100%;
    }
}
