/*
 * Main Stylesheet (style.css)
 *
 * This file contains all the CSS rules for the Safety Hub application.
 * It is organized into logical sections for easier maintenance.
 *
 * @copyright Copyright (c) 2025 macweb.ca. All Rights Reserved.
 * @version   1.5.0
 */

/* ===================================
   1. General & Global Styles
   =================================== */
body {
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
    -webkit-text-size-adjust: 100%; /* Prevents text resizing on iOS */
}

.container {
    max-width: 900px;
    margin: 30px auto;
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h2 {
    color: #D62828; /* Red from the logo */
    font-size: 1.8em;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #D62828;
    padding-bottom: 5px;
}

/* ===================================
   2. Header & Navigation
   =================================== */
.header {
    background-color: #FFFFFF;
    color: white;
    padding: 20px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
}

.header a {
    line-height: 0;
}

.header img {
    height: 60px;
    margin-right: 20px;
}

.header h1 {
    margin: 0;
    font-weight: 700;
    font-size: 2.5em;
    letter-spacing: 1px;
    color: #D62828;
}

.subheader {
    background-color: #D62828;
    color: #FFF;
    padding: 10px 40px;
    font-size: 1.1em;
    font-weight: 600;
}

/* ===================================
   3. Main Content & Forms
   =================================== */
.form-section {
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.form-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group select,
.form-group textarea {
    box-sizing: border-box;
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    font-family: 'Montserrat', sans-serif;
}

.form-group select[disabled] {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
}

.radio-group label {
    display: inline-block;
    margin-right: 20px;
    font-weight: normal;
}

.button-group {
    text-align: right;
    margin-top: 30px;
}

.button-group button {
    background-color: #D62828;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
}

.button-group button:hover {
    background-color: #a72020;
}

.location-input-group {
    display: flex;
    gap: 10px;
}

.location-input-group select {
    flex-grow: 1;
}

.location-input-group button {
    padding: 10px 15px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.location-input-group button:hover {
    background-color: #5a6268;
}

.location-input-group button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.message.success {
    padding: 15px;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    margin-bottom: 20px;
}

.message.error {
    padding: 15px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-bottom: 20px;
}

.button-secondary {
    display: inline-block;
    padding: 12px 25px;
    background-color: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    margin-right: 10px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}
.button-secondary:hover {
    background-color: #5a6268;
}


/* ===================================
   4. 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.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 25px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-button {
    background-color: #D62828;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    float: right;
}

.modal-button:hover {
    background-color: #a72020;
}

/* ===================================
   5. Homepage Specific Styles
   =================================== */
.home-welcome-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.home-welcome-header img {
    max-height: 80px;
    margin-bottom: 15px;
}

.home-welcome-header h2 {
    border-bottom: none;
    color: #555;
    font-size: 1.5em;
    font-weight: 600;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 40px;
}

.grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    color: #333;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 120px;
}

.grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    color: #D62828;
}

.grid-item svg {
    margin-bottom: 10px;
    color: #D62828;
}

.grid-item span {
    font-weight: 600;
    font-size: 0.9em;
}

.grid-item.disabled {
    background-color: #f4f4f4;
    cursor: not-allowed;
    color: #aaa;
}

.grid-item.disabled:hover {
    transform: none;
    box-shadow: none;
}

.grid-item.disabled svg {
    color: #ccc;
}

.grid-item-dropdown {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}
.logout-button {
    position: absolute;
    bottom: -50px;
    left: 0;
    width: 100%;
    padding: 10px 0;
    background-color: rgba(214, 40, 40, 0.9);
    color: white;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    transition: bottom 0.3s ease;
}
.grid-item-dropdown:hover .logout-button {
    bottom: 0;
}


/* ===================================
   6. Footer Styles
   =================================== */
.site-footer {
    background-color: #171717;
    color: #ffffff;
    padding: 50px 20px 0 20px;
    font-size: 0.9em;
}

.footer-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 30px;
}

.footer-column {
    flex: 1;
    min-width: 200px;
}

.footer-column h3 {
    color: #ffffff;
    font-weight: 700;
    margin-bottom: 20px;
    border-bottom: 2px solid #D62828;
    padding-bottom: 10px;
    display: inline-block;
}

.footer-logo {
    max-height: 50px;
    margin-bottom: 15px;
    background-color: white;
    padding: 5px;
    border-radius: 4px;
}

.footer-column p {
    color: #ccc;
    line-height: 1.6;
}

.footer-column.links ul {
    list-style: none;
    padding: 0;
}

.footer-column.links li {
    margin-bottom: 10px;
}

.footer-column.links a,
.footer-column.contact p {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-column.links a:hover {
    color: #D62828;
}

.footer-column .fas {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.footer-bottom {
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid #333;
    font-size: 0.85em;
    color: #888;
}

/* ===================================
   7. Report Viewing Page Styles
   =================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-header h2 {
    border-bottom: none;
    margin-bottom: 0;
}

.sort-options label {
    margin-right: 10px;
    font-weight: 600;
}

.report-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.report-item {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.report-item:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.report-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    background-color: #f9f9f9;
    font-weight: 600;
}

.report-header > span { flex: 1; }
.report-id { flex: 0 0 70px; color: #D62828; }
.report-location { flex: 2; }
.report-toggle { flex: 0 0 30px; text-align: right; transition: transform 0.3s ease; }

.report-details {
    display: none;
    padding: 20px;
    border-top: 1px solid #eee;
}

.report-item.is-open .report-details { display: block; }
.report-item.is-open .report-toggle { transform: rotate(180deg); }

.report-risk { padding: 4px 10px; border-radius: 12px; color: white; font-size: 0.8em; text-align: center; }
.risk-level-1 { background-color: #f0ad4e; } /* Orange */
.risk-level-2 { background-color: #d9534f; } /* Red */
.risk-level-3 { background-color: #5bc0de; } /* Blue */

.message-box {
    text-align: center;
    padding: 40px;
    background-color: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: 8px;
    color: #666;
}

/* ===================================
   8. Admin Panel Styles
   =================================== */
.admin-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.admin-nav {
    flex: 0 0 220px;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #ddd;
    align-self: flex-start;
}

.admin-nav h3 {
    margin-top: 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    color: #333;
}

.admin-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-nav li a {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.admin-nav li a:hover {
    background-color: #e9e9e9;
}

.admin-nav li.active a {
    background-color: #D62828;
    color: white;
    font-weight: 600;
}

.admin-nav .fas {
    margin-right: 10px;
}

.admin-content {
    flex: 1;
    min-width: 300px;
}

.user-manage-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.user-manage-table th, .user-manage-table td {
    padding: 12px 15px;
    border: 1px solid #ddd;
    text-align: left;
}
.user-manage-table thead {
    background-color: #f2f2f2;
}
.user-manage-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}
.button-edit-small {
    background-color: #007bff;
    color: white !important;
    padding: 5px 10px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
}

/* ===================================
   9. User Profile Display Styles
   =================================== */
.profile-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 30px;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.profile-header h2 {
    border-bottom: none;
    margin: 0;
    padding: 0;
}

.button-edit {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}
.button-edit:hover {
    background-color: #0056b3;
}
.button-edit .fas {
    margin-right: 8px;
}

.profile-info .profile-row {
    display: flex;
    justify-content: space-between;
    padding: 15px 10px;
    border-bottom: 1px solid #f5f5f5;
}
.profile-info .profile-row:last-child {
    border-bottom: none;
}
.profile-row span {
    color: #555;
    font-weight: 600;
}
.profile-row strong {
    color: #333;
}

/* ===================================
   10. Responsive Media Queries
   =================================== */
@media (max-width: 768px) {
    .header { flex-direction: column; text-align: center; padding: 20px; }
    .header h1 { margin-top: 15px; font-size: 2em; }
    .subheader { text-align: center; }
    .container { margin: 15px; padding: 20px; }
    .grid-container { grid-template-columns: repeat(2, 1fr); }
    .admin-nav { flex: 1 1 100%; }
}

@media (max-width: 480px) {
    .grid-container { grid-template-columns: 1fr; }
    .header { padding: 15px; }
    .header h1 { font-size: 1.8em; }
}