@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;500&display=swap');

html {
    box-sizing: border-box;
}
*, *:before, *:after {
    box-sizing: inherit;
}

* {
    font-family: 'Rubik', sans-serif;
}

body {
    font-family: 'Rubik', sans-serif;
    font-size: 12px;
    background-color: #E8F1F5 !important;  /* Changed to a softer blue */
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding-top: 60px; /* Space for fixed header - will be adjusted by JS */
    flex-direction: column;
}

.main-content {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.employee-list {
    background-color: #FFFFFF;  /* Changed to white */
    border-radius: 10px;
    direction: rtl;
    font-weight: bold;
    text-align: left;
    margin-top: 20px;
    padding: 10px;
    max-height: 90vh;
    overflow-y: auto;
}

.employee-list ul {
    list-style-type: none;
    padding: 0;
}

.employee-list li {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #000000;
}

.employee-list li:hover {
    background-color: #F5F9FA;  /* Lighter hover effect */
}

.schedule-container {
    width: 100%;
    margin: 0 auto;
    background-color: #FFFFFF;  /* Changed to white */
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    overflow-x: auto; /* Default for desktop to allow table scroll */
}

/* Common table styles */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    margin-top: 20px;
}

th,
td {
    border: 1px solid #666666;
    padding: 4px;
    text-align: center;
}

th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.header-row th {
    background-color: #d9d9d9;
}

.day-column {
    background-color: #e6f7ff;
}

.yellow-background {
    background-color: #F7F7E6;  /* Softer yellow */
}

.light-red-background {
    background-color: #F5E6E8;  /* Softer red */
}

.light-green-background {
    background-color: #E6F0E6;  /* Softer green */
}

.light-blue-background {
    background-color: #E6EEF2;  /* Softer blue */
}

.default-cell {
    background-color: white;
}

/* Week selector styles */
.week-selector {
    margin-bottom: 20px;
}

.week-title {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
}

/* Loading indicator */
.loading-indicator {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

/* Loading spinner animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #2C3E50;
    border-radius: 50%;
    margin: 20px auto;
    animation: spin 1s linear infinite;
}

/* Override employee styles for view-schedule page */
.view-schedule .employee {
    background: none;
    padding: 0;
    margin: 0;
    border: none;
    display: inline;
    cursor: default;
}

.assignment-cell.highlighted {
    background-color: yellow;
}

/* Login Page Styles */
.login-page {
    background: linear-gradient(135deg, #E8F1F5 0%, #B8D8E5 100%);
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}


.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.login-box.logout {
    padding: 30px;
    margin-top: -100px;
}

.login-box.logout h1 {
    color: #27ae60;
    margin-bottom: 16px;
}

.login-box.logout .login-subtitle {
    color: #7f8c8d;
    font-size: 16px;
}

.login-logo {
    margin-bottom: 24px;
}

.logo-image {
    max-width: 180px;
    height: auto;
}

.login-box h1 {
    color: #2C3E50;
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.login-subtitle {
    color: #7F8C8D;
    font-size: 16px;
    margin: 0 0 32px 0;
}

.login-button { /* General button style for login context */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2C3E50;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    border: none; /* Ensure buttons don't have default borders */
    cursor: pointer;
}

.login-button:hover {
    background: #34495E;
}

.ms-logo {
    width: 24px;
    height: 24px;
    margin-right: 12px;
}

.error-message {
    background-color: #fee2e2;
    border: 1px solid #ef4444;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: left;
}

.login-box .error-message { /* More specific for login box */
    margin: 0 0 20px;
}

.login-box.loading {
    padding: 40px;
}

.login-box.loading h1 {
    color: #2C3E50;
    margin-bottom: 8px;
}

/* Login Form Styles */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 14px;
    color: #555;
    text-align: left; /* Ensure labels align left */
}

.form-group input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.form-group input:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
}

.login-footer a {
    color: #007bff;
    text-decoration: none;
}

.login-footer .separator {
    margin: 0 8px;
    color: #ccc;
}

/* User Menu in Header */
.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-menu span {
    color: #333;
    font-weight: 500;
}

.logout-link {
    color: #dc3545;
    text-decoration: none;
    font-size: 14px;
}

.logout-link:hover {
    color: #c82333;
}

/* Common Admin Page Styles */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-20px);
}

.notification.success {
    background-color: #2C3E50;
}

.notification.error {
    background-color: #e74c3c;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification.hidden {
    display: none;
}

/* Button styles (general application buttons) */
.btn-primary {
    background-color: #2C3E50;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: #34495E;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background-color: #c0392b;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #64748b;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: #475569;
}

/* Admin table styles */
.user-row {
    border-bottom: 1px solid #e2e8f0;
}

.user-row:hover {
    background-color: #f8fafc;
}

.user-row:last-child {
    border-bottom: none;
}

/* Form control styles */
.form-input,
.form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    transition: border-color 0.2s ease;
    font-family: inherit;
    font-size: 12px;
}

.form-input:focus,
.form-select:focus {
    border-color: #2C3E50;
    outline: none;
}

.form-checkbox {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.category-tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.tab-button {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -0.5rem;
    transition: all 0.2s ease;
}

.tab-button.active {
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
    font-weight: 500;
}

.tab-button:hover:not(.active) {
    color: #1e40af;
    border-bottom: 2px solid #93c5fd;
}

/* Placeholder shown when a week is not published (for mobile cards view) */
.not-published-message {
    display: none; /* Hidden by default, shown by JS */
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 20px;
    background: #fff;
    color: #555;
    text-align: center;
    margin-top: 10px;
}


/* Mobile Menu Styles */
.mobile-menu-toggle {
    display: none; /* Hidden by default, shown in media query */
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    z-index: 1002; /* Ensure it's above other header content if overlapping */
}
.mobile-menu-toggle .hamburger,
.mobile-menu-toggle .hamburger::before,
.mobile-menu-toggle .hamburger::after {
    content: '';
    display: block;
    width: 24px;
    height: 2px;
    background: currentColor;
    position: relative;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}
.mobile-menu-toggle .hamburger::before {
    top: -6px;
    position: absolute;
}
.mobile-menu-toggle .hamburger::after {
    top: 6px;
    position: absolute;
}

/* Hamburger animation for "X" when open */
.mobile-menu-toggle[aria-expanded="true"] .hamburger {
    background: transparent; /* Middle bar disappears */
}
.mobile-menu-toggle[aria-expanded="true"] .hamburger::before {
    top: 0;
    transform: rotate(45deg);
}
.mobile-menu-toggle[aria-expanded="true"] .hamburger::after {
    top: 0;
    transform: rotate(-45deg);
}

.mobile-menu {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0; /* Will be adjusted by JS to be below header */
    left: 0;
    right: 0;
    background: #34495E; /* Slightly different from header for distinction */
    padding: 10px 20px 20px; /* Add some padding */
    flex-direction: column;
    gap: 10px;
    z-index: 1001; /* Below toggle if toggle needs to be above it, but above page content */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    max-height: calc(100vh - 60px); /* Adjust based on header height */
    overflow-y: auto;
}

/* Close button styling for the mobile menu */
.mobile-menu-close {
    align-self: flex-end;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    padding: 4px;
    cursor: pointer;
}

.mobile-menu.open {
    display: flex;
}

.mobile-menu a {
    color: white;
    text-decoration: none;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 16px;
}
.mobile-menu a:last-child {
    border-bottom: none;
}
.mobile-menu a:hover {
    background-color: rgba(255,255,255,0.1);
}

/* Responsive Media Queries */

/* General Mobile Styles (up to 767px) */
@media (max-width: 767px) {
    .week-selector {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .week-selector > div { /* Target the inner div containing inputs/buttons */
        width: 100%;
        margin-bottom: 10px;
        flex-direction: column; /* Stack items vertically if needed */
        align-items: flex-start;
    }

    /* Keep navigation buttons and title on a single line */
    .week-selector > div:last-child {
        flex-direction: row;
        align-items: center;
    }

    .week-selector .form-control,
    .week-selector .form-select {
        max-width: 100% !important;
        margin-bottom: 10px; /* Add space between elements when stacked */
    }
    
    #week-title {
        text-align: left; /* Align week title to left on mobile */
        margin-top: 0;
        width: auto;
    }

    /* Hide desktop-specific week navigation elements */
    #date-selector,
    label[for="date-selector"],
    #employee-selector,
    label[for="employee-selector"],
    .print-button {
        display: none !important;
    }

    /* Login page adjustments */
    .login-container {
        padding: 20px 15px;
        width: 100%;
    }
    .login-box {
        padding: 20px;
    }
    .login-box h1 {
        font-size: 24px;
    }
    .login-subtitle {
        font-size: 14px;
    }
    .login-form .form-group label {
        font-size: 16px;
    }
    .login-form .form-group input {
        padding: 12px 15px;
        font-size: 16px;
        min-height: 44px;
    }
    .login-button { /* Adjusting for login form button specifically */
        padding: 12px 15px;
        font-size: 16px;
        min-height: 44px;
    }

    /* Header adjustments for mobile */
    .nav-menu-container,
    .nav-buttons { /* Hide desktop nav and user buttons */
        display: none !important;
    }
    .mobile-menu-toggle {
        display: block; /* Show hamburger */
    }
}

/* Specific Mobile Styles for Card View and Swipe (e.g., up to 767px) */
@media (max-width: 767px) {

    .schedule-container {
        overflow-x: hidden; /* Critical for swipe in card view */
        /* touch-action: pan-y; Optional: if you want to be explicit about vertical scroll */
    }

    body.force-desktop-view .schedule-container {
        overflow-x: auto !important; /* Allow horizontal scroll for table in desktop view on mobile */
    }

    /* Table is hidden by JS (renderMobileView), but good to have a CSS backup */
    table.schedule-table-view { /* Add a class to your table for this if needed */
        display: none !important;
    }
    
    .cards-container {
        display: block; /* Shown by JS, default state for JS control */
        width: 100%;    /* Ensure it takes full width for transforms */
        position: relative; /* Good practice for transformed children, though not strictly essential here */
    }

    /* The .not-published-message should already be styled, just ensure it's
       part of the flow correctly or hidden by JS when cards are shown */
}

/* Tablet styles (example) */
@media (min-width: 768px) {
    /* body {
        background-color: lightgreen; 
    } */
    /* Desktop menu is shown, mobile menu toggle hidden */
    .mobile-menu-toggle {
        display: none;
    }
    .nav-menu-container,
    .nav-buttons {
        display: flex; /* Or whatever their default display was */
    }
}

/* Desktop styles (example) */
@media (min-width: 1024px) {
    /* body {
        background-color: lightcoral;
    } */
}