/*
 * This stylesheet provides a clean and responsive design for the Boarding House Access Control page.
 *
 * Theme Colors:
 * - Primary: #330d73 (a deep purple)
 * - Accent: darkgreen
 * - Text: white
 */

/* --- General Body and Layout --- */
body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

.container1 {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.learners-signout-container,
.container2, .container3 {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.container2 {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    padding: 2rem;
    gap: 1.5rem;
}

/* --- Header and Menu Section --- */
.header {
    background-color: #330d73;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header .logo img {
    height: 50px;
    border-radius: 8px;
}

.header .title h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

/* --- Base Button Style --- */
.btn,
button {
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-align: center;
    white-space: nowrap;
    text-decoration: none;
    color: white;
}

.btn:hover,
button:hover {
    transform: translateY(-2px);
}

.btnLogout,
.createNewUser {
    background-color: darkgreen;
}

.btnLogout:hover,
.createNewUser:hover {
    background-color: #2e8b57;
}

.menu {
    padding: 1rem 2rem;
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; 
    gap: 3rem;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* --- Learner Portal Cards --- */
.learner-card {
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.learner-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.learner-card .learner-id {
    font-size: 0.8rem;
    color: #999;
    font-weight: 500;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.learner-card .learner-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.learner-card .learner-info div {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.learner-card .label {
    font-weight: bold;
    color: #330d73;
}

.learner-card .value {
    color: #555;
    font-weight: 500;
}

/* --- Learner Signout Container --- */
.learners-signout-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
}

/* Limit to 3 columns on larger screens */
@media (min-width: 992px) {
    .learners-signout-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

.learner-card-signout {
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.learner-card-signout:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.learner-card-signout img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #330d73;
}

.learner-card-signout .learner-id {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    margin: 0;
}

.learner-card-signout .learner-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-grow: 1;
    width: 100%;
    text-align: left;
}

.learner-card-signout .learner-info div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.learner-card-signout .label {
    font-weight: bold;
    color: #330d73;
}

.learner-card-signout .value {
    color: #555;
    font-weight: 500;
}

/* Style for the reason field specifically within a card */
.learner-card .reason-field .label {
    font-weight: normal;
}

/* New, more specific rule to ensure the reason label and value are styled differently */
.learner-card-signout .learner-info div:last-child .label {
    font-weight: normal;
    font-style: italic;
    color: #666;
}

.learner-card-signout .learner-info div:last-child .value {
    font-style: italic;
    font-weight: 400; /* Regular font weight */
    color: #666;
}

/* --- User Edit and Sign Out Form --- */
.profile-edit-container, .sign-out-container, .form-container {
    width: 90%;
    max-width: 700px;
    margin: 0 auto;
    background-color: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.profile-header {
    text-align: center;
    margin-bottom: 2rem;
}

.profile-picture {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #330d73;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.profile-picture-container {
    text-align: center;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.update-pic-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.form-fields {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.form-field label, .form-label {
    display: block;
    color: #333;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-field input, .form-label input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-field input:focus, .form-label input:focus {
    outline: none;
    border-color: #330d73;
}

.form-field input[readonly] {
    background-color: #f0f2f5;
    cursor: not-allowed;
}

.form-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-update {
    background-color: #330d73;
}

.btn-update:hover {
    background-color: #4b1a8d;
}

.btn-SignOut-View {
    background-color: #330d73;
}

.btn-SignOut-View:hover {
    background-color: #4b1a8d;
}

.btn-signout {
    background-color: #330d73;
}

.btn-signout:hover {
    background-color: #4b1a8d;
}

.btn-learners-view{
    background-color: #330d73;
}

.btn-learners-view:hover{
    background-color: #4b1a8d;
}

.btn-Staff-View{
    background-color: #330d73;
}

.btn-Staff-View:hover{
    background-color: #4b1a8d;
}


.btn-cancel {
    background-color: #f44336;
}

.btn-cancel:hover {
    background-color: #d32f2f;
}

.btn-delete {
    background-color: #f44336;
}

.btn-delete:hover {
    background-color: #d32f2f;
}

.btn-show-logs {
    background-color: darkgreen;
}

.btn-show-logs:hover {
    background-color: #2e8b57;
}

.profile-view-container {
    background-color: #f8f8f8;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.profile-view-container > div {
    font-size: 1.1rem;
    font-weight: 500;
    color: #555;
    word-wrap: break-word;
}

.profile-view-container > div::before {
    content: attr(data-label);
    display: block;
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.form-container {
    background-color: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.form-container .form-label {
    margin-bottom: 1.5rem;
}

.form-container .form-label:last-child {
    margin-bottom: 0;
}

/* New styling for the sign-out details container */
.sign-out-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sign-out-details {
    background-color: #f8f8f8;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.sign-out-details div {
    font-size: 1.1rem;
    font-weight: 500;
    color: #555;
    word-wrap: break-word;
}

.sign-out-details div:first-child {
    grid-column: 1 / -1;
}

.sign-out-details div:not(:first-child) {
    font-weight: 600;
}

.sign-out-container .btn {
    align-self: flex-end;
    background-color: #330d73;
}

.sign-out-container .btn:hover {
    background-color: #4b1a8d;
}

.hide {
    display: none;
}

/* --- Modal Styles (for custom alerts and confirmations) --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background-color: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 450px;
    text-align: center;
}

#modalMessage {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: #333;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn-confirm {
    background-color: #330d73;
}

.btn-confirm:hover {
    background-color: #4b1a8d;
}

/* --- Log and Data Display Styles --- */
.logs-container {
    width: 90%;
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.log-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e0e0e0;
}

.log-card div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.log-card .label {
    font-weight: bold;
    color: #330d73;
}

.log-card .value {
    color: #555;
    font-weight: 500;
}

/* --- Media Queries for Responsiveness --- */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
    }
    .header .btnLogout {
        margin-top: 1rem;
    }
    .menu {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    .search-container {
        width: 100%; /* Make search container full width */
        gap: 0.5rem;
        display: flex;
        flex-direction: column;
    }
    .search-container input {
        width: 100%;
        min-width: 0;
    }
    .btn-search {
        width: 100%;
        margin-top: 0.5rem;
    }
    .control-container {
        width: 100%;
        display: flex; /* Ensure the buttons inside are flex items */
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: space-between;
    }
    .btn {
        flex: 1; /* Allow buttons to grow and take equal space */
        min-width: 0;
    }
}

/* --- Login Page Styles --- */
.login-page-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-container {
    background-color: #fff;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 400px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.login-header {
    margin-bottom: 2rem;
}

.login-header img {
    height: 80px;
    margin-bottom: 1rem;
    border-radius: 8px;
}

.login-header h1 {
    font-size: 2rem;
    color: #330d73;
    margin: 0;
    font-weight: 700;
}

.login-header h2 {
    font-size: 1.2rem;
    color: #555;
    font-weight: 400;
    margin: 0;
}

.login-form > div {
    margin-bottom: 1.5rem;
    text-align: left;
}

.login-form span {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.login-form input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.login-form input:focus {
    outline: none;
    border-color: #330d73;
    box-shadow: 0 0 0 3px rgba(51, 13, 115, 0.1);
}

.login-form button {
    width: 100%;
    padding: 1rem;
    background-color: #330d73;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.login-form button:hover {
    background-color: #4b1a8d;
    transform: translateY(-2px);
}

/* --- New Styles for the Portal Menu --- */
.search-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-grow: 1; /* Allows the search bar to take available space */
    max-width: 300px;
}

.search-container input {
    flex-grow: 1;
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-container input:focus {
    outline: none;
    border-color: #330d73;
    box-shadow: 0 0 0 3px rgba(51, 13, 115, 0.1);
}

/* New style for the search button */
.btn-search {
    background-color: darkgreen;
}

.btn-search:hover {
    background-color: #2e8b57;
}
