/* ============================================
   Sistema Mi Casa en Pagos - Stylesheet
   ============================================ */

:root {
    --color-primary: #378ADD;
    --color-primary-dark: #185FA5;
    --color-success: #639922;
    --color-warning: #EF9F27;
    --color-danger: #E24B4A;
    --color-gray-50: #F1EFE8;
    --color-gray-100: #D3D1C7;
    --color-text-primary: #2C2C2A;
    --color-text-secondary: #5F5E5A;
    --color-border: #D3D1C7;
    --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-gray-50);
    color: var(--color-text-primary);
    line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ===== NAVBAR ===== */
.navbar {
    background: white;
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.navbar-brand {
    font-size: 1.5rem;
    font-weight: 600;
    color: #000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.navbar-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}
.navbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--color-gray-50);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

/* ===== LAYOUT ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: white;
    padding: 0.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    flex-wrap: wrap;
}
.tab {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.938rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}
.tab:hover { background: var(--color-gray-50); }
.tab.active { background: var(--color-primary); color: white; }

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}
.card-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 0.625rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.938rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    line-height: 1.4;
}
.btn-primary { background: var(--color-primary); color: white; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-success { background: var(--color-success); color: white; }
.btn-danger { background: var(--color-danger); color: white; }
.btn-warning { background: var(--color-warning); color: white; }
.btn-secondary { background: white; color: var(--color-text-primary); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-gray-50); }
.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.813rem; }
.btn-block { width: 100%; justify-content: center; }

/* ===== GRID ===== */
.grid { display: grid; gap: 1.5rem; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* ===== PROPERTY CARDS ===== */
.property-card {
    display: block;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}
.property-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(55, 138, 221, 0.1);
}
.property-card.completed {
    border-color: var(--color-success);
    background: #F8FCF3;
}
.property-photo {
    width: 100%;
    height: 150px;
    overflow: hidden;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.property-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.property-info h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.property-info p { font-size: 0.813rem; color: var(--color-text-secondary); }
.property-details { font-size: 0.75rem !important; margin: 0.5rem 0; }
.property-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}
.stat { text-align: center; }
.stat-value { font-size: 1.25rem; font-weight: 600; display: block; }
.stat-label { font-size: 0.75rem; color: var(--color-text-secondary); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.938rem;
    font-family: inherit;
    background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(55,138,221,0.1);
}
.form-group small { display: block; margin-top: 0.25rem; color: var(--color-text-secondary); font-size: 0.813rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ===== FILTER ROW ===== */
.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 0 1.5rem 1.5rem;
}

/* ===== BADGES ===== */
.role-badge, .status-badge {
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}
.role-admin { background: #EEEDFE; color: #534AB7; }
.role-constructor { background: #E1F5EE; color: #0F6E56; }
.role-user { background: #E6F1FB; color: #185FA5; }
.status-pending { background: #FAEEDA; color: #854F0B; }
.status-progress { background: #E6F1FB; color: #185FA5; }
.status-completed { background: #EAF3DE; color: #3B6D11; }
.status-danger { background: #FCEBEB; color: #A32D2D; }

/* ===== SUMMARY CARDS ===== */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    padding: 0 1.5rem 1.5rem;
}
.summary-card {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.summary-card-label { font-size: 0.813rem; color: var(--color-text-secondary); margin-bottom: 0.5rem; }
.summary-card-value { font-size: 1.75rem; font-weight: 600; }

/* ===== CHART ===== */
.chart-container {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

/* ===== CHECKLIST ===== */
.checklist-section { margin-bottom: 2rem; padding: 0 1.5rem; }
.checklist-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
}
.checklist-item {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}
.checklist-item:hover { background: var(--color-gray-50); }
.checklist-item.completed { background: #F8FCF3; border-color: var(--color-success); }
.checklist-item-header { display: flex; align-items: center; gap: 1rem; }
.checklist-item-header input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; }
.checklist-item-content { flex: 1; }
.checklist-item-title { font-weight: 500; }
.checklist-item-notes {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    background: var(--color-gray-50);
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 0.5rem;
    margin-left: 2.25rem;
}
.checklist-item-actions { margin-left: 2.25rem; margin-top: 0.5rem; }

/* ===== PENDING BANNER ===== */
.pending-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    margin: 0 1.5rem 1.5rem;
    border-radius: var(--radius);
    border: 2px solid var(--color-warning);
    background: #FFF8ED;
}
.pending-banner.completed {
    border-color: var(--color-success);
    background: #F8FCF3;
}
.pending-count { text-align: right; }
.pending-number {
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-warning);
    display: block;
}
.pending-banner.completed .pending-number { color: var(--color-success); }
.pending-label { font-size: 0.813rem; color: var(--color-text-secondary); }

/* ===== PROPERTY INFO BANNER ===== */
.property-info-banner {
    background: var(--color-gray-50);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin: 0 1.5rem 1.5rem;
    font-weight: 500;
}

/* ===== TABLES ===== */
.table-responsive { overflow-x: auto; padding: 0 1.5rem 1.5rem; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.813rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    border-bottom: 2px solid var(--color-border);
}
.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
}
.data-table tbody tr:hover { background: var(--color-gray-50); }
.data-table tfoot td {
    font-weight: 600;
    border-top: 2px solid var(--color-border);
    background: var(--color-gray-50);
}

/* ===== AVATARS ===== */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* ===== EXPENSES ===== */
.expense-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin: 0 1.5rem 1rem;
}
.expense-card:hover { background: var(--color-gray-50); }
.expense-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.75rem;
}
.expense-header h4 { margin-bottom: 0.25rem; }
.expense-type-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.813rem;
    font-weight: 500;
}
.expense-materials { background: #E6F1FB; color: #185FA5; }
.expense-labor { background: #FAEEDA; color: #854F0B; }
.expense-other { background: #F1EFE8; color: #5F5E5A; }
.expense-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}
.expense-detail-label { font-size: 0.75rem; color: var(--color-text-secondary); }
.expense-files { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.file-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    background: var(--color-gray-50);
    border-radius: 6px;
    font-size: 0.813rem;
}
.file-badge:hover { background: var(--color-gray-100); }

/* ===== HISTORY ===== */
.history-entry {
    padding: 1rem;
    border-left: 3px solid var(--color-primary);
    background: var(--color-gray-50);
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 0 1.5rem 1rem;
}
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.history-user { font-weight: 500; }
.history-time { font-size: 0.813rem; color: var(--color-text-secondary); }
.history-action { font-size: 0.938rem; }

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal.active { display: flex; }
.modal-content {
    background: white;
    border-radius: var(--radius);
    max-width: 550px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-content.modal-large { max-width: 700px; }
.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { font-size: 1.25rem; font-weight: 600; }
.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}
.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-secondary);
    text-decoration: none;
}

/* ===== ALERTS ===== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.938rem;
}
.alert-success { background: #EAF3DE; color: #3B6D11; border: 1px solid #C0DD97; }
.alert-danger { background: #FCEBEB; color: #A32D2D; border: 1px solid #F09595; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--color-text-secondary);
}

/* ===== LOGIN PAGE ===== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #E6F1FB 0%, var(--color-gray-50) 100%);
}
.login-container { width: 100%; max-width: 400px; padding: 1rem; }
.login-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    padding: 2.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-logo { width: 64px; height: 64px; border-radius: 50%; margin-bottom: 1rem; }
.login-header h1 { font-size: 1.25rem; margin-bottom: 0.25rem; }
.login-header p { font-size: 0.875rem; color: var(--color-text-secondary); }
.login-footer { text-align: center; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--color-border); }
.login-footer p { font-size: 0.75rem; color: var(--color-text-secondary); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .container { padding: 1rem; }
    .navbar { padding: 1rem; flex-direction: column; gap: 1rem; }
    .form-row-3 { grid-template-columns: 1fr; }
    .filter-row { grid-template-columns: 1fr; }
    .expense-header { flex-direction: column; gap: 1rem; }
    .property-stats { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
}
