/* --- Base Styles --- */
* { box-sizing: border-box; }
body { font-family: sans-serif; margin: 0; }
.container { max-width: 800px; margin: auto; }
.container-top {
    max-height: 25vh;
}
.container-bottom {
    max-height: 75vh;
    overflow-y: scroll;
}

/* --- Dashboard Header --- */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
}

/* --- Table Responsiveness --- */
/* Ensure the container allows scrolling but contains the sticky header */
.table-container {
    overflow-y: auto;
    position: relative;
}


/* Modal Overlay keeps its high z-index to stay on top */
.modal-overlay {
    z-index: 1000;
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 0.9em; 
}
th, td { padding: 10px; border-bottom: 1px solid #ddd; text-align: left; white-space: nowrap; }

/* Make the header stick to the top of the container */
thead th {
    position: sticky;
    top: -20px;
    background-color: #f8f9fa; /* Important: must have a background color to hide rows scrolling underneath */
    z-index: 10;               /* Lower than modal (which is 1000) */
    border-bottom: 2px solid #ddd;
}

/* --- Modal & Form --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); display: flex;
    justify-content: center; align-items: center;
    z-index: 1000;
}
.modal-content {
    background: white; padding: 25px; border-radius: 10px;
    width: 95%; max-width: 400px;
}
input { width: 100%; padding: 12px; margin: 8px 0; border: 1px solid #ccc; border-radius: 4px; }
button { width: 100%; padding: 12px; background: #007bff; color: white; border: none; cursor: pointer; border-radius: 4px; margin-top: 10px; }

/* Ensure inputs and buttons are large enough to tap */
input, button {
    font-size: 16px; /* Prevents iPhone from auto-zooming when tapping inputs */
    padding: 15px !important;
    width: 100%;
}

/* Ensure the login container doesn't get squeezed */
.login-container {
    padding: 20px;
    margin: 0 auto;
    max-width: 400px;
}

/* --- Logout Button --- */

.stat-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 5px;
    text-align: center;
    width: 30%;
}
.stat-card h3 {
    margin-bottom: 2px;
    color: #343a40;
}
.stat-card p {
    font-size: 1em;
    color: #007bff;
}
.btn-logout, .btn-edit {
    height: 46px;
    background: #007bff;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    text-decoration: none;
}
.btn-logout {
    background: #dc3545;
}
.btn-logout:hover { background-color: #c82333; }
.btn-edit:hover { background-color: #0056b3; }
/* --- Utility --- */
[x-cloak] { display: none !important; }

/* --- Media Queries --- */
@media (max-width: 600px) {
    .dashboard-header { flex-direction: row; text-align: center; gap: 10px; }
    h1 { font-size: 1.5rem; margin: 0; }
    .login-container { padding: 15px; max-width: 100%; }
    .login-container h2 { font-size: 4rem; }
    .login-container input { font-size: 3em; padding: 20px; }
    .login-container button { font-size: 2em; padding: 20px; }
}

@media (min-width: 600px) {
    table { font-size: 1em; }
    .login-container { padding: 15px; max-width: 400px; }
    .login-container h2 { font-size: 2rem; justify-self: center}
    .login-container input { font-size: 1em; padding: 20px; }
    .login-container button { font-size: 2em; padding: 20px; }
}