/* style.css */

/* --- Global Styles --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    padding: 20px;
    background-color: #f8f9fa;
    color: #333;
    margin: 0;
}

.container {
    max-width: 1400px;
    margin: 20px auto;
    background: #fff;
    padding: 30px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

a {
    color: #007bff;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

h1, h2 {
    color: #0056b3;
}

h1 { text-align: center; margin-bottom: 25px; }
h2 { margin-top: 30px; border-bottom: 2px solid #dee2e6; padding-bottom: 5px; }

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #495057;
}

input[type=text], input[type=password], input[type=date], input[type=number], input[type=email], select, textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
}

input:focus, select:focus, textarea:focus {
    border-color: #80bdff;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

input[readonly] {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.action-button, button, input[type=submit] {
    background-color: #28a745;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
    font-size: 1em;
    transition: background-color 0.3s ease;
}
.action-button:hover, button:hover, input[type=submit]:hover {
    opacity: 0.9;
}

.message, .error {
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
}
.message { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

.back-link {
    display: inline-block;
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

/* --- Table Styles --- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.detail-table, .user-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.detail-table th, .detail-table td, .user-table th, .user-table td {
    border: 1px solid #dee2e6;
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}
.detail-table th, .user-table th {
    background-color: #e9ecef;
    font-weight: bold;
}
.detail-table input, .detail-table textarea, .detail-table select {
    width: 100%;
    padding: 6px;
    margin: 0;
    box-sizing: border-box;
    font-size: 0.95em;
}
.detail-time-input {
    display: flex;
    align-items: center;
    gap: 5px;
}
.detail-time-input input { flex-grow: 1; }
.detail-time-input select { width: auto; }

/* --- Component-specific Styles --- */
/* Login Page */
.login-wrapper { max-width: 400px; padding: 30px; background: #fff; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); margin: 50px auto; }

/* Index Page */
.index-container .options { text-align: center; margin-top: 30px; }
.index-container .options a, .index-container .options .logout-button { display: block; margin: 15px auto; padding: 15px 25px; background-color: #007bff; color: #ffffff; text-decoration: none; border-radius: 5px; max-width: 400px; font-size: 1.1em; border: none; cursor: pointer; width: 100%; box-sizing: border-box; }
.index-container .options a:hover, .index-container .options .logout-button:hover { background-color: #0056b3; }
.index-container .options .admin-link, .index-container .options .view-link { background-color: #6c757d; }
.index-container .options .admin-link:hover, .index-container .options .view-link:hover { background-color: #5a6268; }
.index-container .options .logout-button { background-color: #dc3545; }
.index-container .options .logout-button:hover { background-color: #c82333; }
.welcome-message { text-align: center; margin-bottom: 20px; font-size: 1.1em; color: #495057; }

/* Admin Page */
.admin-section { background: #fff; border: 1px solid #dee2e6; padding: 25px; border-radius: 8px; margin-bottom: 30px; }
.admin-section form { display: flex; flex-wrap: wrap; gap: 15px; align-items: flex-end; }
.top-links { text-align: right; margin-bottom: 20px; }
.top-links a { margin: 0 5px; text-decoration: none; color: white; padding: 8px 15px; border-radius: 4px; }
.home-link { background: #6c757d; }
.view-link { background: #28a745; }
.export-link { background: #17a2b8; }
.logout-link { background: #dc3545; }
.delete-button { background-color: #dc3545; color: white; }
.update-button { background-color: #ffc107; color: #212529; }
.add-row-btn { background-color: #007bff; }


/* View Timesheets Page */
h2.yellow-header { color: #b98900; border-color: #ffc107; }
h2.pink-header { color: #e83e8c; border-color: #e83e8c; }
.timesheet-container { position: relative; margin-bottom: 25px; border: 1px solid #dee2e6; border-radius: 8px; background-color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.07); overflow: hidden; }
.timesheet-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; padding: 15px 20px; background: #f8f9fa; border-bottom: 1px solid #dee2e6; gap: 15px; }
.header-info { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.header-info div span { font-weight: bold; }
.timesheet-actions { display: flex; gap: 8px; }
.edit-link { padding: 5px 12px; text-decoration: none; border-radius: 4px; font-size: 0.9em; background-color: #ffc107; color: #212529; }
.filter-form { background-color: #e9ecef; padding: 20px; border-radius: 8px; margin-bottom: 30px; }
.filter-form form { display: flex; flex-wrap: wrap; gap: 15px; align-items: center; }

.pink .timesheet-header, .pink .detail-table th { background-color: #fceef2; border-color: #f1d4dc; }
.yellow .timesheet-header, .yellow .detail-table th { background-color: #fff9e6; border-color: #ffeeba; }

/* --- Responsive Table / Card View --- */
@media (max-width: 992px) {
    .detail-table thead {
        display: none; /* Hide table headers on mobile */
    }
    .detail-table tr {
        display: block;
        border: 1px solid #dee2e6;
        margin-bottom: 15px;
        border-radius: 5px;
        padding: 10px;
    }
    .detail-table td {
        display: block;
        text-align: right; /* Align content to the right */
        padding: 8px;
        border: none;
        border-bottom: 1px dotted #ccc;
        position: relative;
    }
    .detail-table td:before {
        content: attr(data-label); /* Use data-label for the header text */
        position: absolute;
        left: 10px;
        font-weight: bold;
        text-align: left;
        white-space: nowrap;
    }
}
