:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg-body: #F3F4F6;
    --bg-card: #FFFFFF;
    --text-main: #111827;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Auth Page */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.auth-box {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.auth-box h1 {
    font-size: 24px;
    margin-bottom: 8px;
    color: #111;
}

.auth-subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Layout */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

.sidebar {
    width: 250px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
}

.brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
}

.brand ion-icon {
    font-size: 24px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    background-color: #EEF2FF;
    color: var(--primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-details .name {
    font-size: 14px;
    font-weight: 600;
}

.logout {
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
}

.logout:hover {
    color: var(--danger);
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 20px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
}

/* Stats */
.stats-cards {
    display: flex;
    gap: 24px;
    width: 100%;
    margin-top: 24px;
}

.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
}

.stat-card {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-card .icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.bg-blue {
    background: #3B82F6;
}

.bg-green {
    background: #10B981;
}

.bg-orange {
    background: #F59E0B;
}

.stat-card .info h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-card .info span {
    font-size: 24px;
    font-weight: 700;
}

/* Room Grid */
.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
}

.room-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
}

.room-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.room-card.occupied {
    border-left: 4px solid var(--warning);
}

.room-card.available {
    border-left: 4px solid var(--success);
}

.room-number {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.room-price {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

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

.status-available {
    background: #D1FAE5;
    color: #065F46;
}

.status-occupied {
    background: #FEF3C7;
    color: #92400E;
}

.room-tenant {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-main);
    font-weight: 500;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
}

.data-table tr:hover td {
    background-color: #F9FAFB;
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

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

.btn-danger {
    background: white;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: #FEF2F2;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--bg-card);
    margin: 10% auto;
    padding: 32px;
    border-radius: 16px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    position: absolute;
    right: 24px;
    top: 24px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-secondary);
}

.close:hover {
    color: var(--text-main);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.alert {
    padding: 12px;
    background: #FEF2F2;
    color: var(--danger);
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
}

/* Responsive Design */
/* Responsive Design */
@media (max-width: 768px) {
    body {
        /* Allow normal scroll on mobile */
        height: auto !important;
        overflow-y: auto !important;
        overflow-x: hidden;
    }

    .app-container {
        flex-direction: column;
        padding-bottom: 70px;
        /* Space for bottom nav */
        height: auto;
        overflow: visible;
    }

    /* Space for bottom nav */
}

/* Bottom Navigation Bar */
.sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    padding: 0;
    z-index: 2000;
    background: white;
    border-top: 1px solid var(--border);
    border-right: none;
    border-bottom: none;
    display: flex;
    justify-content: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.brand {
    display: none;
    /* Hide logo on mobile to save space */
}

.user-info {
    display: none;
    /* Hide user info on bottom bar */
}

.nav-menu {
    flex-direction: row;
    width: 100%;
    justify-content: space-around;
    align-items: center;
    margin: 0;
    padding: 0 8px;
}

.nav-item {
    flex-direction: column;
    padding: 8px 4px;
    gap: 4px;
    font-size: 10px;
    border-radius: 8px;
    color: var(--text-secondary);
    width: 60px;
    text-align: center;
    justify-content: center;
    margin: 0;
}

.nav-item.active {
    background: transparent;
    color: var(--primary);
}

.nav-item ion-icon {
    display: block;
    /* Show icons again */
    font-size: 20px;
    margin-right: 0;
    margin-bottom: 2px;
}

/* Adjust Main Content */
.main-content {
    padding: 16px;
    padding-bottom: 90px;
    /* Extra padding for bottom nav */
    width: 100%;
}

.page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.page-header button {
    width: 100%;
}

/* Modal Mobile Fixes (Safari Scroll) */
.modal {
    display: none;
    /* Will be flex when open */
    position: fixed;
    z-index: 3000;
    /* Higher than nav */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);

    /* Enabling scroll on the modal container itself */
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    padding: 10px 0;
    align-items: flex-start;
    /* Start from top to allow scrolling long content */
    justify-content: center;
}

/* Center modal if content is short, but allow scroll if long */
.modal::before {
    content: "";
    display: block;
    height: 20px;
    /* Top spacing */
    width: 100%;
}

.modal-content {
    display: block;
    width: 95%;
    max-width: 95%;
    margin: 0 auto 40px auto;
    /* Vertical margin */
    padding: 20px;
    border-radius: 12px;
    position: relative;
    /* Reset transform to avoid blurriness/position issues */
    transform: none !important;
    animation: none;

    /* Ensure content inside doesn't overflow horizontally */
    box-sizing: border-box;
}

/* Adjust specific modals */
#billModal .modal-content,
#roomDetailsModal .modal-content {
    padding: 16px;
}

/* Form Inputs on Mobile */
input,
select,
textarea {
    font-size: 16px !important;
    /* Prevent zoom on focus iOS */
    padding: 12px;
}

/* Table horizontal scroll */
.card {
    overflow-x: auto;
}

.data-table {
    min-width: 600px;
    /* Force scroll */
}

.data-table th,
.data-table td {
    white-space: nowrap;
}
}
th[onclick] {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}
th[onclick]:active {
    background-color: rgba(0,0,0,0.05);
}
