@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

:root {
    --nav-width: 280px;
    --primary-color: #3498db;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --light-grey: #f4f7f6;
    --dark-blue: #2c3e50;
    --medium-grey: #6c757d;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #ffffff;
    color: #333;
    margin: 0;
}

/* --- Splash Screen --- */
#splashScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--dark-blue) 0%, #1a2530 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease-in-out, visibility 0.8s;
    opacity: 1;
    visibility: visible;
}
#splashScreen.hidden {
    opacity: 0;
    visibility: hidden;
}
.splash-content {
    text-align: center;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.logo-container {
    margin-bottom: 30px;
}
.logo-shape {
    width: 120px;
    height: 120px;
    background: var(--primary-color);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    animation: pulse 2s infinite alternate;
}
.building-icon {
    width: 70px;
    height: 70px;
}
.welcome-text h1, .welcome-text h2 {
    margin: 0;
    overflow: hidden;
}
.line-1 {
    font-size: 2.5rem;
    font-weight: 600; 
    color: var(--primary-color);
    margin-bottom: 10px;
    opacity: 0;
    animation: fadeInUp 0.8s forwards;
    animation-delay: 0.5s;
}
.line-2 {
    font-size: 3.2rem;
    font-weight: 600;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    opacity: 0;
    animation: fadeInUp 0.8s forwards, glow 2s infinite alternate;
    animation-delay: 1s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    from {
        transform: scale(1);
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    }
    to {
        transform: scale(1.05);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    }
}

@keyframes glow {
    from {
        background-position: 0% 50%;
    }
    to {
        background-position: 100% 50%;
    }
}

/* --- Main Layout & Header --- */
#mainContent {
    transition: margin-left .5s;
    padding: 0;
}
header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 20px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-bottom: 1px solid #eee;
}
.open-btn {
    font-size: 30px;
    cursor: pointer;
}
header h1 {
    margin: 0;
    font-size: 1.8em;
}

/* --- Side Navigation --- */
.sidenav {
    height: 100%;
    width: var(--nav-width);
    position: fixed;
    z-index: 1001;
    top: 0;
    left: 0;
    background-color: var(--dark-blue);
    overflow-x: hidden;
    transition: 0.5s;
    padding-top: 20px;
    color: white;
    box-shadow: 2px 0 15px rgba(0,0,0,0.2);
    transform: translateX(calc(-1 * var(--nav-width)));
}
.sidenav.open { transform: translateX(0); }
.sidenav h2, .sidenav h3 { padding: 0 25px; }
.sidenav hr { border-color: #4a5a6a; }
.sidenav a.close-btn { position: absolute; top: 0; right: 25px; font-size: 36px; color: #818181; text-decoration: none; }
.nav-link { padding: 12px 25px; text-decoration: none; font-size: 18px; color: #f1f1f1; display: block; transition: background-color 0.3s; border-left: 4px solid transparent; }
.nav-link:hover { background-color: #34495e; }
.nav-link.active {
    background-color: #34495e;
    font-weight: bold;
    border-left-color: var(--primary-color);
}

/* --- Login Form in Sidenav --- */
#auth-container { padding: 15px 25px; }
#loginForm input, #loginForm button, #userInfo button { width: 100%; padding: 10px; margin-bottom: 10px; border-radius: 5px; border: 1px solid #ddd; box-sizing: border-box; }
#loginForm button, #logoutBtn { background-color: var(--primary-color); color: white; cursor: pointer; border: none; }
#authStatus { font-size: 0.9em; text-align: center; word-break: break-all; }

/* --- Main Content Area --- */
.container { max-width: 1200px; margin: 20px auto; background: #ffffff; padding: 25px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); }
h1, h2, h3 { text-align: center; color: var(--dark-blue); }
.hidden { display: none !important; }

/* --- Form Styling --- */
#form-fieldset { border: none; padding: 0; margin: 0; }
#tenantForm { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group, .form-group-full { display: flex; flex-direction: column; }
.form-group-full { grid-column: 1 / -1; }
#tenantForm label { margin-bottom: 5px; font-weight: 600; }
#tenantForm input, #tenantForm textarea, #tenantForm select { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 5px; font-size: 16px; box-sizing: border-box; }
.property-selection { display: flex; gap: 10px; }
.form-buttons { grid-column: 1 / -1; display: flex; gap: 10px; }
.form-buttons button { flex-grow: 1; padding: 12px; border: none; border-radius: 5px; color: #fff; cursor: pointer; font-size: 16px; font-weight: 600; }
#submitBtn { background-color: var(--success-color); }
#clearFormBtn { background-color: var(--medium-grey); }
#cancelBtn { background-color: #ffc107; color: #212529; }

/* --- Search Form --- */
#searchForm { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
#searchForm input { flex-grow: 1; padding: 12px; border: 1px solid #ddd; border-radius: 5px; font-size: 16px; }
#searchForm button { padding: 12px 20px; border: none; border-radius: 5px; color: #fff; cursor: pointer; font-size: 16px; }
#searchForm button[type="submit"] { background-color: var(--primary-color); }
#searchForm button[type="button"] { background-color: #95a5a6; }
.print-btn { background-color: var(--success-color) !important; }

.search-container {
    position: relative;
}
.suggestions-container {
    display: none;
    position: absolute;
    top: 50px;
    left: 0;
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    z-index: 1000;
}
.suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
}
.suggestion-item:hover {
    background-color: #f1f1f1;
}

/* --- Table Styling --- */
.table-container { overflow-x: auto; margin-top: 20px; }
#tenantTable, #searchResultTable {
    width: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
}
#tenantTable thead th, #searchResultTable thead th {
    background-color: #1976D2;
    color: #fff;
    padding: 10px 15px;
    text-align: left;
    font-size: 1.1em;
    border: 1px solid #dee2e6;
}
#tenantTable td, #searchResultTable td {
    padding: 12px 15px;
    border: 1px solid #dee2e6;
    text-align: left;
    font-size: 14px;
    background-color: #ffffff;
}

.actions-col, .actions-cell {
    display: none;
    width: 120px;
    min-width: 120px;
}
.actions-visible .actions-col,
.actions-visible .actions-cell {
    display: table-cell;
}

.action-btn { padding: 6px 10px; margin-right: 5px; border-radius: 4px; border: none; color: white; cursor: pointer; }
.edit-btn { background-color: #ffc107; }
.delete-btn { background-color: #dc3545; }

.property-group-header td {
    background-color: #e9ecef !important;
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
    padding: 12px 15px;
    border: 1px solid #dee2e6;
}
.sub-header th {
    background-color: #495057;
    color: #fff;
    font-weight: 600;
    padding: 10px 15px;
    text-align: left;
    font-size: 14px;
    border: 1px solid #dee2e6;
}

/* MODIFIED: Made toggle button larger */
.toggle-btn {
    cursor: pointer;
    margin-right: 15px;
    font-family: monospace;
    font-weight: bold;
    color: #1976D2;
    display: inline-block;
    width: 25px;
    font-size: 1.5em; /* Increased font size */
    text-align: center;
}

.tenant-row { display: none; }
.tenant-row.visible { display: table-row; }

.total-row td {
    font-weight: bold;
    background-color: #fffacd !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    border-top: 2px solid #dee2e6 !important;
}

/* --- Dashboard Styles --- */
.stat-cards-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 40px; }

.card {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.card-icon { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.card-icon svg { width: 32px; height: 32px; }
.card-icon.properties { background-color: var(--primary-color); }
.card-icon.tenants { background-color: var(--success-color); }
.card-icon.rent { background-color: var(--danger-color); }
.card-info { text-align: left; }
.card-title { font-size: 16px; color: var(--medium-grey); margin: 0; text-align: left; }
.card-value { font-size: 28px; font-weight: 600; color: #343a40; }
.chart-container { background-color: #fff; padding: 25px; border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); position: relative; height: 400px; }

/* --- Print Styles --- */
@media print {
    body * { visibility: hidden; }
    #printArea, #printArea * { visibility: visible; }
    #printArea { position: absolute; left: 0; top: 0; width: 100%; margin: 0; padding: 0; }
    .toggle-btn, .action-btn, header, .form-buttons, .sidenav { display: none !important; }
    .tenant-row { display: table-row !important; }
    .property-group-header td, .sub-header th, .total-row td, #tenantTable td { background-color: #fff !important; color: #000 !important; border: 1px solid #ccc; }
}

/* ==============================================
--- MOBILE & RESPONSIVE STYLES ---
============================================== */
.bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    body {
        padding-bottom: 70px;
    }
    header {
        /* No longer centered */
    }
    .container {
        padding: 15px;
        margin: 10px;
    }
    #tenantForm {
        grid-template-columns: 1fr;
    }
    .logo-shape {
        width: 100px;
        height: 100px;
    }
    .line-1 {
        font-size: 1.8rem;
    }
    .line-2 {
        font-size: 2.5rem;
    }
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background-color: #ffffff;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
        z-index: 1000;
        border-top: 1px solid #eee;
    }
    .bottom-nav-link {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px 0;
        text-decoration: none;
        color: var(--medium-grey);
        transition: color 0.3s;
    }
    .bottom-nav-link .icon {
        font-size: 24px;
        margin-bottom: 2px;
    }
    .bottom-nav-link .label {
        font-size: 12px;
    }
    .bottom-nav-link.active {
        color: var(--primary-color);
        font-weight: bold;
    }
}
