/* General styles */
body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

body.dashboard {
    display: block;
    height: auto;
    justify-content: flex-start;
    align-items: flex-start;
}

/* Login page styles */
.login-container {
    width: 30%;
    height: 35%;
    max-width: 100%;
    max-height: 100%;
    margin: auto;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    box-sizing: border-box;
    min-height: 0; /* Allow flex children to control height */
}

.login-container .login-logo {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px; /* Center logo with auto margins */
    display: block;
}

.login-container h1 {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.2em;
}

.form-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    width: 100%;
    padding: 0 20px; /* Add padding on sides */
    box-sizing: border-box;
}

.form-group {
    margin-bottom: 15px;
    width: 100%;
}

label {
    display: block;
    margin-bottom: 5px;
}

input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 12px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}

button {
    width: 50%;
    padding: 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 20px auto 0; /* Center the button at bottom */
    display: block;
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #f44336;
    color: white;
    padding: 16px;
    border-radius: 5px;
    z-index: 1;
}
/* Dashboard styles */
.dashboard-container {
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar main";
    grid-template-columns: 20% 80%;
    grid-template-rows: 60px 1fr;
    height: 100vh;
    width: 100%;
    margin: 0;
}

.header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-left {
    flex: 1;
}

.header-title {
    flex: 2;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo {
    height: 40px;
    margin-right: 15px;
}

.header-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    position: relative;
}

.account-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.account-button img {
    height: 40px;
    border-radius: 50%;
}

.logout-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 50px;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
    z-index: 100;
}

.logout-dropdown a {
    text-decoration: none;
    color: #333;
}

.account-menu:hover .logout-dropdown {
    display: block;
}

.sidebar {
    grid-area: sidebar;
    background-color: #343a40;
    color: white;
    padding: 20px;
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar nav ul li a {
    color: white;
    text-decoration: none;
    display: block;
    padding: 10px;
    border-radius: 5px;
}

.sidebar nav ul li a.active {
    background-color: #495057;
}

.sidebar nav ul li a.disabled {
    color: #6c757d;
    pointer-events: none;
    cursor: default;
}

.main-content {
    grid-area: main;
    padding: 10px; /* Reduced padding */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px; /* Reduced gap */
    min-height: calc(100vh - 80px); /* Ensure enough height for 10 rows */
}

.panel {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 20px;
}

.train-details {
    flex-basis: 10%;
    display: flex;
    flex-direction: column;
    font-size: 100%;
}

.train-details h2 {
    padding: px 0 0 0px;
    margin: 0;
}

.train-details-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-grow: 1;
}

.train-detail-item {
    display: flex;
    flex-direction: column;
    align-items: left;
}

.train-detail-item strong {
    color: #6c757d; /* dark grey */
}

.train-detail-item span {
    color: black;
    font-size: 1.2em; /* larger than heading */
    font-weight: bold;
}
.coach-details {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.alert-details {
    flex: 1;
    overflow-y: auto;
}

/* Table styles */
#coach-details-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#coach-details-table th {
    text-align: center;
    background-color: #f2f2f2;
    padding: 10px 8px; /* Increased padding for heading */
    font-size: 1em; /* Standard font size */
    font-weight: bold;
    color: #333; /* Dark grey for headings */
}

#coach-details-table td {
    padding: 4px 8px; /* Reduced padding for data rows */
    text-align: center;
    font-size: 1em; /* Same size as headings */
    color: #6c757d; /* Dark grey for data */
    vertical-align: middle; /* Center vertically */
    height: 100%; /* Ensure full cell height */
}

#coach-details-table td:last-child,
#coach-details-table td.status-indicator {
    text-align: center;
    vertical-align: middle; /* Double ensure vertical centering */
}

#coach-details-table .view-details-btn {
    padding: 3px 6px; /* Reduced button padding */
    font-size: 0.75em; /* Smaller button text */
}

/* Alternating row colors */
#coach-details-table tbody tr:nth-child(odd) {
    background-color: #f9f9f9;
}

#coach-details-table tbody tr:nth-child(even) {
    background-color: #ffffff;
}

.view-details-btn {
    padding: 5px 10px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.status-optimal {
    background-color: transparent;
}

.status-low {
    background-color: transparent;
}

.status-empty {
    background-color: transparent;
}

.status-offline {
    background-color: transparent;
}

/* Alert Details styles */
.alert-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
}

.alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-radius: 5px;
    color: white;
}

.alert-item.low {
    background-color: orange;
}

.alert-item.empty {
    background-color: orangered;
}

.alert-status {
    font-weight: bold;
}

.alert-info {
    text-align: right;
}

.alert-train-coach {
    font-size: 0.9em;
}

.alert-timestamp {
    font-size: 0.9em;
    margin-top: 5px;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    height: 90%;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.modal-section {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.close-button {
    color: #aaa;
    align-self: flex-end;
    font-size: 28px;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#modal-history-table {
    width: 100%;
    border-collapse: collapse;
}

#modal-history-table th {
    text-align: center;
    background-color: #f2f2f2;
    padding: 8px;
}

#modal-history-table td {
    padding: 8px;
    text-align: center;
}

/* Alternating row colors for modal table */
#modal-history-table tbody tr:nth-child(odd) {
    background-color: #f9f9f9;
}

#modal-history-table tbody tr:nth-child(even) {
    background-color: #ffffff;
}

#modal-current-details .status-indicator {
    text-align: center !important;
}