* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    margin: 0;
    padding: 0;
    /* Use theme variables for background and text to maintain a cohesive look across pages */
    background: var(--bg-light);
    color: var(--text);
}

/* Login Page */
/* Theme Variables */
:root {
    /* Define a cohesive colour palette for the app.  
       These variables power all of the main components on the site and make it easy to adjust the look and feel
       from a single location.  
       Primary and secondary colours are used for gradients, buttons and highlights.  
       The dark variant provides a hover state. */
    --primary: #009B4D;
    --primary-dark: #007a3d;
    --secondary: #F58220;
    /* Base background and text colours */
    --bg-light: #f7f9fc;
    --text: #333333;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
    background: #f8fafc;
    font-family: 'Inter', sans-serif;
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: white;
    border-radius: 24px;
    padding: 48px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.logo-icon {
    width: 64px;
    height: 64px;
    background: rgba(0, 155, 77, 0.1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.login-card h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    background: none;
    -webkit-text-fill-color: initial;
}

.subtitle {
    color: #718096;
    font-size: 15px;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 24px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.form-group label {
    display: block;
    font-weight: 500;
    font-size: 14px;
    color: #4a5568;
    margin-bottom: 8px;
}

.label-row label {
    margin-bottom: 0;
}

.forgot-link {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.forgot-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    pointer-events: none;
}

.form-group input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.2s;
    background: #f8fafc;
    color: #2d3748;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    /* Use theme colours for the focus glow */
    box-shadow: 0 0 0 4px rgba(0, 155, 77, 0.1);
}

.form-group input::placeholder {
    color: #a0aec0;
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 155, 77, 0.3);
}

.btn-block {
    width: 100%;
}

.alert {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-error {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #fed7d7;
}

.alert-success {
    background: #f0fff4;
    color: #2f855a;
    border: 1px solid #c6f6d5;
}

.login-footer {
    margin-top: 32px;
    text-align: center;
    border-top: 1px solid #edf2f7;
    padding-top: 24px;
}

.login-footer p {
    color: #718096;
    font-size: 14px;
}

.auth-links {
    margin-top: 24px;
    text-align: center;
}

.auth-links a {
    /* Use primary colour for authentication links */
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Dashboard */
.navbar {
    background: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-brand {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    text-decoration: none;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-header h1 {
    color: white;
    font-size: 32px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
    padding: 32px 48px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    /* Default colour replaced by CSS override; keep here as fallback */
    color: var(--primary);
}

.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card h2 {
    margin-bottom: 20px;
    font-size: 20px;
}

.shifts-container {
    padding: 32px 48px;
}

.shifts-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 20px 24px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #4a5568;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e2e8f0;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.table td {
    color: #2d3748;
    font-size: 14px;
}

.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-draft {
    background: #e0e0e0;
    color: #666;
}

.badge-published {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-assigned {
    background: #fff3e0;
    color: #f57c00;
}

.badge-accepted {
    background: #e8f5e9;
    color: #388e3c;
}

.badge-active {
    background: #c8e6c9;
    color: #2e7d32;
}

.badge-completed {
    background: #f3e5f5;
    color: #7b1fa2;
}

.badge-cancelled {
    background: #ffebee;
    color: #c62828;
}

/* Form Styles */
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    background: white;
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 119, 204, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.btn {
    background: #f5f5f5;
    color: #333;
}

.btn:hover {
    background: #e0e0e0;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s;
}

.modal-header {
    background: white;
    color: #333;
    padding: 24px 32px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
}

.modal-close {
    background: #f0f0f0;
    border: none;
    color: #666;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: #e0e0e0;
    color: #333;
    transform: rotate(90deg);
}

.modal-body {
    padding: 32px;
}

.modal-section {
    margin-bottom: 24px;
}

/*
 * Modal section headings should use the primary theme colour instead of a hard coded purple.
 * This ensures that headings inside modals remain consistent with the rest of the app’s palette.
 */
.modal-section h3 {
    font-size: 16px;
    /* Use our primary variable for colour */
    color: var(--primary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}

.detail-grid-modal {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.detail-item-modal {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
}

.detail-label-modal {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.detail-value-modal {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.status-badge-modal {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-assigned {
    background: #e3f2fd;
    color: #1976d2;
}

.status-accepted {
    background: #e8f5e9;
    color: #388e3c;
}

.status-active {
    background: #fff3e0;
    color: #f57c00;
}

.status-completed {
    background: #f3e5f5;
    color: #7b1fa2;
}

.status-declined {
    background: #ffebee;
    color: #d32f2f;
}

.status-unfilled {
    background: #fafafa;
    color: #999;
}

.modal-actions {
    display: flex;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.btn-modal {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
    display: inline-block;
}

/*
 * Primary modal buttons inherit the primary colour from the theme.
 */
.btn-modal-primary {
    background: var(--primary);
    color: #ffffff;
}

/*
 * Hover state for modal primary buttons uses the darker variant of our primary colour.
 */
.btn-modal-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 119, 204, 0.3);
}

.btn-modal-secondary {
    background: #f8f9fa;
    color: #333;
}

.btn-modal-secondary:hover {
    background: #e9ecef;
}

@media (max-width: 768px) {
    .detail-grid-modal {
        grid-template-columns: 1fr;
    }
}

/* Reusable Form Styles */
.form-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

.form-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/*
 * Dashboard header uses the primary → secondary gradient defined in our theme variables.
 */
.dashboard-header {
    background: #f8fafc;
    color: var(--primary-dark);
    padding: 32px 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

/*
 * Header buttons now use the primary colour background to stand out against the light header.
 */
.btn-header {
    background: var(--primary);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(26, 86, 219, 0.2);
}

.btn-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(26, 86, 219, 0.3);
    background: var(--primary-dark);
}

/*
 * Form header now uses the light theme to align with other pages.
 */
.form-header {
    background: #f8fafc;
    color: var(--primary-dark);
    padding: 32px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
}

.form-header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
}

.form-header p {
    margin: 8px 0 0;
    opacity: 0.9;
    font-size: 16px;
    color: #666;
}

.form-body {
    padding: 32px;
}

.form-section {
    margin-bottom: 32px;
}

.section-title {
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    box-sizing: border-box;
    background: #f8f9fa;
}

/*
 * Focus state for generic form controls uses the primary colour variables.
 */
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(0, 119, 204, 0.1);
}

/*
 * Submit buttons leverage the primary colour variables.
 */
.btn-submit {
    flex: 2;
    padding: 14px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

/*
 * Hover state for submit buttons uses the dark variant of the primary colour.
 */
.btn-submit:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 119, 204, 0.2);
}

.btn-cancel {
    flex: 1;
    padding: 14px;
    background: #f8f9fa;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-cancel:hover {
    background: #e9ecef;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Color Picker Styles */
.color-picker-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.color-option {
    position: relative;
}

.color-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.color-option label {
    display: block;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
}

.color-option input[type="radio"]:checked+label {
    border-color: #333;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.color-option label:hover {
    transform: scale(1.05);
}

.custom-color-input {
    margin-top: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.custom-color-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.custom-color-input input[type="color"] {
    width: 100%;
    height: 50px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
}

/* Location Management Styles */
.location-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.location-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    /* Accent border uses primary colour */
    border-left: 4px solid var(--primary);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.location-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.location-name {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.location-address {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
    line-height: 1.5;
    flex-grow: 1;
}

.location-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
}

.location-actions {
    display: flex;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.color-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Role Badges */
.role-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.role-worker {
    background: #e3f2fd;
    color: #1976d2;
}

.role-manager {
    background: #fff3e0;
    color: #f57c00;
}

.role-admin {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* Action Buttons Group */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 6px 12px;
    font-size: 13px;
}

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    padding-bottom: 32px;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    color: #666;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
}

.pagination-btn:hover {
    /* Use the primary colour on hover */
    border-color: var(--primary);
    color: var(--primary);
    background: #f8f9fa;
}

.pagination-btn.active {
    /* Use the theme gradient for active pages */
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-color: transparent;
    color: white;
}

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background: #f5f5f5;
    border-color: #eee;
}

.pagination-info {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-top: 16px;
}

/*
 * Theme Overrides
 *
 * The following rules override existing component styles to use the new colour palette defined in :root.
 * They rely on the CSS variables defined above and apply globally to ensure a consistent look and feel across
 * all pages without having to edit each individual template. Where appropriate the !important flag is used
 * to take precedence over inline styles defined in some PHP templates.
 */

/* Brand backgrounds */
.navbar,
.main-nav,
.dashboard-header {
    background: #fff;
    color: #0a0808;
}

/* Brand text */
.nav-brand {
    background: none !important;
    -webkit-background-clip: initial !important;
    -webkit-text-fill-color: #ffffff !important;
    color: #ffffff !important;
}

/* Primary numbers and highlights */
.stat-number {
    color: var(--primary) !important;
}

/* Primary buttons */
.btn-primary,
.btn-header,
.action-btn,
.btn-submit,
.btn-modal-primary {
    background: var(--primary) !important;
    color: #ffffff !important;
    border: none;
}

/* Button hover states */
.btn-primary:hover,
.btn-header:hover,
.action-btn:hover,
.btn-submit:hover,
.btn-modal-primary:hover {
    background: var(--primary-dark) !important;
}

/* Pagination styling */
.pagination-btn.active {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
}

.pagination-btn:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

/* Focus states */
input:focus,
select:focus,
.form-control:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(0, 119, 204, 0.15) !important;
}