/* =============================================
   UrbanPoint - Sistema de Gestión Inmobiliaria
   Paleta basada en el logo corporativo
   ============================================= */
:root {
    --azul:        #1a3a6b;
    --azul-medio:  #1e4d8c;
    --azul-claro:  #e8eef7;
    --azul-soft:   #1a3a6b1a;
    --blanco:      #ffffff;
    --gris-bg:     #f0f4f8;
    --gris-border: #d0dae8;
    --gris-text:   #5a6a80;
    --surface:     #ffffff;
    --surface2:    #f5f8fc;
    --text:        #1a2b42;
    --success:     #2ecc71;
    --danger:      #e74c3c;
    --warning:     #f39c12;
    --radius:      10px;
    --font:        'Inter', system-ui, sans-serif;
    --shadow:      0 2px 12px rgba(26,58,107,0.10);
    --shadow-md:   0 4px 24px rgba(26,58,107,0.15);
}

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

body {
    font-family: var(--font);
    background: var(--gris-bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: var(--azul-medio); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =============================================
   Auth / Login
   ============================================= */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a3a6b 0%, #1e4d8c 60%, #2a6099 100%);
    padding: 2rem;
}

.auth-card {
    background: var(--blanco);
    border-radius: 16px;
    padding: 2.8rem 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-md);
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.8rem;
}

.auth-logo img {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
}

.auth-card h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--azul);
    text-align: center;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-card .subtitle {
    color: var(--gris-text);
    font-size: 0.88rem;
    text-align: center;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gris-text);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.form-group input {
    width: 100%;
    background: var(--surface2);
    border: 1.5px solid var(--gris-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: var(--azul-medio);
    box-shadow: 0 0 0 3px var(--azul-soft);
    background: var(--blanco);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    border: none;
    transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
    text-decoration: none;
    letter-spacing: 0.3px;
}

.btn:active { transform: scale(0.98); }
.btn:hover { text-decoration: none; opacity: 0.92; }

.btn-primary {
    background: var(--azul);
    color: var(--blanco);
    width: 100%;
    box-shadow: 0 2px 8px rgba(26,58,107,0.25);
}

.btn-primary:hover { background: var(--azul-medio); opacity: 1; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1.5px solid var(--gris-border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }

/* =============================================
   Alertas
   ============================================= */
.alert {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
}

.alert-error {
    background: #fdf0ef;
    border: 1px solid #f5c6c2;
    color: var(--danger);
}

.alert-success {
    background: #edfaf3;
    border: 1px solid #a8e6c6;
    color: #1a7a42;
}

/* =============================================
   Layout principal (sidebar + contenido)
   ============================================= */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--azul);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(26,58,107,0.15);
}

.sidebar .sidebar-logo {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.sidebar .sidebar-logo img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}

.sidebar .sidebar-logo .logo-text {
    line-height: 1.2;
}

.sidebar .sidebar-logo .logo-text strong {
    display: block;
    color: var(--blanco);
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar .sidebar-logo .logo-text span {
    color: rgba(255,255,255,0.55);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.sidebar nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar nav .nav-section {
    padding: 0.6rem 1.2rem 0.3rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 1.5rem;
    color: rgba(255,255,255,0.72);
    font-size: 0.88rem;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar nav a:hover {
    color: var(--blanco);
    background: rgba(255,255,255,0.08);
    text-decoration: none;
}

.sidebar nav a.active {
    color: var(--blanco);
    background: rgba(255,255,255,0.12);
    border-left-color: var(--blanco);
    font-weight: 600;
}

.sidebar .sidebar-footer {
    padding: 1rem 1.2rem;
    border-top: 1px solid rgba(255,255,255,0.12);
}

.sidebar .user-info {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.8rem;
}

.sidebar .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--blanco);
    flex-shrink: 0;
}

.sidebar .user-details strong {
    display: block;
    color: var(--blanco);
    font-size: 0.85rem;
}

.sidebar .user-details small {
    color: rgba(255,255,255,0.5);
    font-size: 0.75rem;
}

.btn-logout {
    width: 100%;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 7px;
    padding: 0.55rem 1rem;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.2s;
    text-align: center;
    display: block;
    text-decoration: none;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.18);
    color: var(--blanco);
    text-decoration: none;
}

/* =============================================
   Contenido principal
   ============================================= */
.main-content {
    margin-left: 250px;
    flex: 1;
    padding: 2rem 2.5rem;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 1.8rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header-text h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--azul);
    letter-spacing: -0.3px;
}

.page-header-text p {
    color: var(--gris-text);
    font-size: 0.88rem;
    margin-top: 0.15rem;
}

/* =============================================
   Cards / Stats
   ============================================= */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.2rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--blanco);
    border: 1.5px solid var(--gris-border);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: var(--shadow);
}

.stat-card .stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--gris-text);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--azul);
}

/* =============================================
   Tablas
   ============================================= */
.table-wrapper {
    background: var(--blanco);
    border: 1.5px solid var(--gris-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.table-wrapper th {
    background: var(--azul);
    color: rgba(255,255,255,0.85);
    padding: 0.8rem 1.2rem;
    text-align: left;
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    font-weight: 600;
}

.table-wrapper td {
    padding: 0.85rem 1.2rem;
    border-top: 1px solid var(--gris-border);
    color: var(--text);
}

.table-wrapper tr:hover td {
    background: var(--azul-claro);
}

/* =============================================
   Badges
   ============================================= */
.badge {
    display: inline-block;
    padding: 0.2rem 0.75rem;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-admin      { background: var(--azul-soft); color: var(--azul); }
.badge-usuario    { background: #edfaf3; color: #1a7a42; }
.badge-disponible { background: #edfaf3; color: #1a7a42; }
.badge-alquilado  { background: var(--azul-soft); color: var(--azul); }
.badge-mantenimiento { background: #fff8e6; color: #996600; }
.badge-inactivo   { background: #f5f5f5; color: #888; }
.badge-activo     { background: #edfaf3; color: #1a7a42; }
.badge-vencido    { background: #fdf0ef; color: var(--danger); }
.badge-pendiente  { background: #fff8e6; color: #996600; }
.badge-pagado     { background: #edfaf3; color: #1a7a42; }
.badge-atrasado   { background: #fdf0ef; color: var(--danger); }

/* =============================================
   Formularios de carga
   ============================================= */
.form-card {
    background: var(--blanco);
    border: 1.5px solid var(--gris-border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    max-width: 700px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-grid .full { grid-column: 1 / -1; }

.form-group select,
.form-group textarea {
    width: 100%;
    background: var(--surface2);
    border: 1.5px solid var(--gris-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text);
    font-size: 0.92rem;
    font-family: var(--font);
    transition: border-color 0.2s;
    outline: none;
}

.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--azul-medio);
    box-shadow: 0 0 0 3px var(--azul-soft);
}

.form-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 1.2rem; }
    .form-grid { grid-template-columns: 1fr; }
}
