/* ============================================
   Nicolas Ortiz - Dashboard Redesign
   Mobile-first + clean modern palette
   ============================================ */

:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --surface: #ffffff;
    --bg: #f1f5f9;
    --bg-alt: #f8fafc;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #2563eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --radius: 8px;
    --radius-sm: 6px;
    --sidebar-width: 260px;
    --header-height: 60px;
}

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

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

p { margin: 0; padding: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ============================================
   LAYOUT
   ============================================ */

body.dashboard-layout {
    display: flex;
    overflow: hidden;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 40;
}
.sidebar-overlay.open { display: block; }

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: transform 0.25s ease;
    overflow-y: auto;
}

.sidebar-user {
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.sidebar-user-name {
    font-size: 15px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.sidebar-user-email {
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-nav-label {
    padding: 8px 20px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.sidebar-nav a svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: #f1f5f9;
}

.sidebar-nav a.active {
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
    border-left-color: var(--sidebar-active);
}

/* Sidebar footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer-brand {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-light);
    text-align: center;
    margin-bottom: 8px;
}

.sidebar-footer-sub {
    font-size: 11px;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 12px;
}

.sidebar-social {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.sidebar-social a {
    color: #64748b;
    transition: color 0.15s;
}

.sidebar-social a:hover { color: #94a3b8; }

.sidebar-social svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.25s ease;
}

/* ============================================
   HEADER
   ============================================ */

.top-header {
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 30;
}

.top-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--text);
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.hamburger-btn:hover { background: var(--bg); }

.hamburger-btn svg {
    width: 24px;
    height: 24px;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.top-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    transition: all 0.15s;
}

.user-menu-btn:hover {
    background: var(--bg);
    border-color: var(--text-light);
}

.user-menu-btn img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

/* ============================================
   CONTENT AREA
   ============================================ */

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg);
}

/* ============================================
   CARDS (Dashboard)
   ============================================ */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.dashboard-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.dashboard-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.dashboard-card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.dashboard-card-room {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}

.dashboard-card-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.dashboard-card-info .info-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.dashboard-card-info .info-label {
    color: var(--text-muted);
}

.dashboard-card-info .info-value {
    color: var(--text);
    font-weight: 500;
}

.dashboard-card-info .next-payment {
    font-weight: 700;
    font-size: 14px;
    padding: 4px 10px;
    border-radius: 12px;
}

.next-payment.overdue {
    background: var(--danger-bg);
    color: var(--danger);
}

.next-payment.ok {
    background: var(--success-bg);
    color: var(--success);
}

.dashboard-card-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   FILTER BAR
   ============================================ */

.filter-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-bar label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
}

.filter-bar select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    min-width: 160px;
}

.filter-bar select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-bar .btn {
    white-space: nowrap;
}

/* ============================================
   PAGE SECTION TITLE
   ============================================ */

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    padding-bottom: 8px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.table-container .table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--bg-alt);
    border-bottom: 2px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td, .table tbody th {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
}

.table tbody tr:hover {
    background: var(--bg-alt);
}

/* ============================================
   BADGES
   ============================================ */

.badge-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-pendiente {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-pagado {
    background: var(--success-bg);
    color: var(--success);
}

/* ============================================
   FORMS
   ============================================ */

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.form-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    padding-bottom: 10px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: block;
}

.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    margin-bottom: 12px;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ============================================
   MODAL DETAILS
   ============================================ */

.detail-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.detail-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
    font-weight: 600;
    color: var(--text-muted);
    min-width: 130px;
    font-size: 13px;
}

.detail-value {
    color: var(--text);
    font-size: 14px;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn-sm-custom {
    padding: 5px 14px;
    font-size: 13px;
}

/* ============================================
   MOBILE NAV (bottom bar)
   ============================================ */

.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 8px 0;
    z-index: 45;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}

.mobile-bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
}

.mobile-bottom-nav a svg {
    width: 22px;
    height: 22px;
}

.mobile-bottom-nav a.active {
    color: var(--primary);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .hamburger-btn {
        display: block;
    }

    .content-area {
        padding: 16px;
        padding-bottom: 80px;
    }

    .mobile-bottom-nav {
        display: block;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar select {
        width: 100%;
    }

    .top-header {
        padding: 0 16px;
    }

    .page-title {
        font-size: 16px;
    }

    .table-container {
        overflow-x: auto;
    }

    .table-container .table {
        min-width: 600px;
    }
}

@media (min-width: 1024px) and (max-width: 1279px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1280px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1536px) {
    .card-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */

.content-area::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.content-area::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.content-area::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* ============================================
   UTILITIES
   ============================================ */

.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-muted { color: var(--text-muted) !important; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-4 { margin-bottom: 16px !important; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }
.text-center { text-align: center; }

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 16px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 40px 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.login-card h2 {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.login-card .login-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
}
