/* =========================================================
   BUSTAN SHARED STYLES
   ========================================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,.1);
    padding: 20px;
}

h1 { text-align: center; color: #333; margin-bottom: 10px; }
.subtitle { text-align: center; color: #666; margin-bottom: 20px; font-size: 14px; }
h2 { margin-bottom: 20px; }

/* ── Top Navigation ─────────────────────────────────────── */
.top-nav {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.nav-link {
    padding: 12px 24px;
    background-color: #f0f0f0;
    border: none;
    cursor: pointer;
    font-size: 16px;
    border-bottom: 3px solid transparent;
    text-decoration: none;
    color: #333;
    transition: all .3s ease;
    display: inline-block;
}

.nav-link:hover   { background-color: #e0e0e0; }
.nav-link.active  { background-color: #4CAF50; color: white; border-bottom-color: #45a049; }

/* ── Buttons ─────────────────────────────────────────────── */
button.action-btn {
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
    margin-right: 10px;
}
button.action-btn:hover { background-color: #45a049; }

.reset-btn   { background-color: #f44336 !important; }
.reset-btn:hover { background-color: #da190b !important; }

.warning-btn { background-color: #ffa500; }
.warning-btn:hover { background-color: #ff8c00; }

.btn-small {
    padding: 5px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}
.btn-save   { background-color: #4CAF50; color: white; }
.btn-save:hover   { background-color: #45a049; }
.btn-cancel { background-color: #f44336; color: white; }
.btn-cancel:hover { background-color: #da190b; }
.btn-edit   { background-color: #2196F3; color: white; }
.btn-edit:hover   { background-color: #0b7dda; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-weight: bold; color: #333; margin-bottom: 5px; }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: Arial, sans-serif;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 5px rgba(76,175,80,.3);
}

.editable-select {
    width: 100%; padding: 6px;
    border: 1px solid #ddd; border-radius: 3px;
    font-size: 13px;
}
.editable-select:focus { outline: none; border-color: #4CAF50; }

.readonly-input {
    width: 100%; padding: 6px;
    background-color: #e8e8e8;
    border: 1px solid #ccc; border-radius: 3px;
    font-size: 13px; cursor: not-allowed;
}

/* ── Status / Badges ─────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}
.status-badge.recorded     { background-color: #4CAF50; color: white; }
.status-badge.not-recorded { background-color: #f44336; color: white; }

.success-message {
    background-color: #c8e6c9; color: #1b5e20;
    padding: 12px; border-radius: 4px; margin-bottom: 15px; display: none;
}
.error-message {
    background-color: #ffcdd2; color: #b71c1c;
    padding: 12px; border-radius: 4px; margin-bottom: 15px; display: none;
}
.no-results { text-align: center; color: #999; padding: 40px; font-size: 16px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal {
    display: none; position: fixed; z-index: 1000;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,.5);
}
.modal.active { display: flex; justify-content: center; align-items: center; }

.modal-content {
    background-color: white; padding: 30px; border-radius: 8px;
    max-width: 600px; width: 90%; max-height: 80vh; overflow-y: auto;
}
.modal-header { font-size: 20px; font-weight: bold; color: #333; margin-bottom: 20px; }
.modal-close  { float: right; font-size: 24px; cursor: pointer; color: #999; }
.modal-close:hover { color: #333; }

/* ── Stat cards ──────────────────────────────────────────── */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px; margin-bottom: 20px;
}
.stat-card {
    background-color: #f5f5f5; padding: 15px;
    border-radius: 5px; text-align: center;
    border-left: 4px solid #4CAF50;
}
.stat-label { color: #666; font-size: 14px; margin-bottom: 5px; }
.stat-value { color: #333; font-size: 24px; font-weight: bold; }

/* ── Summary grid table ──────────────────────────────────── */
.summary-grid-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.summary-grid-table th {
    border: 2px solid #333; padding: 15px; text-align: center;
    font-weight: bold; font-size: 16px;
    background-color: #4CAF50; color: white;
}
.summary-grid-table td {
    border: 2px solid #333; padding: 15px; text-align: center;
    font-weight: bold; font-size: 14px;
    min-height: 60px;
}
.summary-grid-table td.paid     { background-color: #c8e6c9; color: #1b5e20; }
.summary-grid-table td.unpaid   { background-color: #ffcdd2; color: #b71c1c; }
.summary-grid-table td.partial  { background-color: #fff9c4; color: #f57f17; }
.summary-grid-table td.recorded { background-color: #b3e5fc; color: #01579b; }

.unit-name   { display: block; font-weight: bold; margin-bottom: 8px; font-size: 15px; }
.unit-amount { display: block; font-size: 12px; color: inherit; opacity: .9; font-weight: normal; }

/* ── Legend ──────────────────────────────────────────────── */
.legend { display: flex; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 10px; }
.legend-box  { width: 30px; height: 30px; border: 2px solid #333; border-radius: 3px; }
.legend-box.paid     { background-color: #c8e6c9; }
.legend-box.unpaid   { background-color: #ffcdd2; }
.legend-box.partial  { background-color: #fff9c4; }
.legend-box.recorded { background-color: #b3e5fc; }

/* ── Tenant cards ────────────────────────────────────────── */
.tenant-list   { background-color: #f9f9f9; border: 1px solid #ddd; border-radius: 8px; padding: 15px; margin-bottom: 20px; }
.tenant-list h3 { color: #333; margin-bottom: 15px; font-size: 16px; }
.tenant-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 15px; }
.tenant-card   {
    background-color: white; border: 1px solid #ddd; border-radius: 6px;
    padding: 15px; cursor: pointer; transition: all .3s ease;
}
.tenant-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.15); transform: translateY(-2px); }
.tenant-card-unit   { font-weight: bold; font-size: 16px; color: #4CAF50; margin-bottom: 5px; }
.tenant-card-name   { font-size: 14px; color: #333; margin-bottom: 5px; }
.tenant-card-phone  { font-size: 12px; color: #666; margin-bottom: 10px; }
.tenant-card-status { display: inline-block; padding: 3px 8px; border-radius: 3px; font-size: 11px; font-weight: bold; }
.tenant-card-status.active   { background-color: #c8e6c9; color: #1b5e20; }
.tenant-card-status.inactive { background-color: #ffe0b2; color: #e65100; }

/* ── Tenant profile ──────────────────────────────────────── */
.profile-header {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 20px; margin-bottom: 20px;
    padding-bottom: 20px; border-bottom: 2px solid #ddd;
}
.profile-item { background-color: white; padding: 15px; border-radius: 4px; border-left: 4px solid #4CAF50; }
.profile-item.inactive { border-left-color: #ff9800; opacity: .7; }
.profile-label { font-size: 12px; color: #666; margin-bottom: 5px; }
.profile-value { font-size: 18px; font-weight: bold; color: #333; }

.status-badge-profile { display: inline-block; padding: 5px 10px; border-radius: 20px; font-size: 12px; font-weight: bold; margin-bottom: 10px; }
.status-badge-profile.active   { background-color: #c8e6c9; color: #1b5e20; }
.status-badge-profile.inactive { background-color: #ffe0b2; color: #e65100; }

.months-paid-section { background-color: white; padding: 15px; border-radius: 4px; border-left: 4px solid #2196F3; margin-top: 20px; }
.months-paid-section h3 { color: #333; margin-bottom: 15px; font-size: 16px; }
.months-paid-list { display: grid; gap: 10px; }
.month-entry { background-color: #f5f5f5; padding: 10px; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.month-entry .month-name { font-weight: bold; color: #333; }
.month-entry .month-date { color: #666; font-size: 12px; }

.profile-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

.add-month-section { background-color: #f5f5f5; padding: 15px; border-radius: 4px; margin-top: 15px; }
.add-month-section h4 { margin-bottom: 10px; color: #333; }

/* ── Transactions table ──────────────────────────────────── */
.transactions-section { margin-top: 30px; }
.scrollable-table { overflow-x: auto; }

.transactions-table { width: 100%; border-collapse: collapse; margin-top: 20px; font-size: 13px; }
.transactions-table th {
    background-color: #4CAF50; color: white;
    padding: 12px; text-align: left; font-weight: bold;
    border: 1px solid #ddd; cursor: pointer; user-select: none;
}
.transactions-table th:hover { background-color: #45a049; }
.sort-icon { margin-left: 5px; font-size: 12px; display: inline-block; min-width: 15px; }
.transactions-table td { padding: 12px; border: 1px solid #ddd; }
.transactions-table tr:nth-child(even) { background-color: #f9f9f9; }
.transactions-table tr:hover { background-color: #f0f0f0; }
.transaction-row.recorded     { background-color: #c8e6c9 !important; }
.transaction-row.recorded:hover   { background-color: #b3d9b3 !important; }
.transaction-row.not-recorded { background-color: #ffebee; }
.transaction-row.not-recorded:hover { background-color: #ffcdd2; }

/* ── Filter buttons ──────────────────────────────────────── */
.filter-section { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-btn {
    padding: 8px 15px; border: 2px solid #ddd;
    background-color: white; border-radius: 4px;
    cursor: pointer; font-size: 13px; font-weight: bold;
}
.filter-btn.active          { background-color: #4CAF50; color: white; border-color: #4CAF50; }
.filter-btn.active-recorded { background-color: #4CAF50; color: white; border-color: #4CAF50; }
.filter-btn.active-not-recorded { background-color: #f44336; color: white; border-color: #f44336; }

/* ── Upload section ──────────────────────────────────────── */
.upload-section {
    background-color: #f9f9f9;
    border: 2px dashed #4CAF50;
    border-radius: 8px; padding: 30px; margin-bottom: 30px;
}
.upload-section h3 { color: #333; margin-bottom: 20px; }
.upload-controls { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.upload-controls > div { display: flex; flex-direction: column; }
.upload-controls label { font-weight: bold; color: #333; margin-bottom: 8px; }
.upload-controls input[type="month"],
.upload-controls input[type="file"] { padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }

.file-input-wrapper { position: relative; display: inline-block; cursor: pointer; }
.file-input-wrapper input[type="file"] { position: absolute; left: -9999px; }
.file-input-label {
    background-color: #4CAF50; color: white;
    padding: 12px 30px; border-radius: 4px;
    cursor: pointer; font-weight: bold; display: inline-block;
}
.file-input-label:hover { background-color: #45a049; }

.upload-btn { background-color: #2196F3; color: white; padding: 12px 30px; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; display: inline-block; align-self: flex-end; }
.upload-btn:hover    { background-color: #0b7dda; }
.upload-btn:disabled { background-color: #ccc; cursor: not-allowed; }
.file-name { margin-top: 10px; color: #666; font-size: 14px; }

/* ── Search ──────────────────────────────────────────────── */
.search-container { display: flex; gap: 10px; margin-bottom: 20px; }
.search-container input { flex: 1; padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }
.search-container button { background-color: #2196F3; color: white; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; }
.search-container button:hover { background-color: #0b7dda; }

/* ── Month selector ──────────────────────────────────────── */
.month-selector { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.month-selector label { font-weight: bold; color: #333; }
.month-selector input { padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }

/* ── Onboard form ────────────────────────────────────────── */
.onboard-form { background-color: #f9f9f9; border: 1px solid #ddd; border-radius: 8px; padding: 20px; max-width: 600px; }
