/* =========================================
   Drishti - CR Rush Monitor CSS (v2)
   ========================================= */

/* --- Basic Reset & Body --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6; /* Slightly muted background */
    color: #333;
    line-height: 1.6;
    font-size: 16px;
}

/* --- Layout Elements --- */
.container {
    max-width: 1200px;
    margin: 25px auto;
    padding: 20px 25px 30px 25px; /* Added more padding */
    background-color: #ffffff;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08); /* Softer shadow */
    border-radius: 8px; /* Slightly more rounded */
}

header {
    background-color: #003366; /* Dark Blue */
    color: #fff;
    padding: 18px 0;
    text-align: center;
    border-bottom: 5px solid #FF9933; /* Saffron */
}

header h1 {
    margin: 0;
    font-size: 2.2em;
    font-weight: 600;
}

header nav {
    margin-top: 10px;
}

header nav a {
    color: #fff;
    text-decoration: none;
    margin: 0 15px;
    font-size: 1.1em;
    padding-bottom: 3px;
    border-bottom: 2px solid transparent;
    transition: border-bottom-color 0.2s ease;
}
header nav a:hover {
    border-bottom-color: #FF9933; /* Saffron underline on hover */
    text-decoration: none;
}
header nav span { /* For logged-in user display */
    font-weight: bold;
    margin: 0 10px;
    color: #f0f0f0; /* Slightly off-white */
}


footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    background-color: #e9ecef; /* Light grey */
    color: #555;
    font-size: 0.9em;
    border-top: 1px solid #ddd;
}

main h2 {
    color: #003366;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-top: 30px;
    margin-bottom: 25px; /* Added space below h2 */
    font-weight: 600;
}

main hr {
    border: 0;
    height: 1px;
    background-color: #ccc;
    margin: 25px 0;
}

/* --- General Form Styling --- */
fieldset {
    border: 1px solid #ccc;
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 5px;
    background-color: #fdfdfd; /* Slight background for fieldsets */
}
legend {
    font-weight: 600; /* Bolder */
    font-size: 1.25em;
    color: #003366;
    padding: 0 10px;
    margin-left: -10px; /* Align with padding */
}
.instruction {
    font-size: 0.9em;
    color: #4a5568; /* Darker grey */
    margin-bottom: 15px;
    background-color: #e8f0fe; /* Light blue background */
    padding: 10px 15px;
    border-left: 4px solid #4299e1; /* Blue left border */
    border-radius: 4px;
}
.form-group {
    margin-bottom: 18px; /* Consistent spacing */
}
.form-group label {
    display: block;
    margin-bottom: 6px; /* Space between label and input */
    font-weight: 600; /* Bolder labels */
    font-size: 0.95em;
}
.form-group small {
    font-size: 0.85em;
    color: #666;
    display: block;
    margin-top: 5px;
}

/* General styling for form input elements */
.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="time"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    display: block;
    width: 100%;
    padding: 10px 12px; /* Standard padding */
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
    margin-top: 3px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-group input[type="file"] {
    padding: 8px; /* Adjust file input padding */
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 3px;
}

/* Focus styles for better accessibility */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #4299e1; /* Blue border on focus */
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.3); /* Subtle glow */
    outline: none;
}

/* Error state styling */
.form-group input:invalid, /* HTML5 pseudo class */
.form-group input[aria-invalid="true"],
.form-group select[aria-invalid="true"],
.form-group textarea[aria-invalid="true"] {
    border-color: #dc3545; /* Red border for errors */
}
.error-text {
    color: #dc3545; /* Red text */
    font-size: 0.88em;
    display: block;
    margin-top: 4px;
}

/* Submit Button Styling */
.button-submit {
    background-color: #28a745; /* Green */
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.1s ease;
}
.button-submit:hover {
    background-color: #218838; /* Darker Green */
    transform: translateY(-1px); /* Slight lift */
}
.button-submit:active {
     transform: translateY(0px); /* Click effect */
}


/* --- Login Page Specific --- */
.login-container {
    max-width: 450px;
    margin-top: 50px;
    padding: 35px; /* More padding */
}
.login-form .form-group {
    margin-bottom: 20px;
}
.login-form button {
    width: 100%;
    margin-top: 10px; /* Space above button */
}


/* --- Dashboard Specific --- */
.division-block {
    margin-bottom: 35px;
    padding: 20px;
    border: 1px solid #d6dee5; /* Softer border */
    border-radius: 6px;
    background-color: #fff;
}
.division-block h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #003366;
    border-bottom: 2px solid #FF9933; /* Saffron */
    padding-bottom: 8px;
    font-weight: 600;
}
.station-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); /* Slightly wider min */
    gap: 25px;
    margin-top: 15px;
}
.station-box {
    border: 1px solid #ccc;
    padding: 18px;
    border-radius: 5px;
    background-color: #e9ecef;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-left-width: 5px; /* Prepare for color border */
}
.station-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.station-box h4 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.25em;
}
.station-box h4 a {
    text-decoration: none;
    color: #0056b3;
}
.station-box h4 a:hover {
    text-decoration: underline;
    color: #003366;
}
.station-box p {
    margin: 8px 0; /* Consistent spacing */
    font-size: 0.95em;
    line-height: 1.5;
}
.station-box .update-time {
    font-size: 0.8em;
    color: #555;
    margin-top: 12px;
    text-align: right;
}
.train-counts-inline { /* For single-line train counts */
    font-size: 0.9em;
    line-height: 1.4;
    margin: 8px 0;
    color: #333;
}
.train-counts-inline strong {
    margin-right: 5px;
    color: #111;
}

/* --- Station Details Page --- */
.station-details {
    margin-top: 20px;
}
.detail-item {
    margin-bottom: 18px;
    padding-bottom: 18px; /* Space below item */
    border-bottom: 1px solid #eee;
}
.detail-item:last-child {
    border-bottom: none; /* Remove border from last item */
    padding-bottom: 0;
}
.detail-item strong {
    display: block;
    margin-bottom: 6px;
    color: #4a5568; /* Slightly darker grey */
    font-weight: 600;
    font-size: 0.95em;
}
.detail-item span, .detail-item a {
    font-size: 1.05em; /* Slightly larger text */
}
.detail-item a {
     color: #0056b3;
     text-decoration: none;
}
.detail-item a:hover {
    text-decoration: underline;
}
.detail-item small {
    font-size: 0.85em;
    color: #666;
    display: block; /* Ensure it takes its own line */
    margin-top: 3px;
}
.rush-indicator span { /* The colored passenger count number */
    font-weight: bold;
    font-size: 1.2em;
    padding: 5px 10px;
    border-radius: 4px;
    color: #fff;
    display: inline-block; /* Allow padding */
}
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); /* Larger thumbnails */
    gap: 15px;
    margin-top: 10px;
}
.photo-gallery img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ccc;
    border-radius: 4px;
    display: block;
    transition: transform 0.2s ease;
}
.photo-gallery a:hover img {
    transform: scale(1.03); /* Slight zoom on hover */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}


/* --- Reports Page --- */
.filter-form {
    background-color: #f8f9fa; /* Lighter background */
    padding: 20px 25px;
    border: 1px solid #dee2e6; /* Softer border */
    border-radius: 6px;
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 18px; /* Spacing */
    align-items: flex-end; /* Align form items nicely */
}
.filter-form .form-group {
    margin-bottom: 0;
    flex: 1 1 auto;
    min-width: 200px; /* Adjust min width as needed */
}
.filter-form label {
    font-size: 0.9em;
    margin-bottom: 4px;
}
.filter-form input[type="date"],
.filter-form select {
    padding: 9px 10px; /* Consistent padding */
    width: 100%; /* Full width within flex item */
    box-sizing: border-box;
    font-size: 0.95em;
}
.filter-form button {
    padding: 10px 22px; /* Adjust padding */
    height: 41px; /* Match input height approx */
    flex-shrink: 0;
    font-size: 1em; /* Slightly smaller button */
    margin-bottom: 1px; /* Align with bottom border of inputs */
}
.table-responsive {
    overflow-x: auto; /* Horizontal scroll on small screens */
    margin-top: 25px;
    border: 1px solid #dee2e6; /* Border around table container */
    border-radius: 5px;
}
.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0; /* Remove bottom margin as container has border */
}
.report-table th,
.report-table td {
    border: 1px solid #dee2e6; /* Match container border */
    padding: 12px 15px; /* More padding */
    text-align: left;
    font-size: 0.95em;
    white-space: nowrap;
    vertical-align: middle; /* Center vertically */
}
.report-table thead th {
    background-color: #e9ecef;
    font-weight: 600; /* Bold header */
    position: sticky; /* Sticky header */
    top: 0;
    z-index: 1;
    border-bottom-width: 2px; /* Stronger bottom border */
}
.report-table tbody tr:nth-child(even) {
    background-color: #f8f9fa; /* Zebra striping */
}
.report-table tbody tr:hover {
    background-color: #eef2f7; /* Subtle blue hover */
}

/* --- Color Coding & Indicators --- */
/* Used on Dashboard boxes & Station Details passenger counts */
.rush-color-green { background-color: #d4edda; border-left-color: #28a745; }
.rush-color-orange { background-color: #fff3cd; border-left-color: #ffc107; }
.rush-color-red { background-color: #f8d7da; border-left-color: #dc3545; }
.rush-color-normal { background-color: #e9ecef; border-left-color: #6c757d; }

/* Colored span for passenger counts on details page */
.rush-indicator.rush-color-green span { background-color: #28a745; }
.rush-indicator.rush-color-orange span { background-color: #ffc107; color: #333; }
.rush-indicator.rush-color-red span { background-color: #dc3545; }
.rush-indicator.rush-color-normal span { background-color: #6c757d; }

/* --- Flash Messages --- */
.flash-message {
    padding: 15px 20px;
    margin-bottom: 25px;
    border: 1px solid transparent;
    border-radius: 5px;
    font-weight: 600; /* Bolder */
    font-size: 1.05em;
    position: relative;
    opacity: 0.95; /* Slight transparency */
}
.flash-success { color: #0f5132; background-color: #d1e7dd; border-color: #badbcc; }
.flash-error   { color: #842029; background-color: #f8d7da; border-color: #f5c2c7; }
.flash-info    { color: #055160; background-color: #cff4fc; border-color: #b6effb; }
.flash-warning { color: #664d03; background-color: #fff3cd; border-color: #ffecb5; }


/* --- Responsive Design --- */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }
    header nav a {
        margin: 0 8px;
        font-size: 1em;
    }
    header nav span {
         margin: 0 8px;
    }

    .container {
        margin: 15px;
        padding: 15px 15px 20px 15px;
    }

    .station-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); /* Adjust for smaller screens */
        gap: 15px;
    }

    .filter-form {
        flex-direction: column;
        align-items: stretch;
        gap: 12px; /* Reduce gap */
    }
    .filter-form .form-group {
        min-width: 100%;
        margin-bottom: 10px;
    }
    .filter-form button {
         width: 100%;
         margin-top: 10px;
         padding: 12px; /* Adjust padding */
    }

    .report-table th,
    .report-table td {
        font-size: 0.9em;
        padding: 8px 10px; /* Smaller padding */
    }

    /* Make sure forms stack nicely */
    .update-form fieldset, .login-form {
         padding: 15px;
    }
}

@media (max-width: 480px) {
     header h1 { font-size: 1.5em; }
     .station-grid { grid-template-columns: 1fr; /* Single column */ }
     .photo-gallery { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}