/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Roboto+Mono:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Righteous&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@300..700&display=swap');

/* CSS Variables */
:root {
    /* Colors */
    --primary-color: #2d3748;
    --secondary-color: #ffffff;
    --text-color: #2d3748;
    --accent-color: #7957d5;
    --turtle-green: #50fa7b;
    --retro-purple: #bd93f9;
    --retro-pink: #ff79c6;
    --border-color: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    
    /* UI Colors */
    --blue-500: #7957d5;
    --blue-600: #6943d1;
    --blue-50: #f3efff;
    --blue-100: #e9e3ff;
    --blue-700: #5a32c7;
    --green-50: #f0fdf4;
    --green-100: #dcfce7;
    --green-500: #50fa7b;
    --green-600: #48e06f;
    --green-700: #40c462;
    --purple-50: #faf5ff;
    --purple-100: #f3e8ff;
    --purple-700: #bd93f9;
    --yellow-50: #fefce8;
    --yellow-700: #f1fa8c;
    --yellow-800: #e9f176;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
}

/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto Mono', monospace;
    background-color: var(--gray-100);
    color: var(--text-color);
    line-height: 1.5;
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Navigation */
nav {
    background-color: var(--primary-color);
    box-shadow: 0 2px 4px var(--shadow-color);
    border-bottom: 2px solid var(--retro-purple);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4rem;
    padding: 0 1rem;
}

.nav-brand {
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    color: var(--secondary-color);
    text-decoration: none;
    text-shadow: 2px 2px 0px var(--retro-purple);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lucky-cat {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Forms */
.form-container {
    background-color: var(--secondary-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px var(--shadow-color);
    margin: 1rem 0;
    border: 2px solid var(--border-color);
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
input[type="text"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: var(--secondary-color);
    color: var(--text-color);
    font-family: 'Roboto Mono', monospace;
    transition: all 0.2s;
}

.form-input:focus,
.form-select:focus,
input:focus,
select:focus {
    outline: none;
    border-color: var(--retro-purple);
    box-shadow: 0 0 0 2px rgba(189, 147, 249, 0.2);
}

/* Buttons */
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background-color: var(--retro-purple);
    color: var(--secondary-color);
    box-shadow: 0 2px 0 var(--blue-700);
}

.btn-primary:hover {
    background-color: var(--blue-600);
    transform: translateY(1px);
    box-shadow: 0 1px 0 var(--blue-700);
}

.btn-success {
    background-color: var(--green-500);
    color: var(--primary-color);
    box-shadow: 0 2px 0 var(--green-700);
}

.btn-success:hover {
    background-color: var(--green-600);
    transform: translateY(1px);
    box-shadow: 0 1px 0 var(--green-700);
}

.btn-danger {
    background-color: var(--retro-pink);
    color: var(--secondary-color);
    box-shadow: 0 2px 0 #ff5555;
}

.btn-danger:hover {
    background-color: #ff6eb3;
    transform: translateY(1px);
    box-shadow: 0 1px 0 #ff5555;
}

button:disabled {
    background-color: var(--gray-400);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* Tables */
.table-container {
    background-color: var(--secondary-color);
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px var(--shadow-color);
    overflow: hidden;
    border: 2px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Roboto Mono', monospace;
}

th {
    background-color: var(--gray-50);
    padding: 0.75rem 1rem;
    text-align: right;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--gray-200);
}

tr:hover {
    background-color: var(--blue-50);
}

/* Summary Cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background-color: var(--secondary-color);
    padding: 1.25rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px var(--shadow-color);
    border: 2px solid var(--border-color);
    transition: all 0.2s;
}

.summary-card:hover {
    border-color: var(--gray-300);
    transform: translateY(-2px);
}

.summary-card h3 {
    font-family: 'Roboto Mono', monospace;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.summary-card p {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.5rem;
    color: var(--gray-700);
    font-weight: 500;
}

/* Status Indicators */
.status-active {
    color: var(--green-500);
    font-weight: bold;
}

.status-inactive {
    color: var(--retro-pink);
    font-weight: bold;
}

/* Shift Select Control */
.shift-select {
    display: none;
}

[data-shift-type="double"] .shift-select {
    display: block;
}

/* RTL Support */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] th,
[dir="rtl"] td {
    text-align: right;
}

[dir="rtl"] ul.list-disc {
    padding-right: 1.5rem;
    padding-left: 0;
}

[dir="rtl"] ul.list-disc > li::before {
    right: -1.5rem;
    left: auto;
}

/* Tooltips */
.group {
    position: relative;
}

.group-hover\:visible {
    visibility: hidden;
    position: absolute;
    z-index: 10;
    background-color: var(--primary-color);
    color: var(--secondary-color);
    padding: 0.5rem;
    border-radius: 0.25rem;
    width: 16rem;
    border: 2px solid var(--retro-purple);
    box-shadow: 0 2px 4px var(--shadow-color);
}

.group:hover .group-hover\:visible {
    visibility: visible;
}

.group-hover\:visible::before {
    content: '';
    position: absolute;
    right: -6px;
    top: 10px;
    border: 6px solid transparent;
    border-left-color: var(--primary-color);
}

/* Tabs */
.tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 2px solid var(--border-color);
    background-color: var(--secondary-color);
}

.tab {
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-family: 'Roboto Mono', monospace;
    color: var(--gray-600);
}

.tab.active {
    border-bottom-color: var(--retro-purple);
    color: var(--retro-purple);
}

.tab:hover:not(.active) {
    color: var(--blue-500);
    background-color: var(--blue-50);
}

/* Drop Zone */
#drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 0.8rem;
    text-align: center;
    color: var(--text-color);
    margin-bottom: 0.8rem;
    background-color: var(--gray-50);
    font-size: 1rem;
    transition: all 0.3s;
    cursor: pointer;
}

#drop-zone:hover {
    border-color: var(--retro-purple);
    background-color: var(--blue-50);
}

/* Footer */
footer {
    background-color: var(--secondary-color);
    padding: 1rem;
    margin-top: 2rem;
    border-top: 2px solid var(--border-color);
}

footer p {
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
    font-family: 'Roboto Mono', monospace;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }
    
    .nav-brand {
        font-size: 0.875rem;
    }
    
    .summary-card p {
        font-size: 1rem;
    }
    
    .form-container {
        padding: 1rem;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .hidden-mobile {
        display: none;
    }
    
    .text-sm-mobile {
        font-size: 0.875rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--retro-purple);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--blue-600);
}

/* Shift Management Styles */
.preference-preferred {
    background-color: rgba(0, 255, 0, 0.1) !important;
    border: 2px solid rgba(0, 255, 0, 0.3) !important;
}

.preference-rather-not {
    background-color: rgba(255, 165, 0, 0.1) !important;
    border: 2px solid rgba(255, 165, 0, 0.3) !important;
}

.preference-unavailable {
    background-color: rgba(255, 0, 0, 0.1) !important;
    border: 2px solid rgba(255, 0, 0, 0.3) !important;
}

/* Worker box preferences */
.worker-preference-preferred {
    background-color: rgba(74, 222, 128, 0.2) !important;
    border: 1px solid #4ade80 !important;
}

.worker-preference-rather-not {
    background-color: rgba(251, 191, 36, 0.2) !important;
    border: 1px solid #fbbf24 !important;
}

.worker-preference-unavailable {
    background-color: rgba(239, 68, 68, 0.2) !important;
    border: 1px solid #ef4444 !important;
}

/* Drag and Drop States */
.dragging {
    opacity: 0.5;
}

.drag-over {
    border: 2px dashed var(--blue-500) !important;
}

.valid-drop-target {
    border: 2px solid var(--green-500) !important;
}

.invalid-drop-target {
    border: 2px solid var(--retro-pink) !important;
    cursor: not-allowed !important;
}

/* Worker Item Styles */
.worker-item {
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    border: 2px solid transparent;
}

.worker-item:hover {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
}

.worker-item.selected-worker {
    background-color: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.worker-item.selected-worker .text-gray-600 {
    color: #2563eb;
}

/* Assigned Worker Styles */
.assigned-worker {
    cursor: move;
    transition: all 0.2s;
}

.assigned-worker:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px var(--shadow-color);
}

/* Slot Styles */
.slot {
    cursor: pointer;
    transition: all 0.2s;
    background-color: var(--secondary-color);
    color: var(--gray-800);
}

.slot.selected-slot {
    border: 2px solid var(--blue-500) !important;
    background-color: var(--blue-50) !important;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slot .empty-position {
    color: var(--gray-800);
    background-color: var(--gray-100);
}

/* Mode Button Styles */
.mode-button {
    transition: all 0.2s;
}

.mode-button.active {
    background-color: var(--blue-500);
    color: white;
}

.mode-button:not(.active) {
    background-color: var(--gray-200);
    color: var(--gray-600);
}

/* Template Mode Styles */
.cursor-not-allowed {
    cursor: not-allowed !important;
    opacity: 0.6;
}

.template-only {
    display: none;
}

.template-only.hidden {
    display: none;
}

.template-only:not(.hidden) {
    display: block;
}

.template-only:not(.hidden) .slot {
    color: var(--gray-800);
    background-color: var(--gray-50);
}

.schedule-only {
    display: block;
}

.schedule-only.hidden {
    display: none;
}

.hide-in-definitions {
    display: block;
}

.hide-in-definitions.hidden-by-definitions {
    display: none;
}

.garamond-title {
    font-family: adobe-garamond-pro, serif;
    font-weight: 400;
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.title-large {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: 4rem;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    letter-spacing: -0.02em;
}

.title-secondary {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: 3.5rem;
    color: var(--primary-color);
    margin-top: 1rem;
    letter-spacing: -0.02em;
}

.frank-ruhl {
    font-family: 'Frank Ruhl Libre', serif;
}

.logo-text {
    font-family: 'Righteous', 'Comfortaa', cursive;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--retro-purple);
    text-shadow: 
        2px 2px 0 var(--blue-700),
        -1px -1px 0 var(--blue-50),
        0 2px 6px rgba(189, 147, 249, 0.3);
    position: relative;
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (min-width: 768px) {
    .logo-text {
        letter-spacing: 0.15em;
        text-shadow: 
            4px 4px 0 var(--blue-700),
            -2px -2px 0 var(--blue-50),
            0 4px 12px rgba(189, 147, 249, 0.3);
    }
}

/* Worker list horizontal scroll on tablets */
@media (min-width: 640px) and (max-width: 1024px) {
    .schedule-only.w-full.lg\:w-1\/4 {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .space-y-2 {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0.5rem;
        padding: 0.5rem;
        scroll-snap-type: x mandatory;
    }
    
    .worker-item {
        min-width: 200px;
        scroll-snap-align: start;
    }
}

/* Large screen optimizations */
@media (min-width: 1024px) {
    .container {
        padding: 2rem;
    }
    
    .grid-cols-1.md\:grid-cols-7 {
        gap: 1rem;
    }
    
    .slot {
        transition: transform 0.2s;
    }
    
    .slot:hover {
        transform: translateY(-2px);
    }
    
    /* Improved worker sidebar */
    .schedule-only.w-full.lg\:w-1\/4 {
        position: sticky;
        top: 1rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .worker-item {
        background-color: var(--gray-800);
        color: var(--gray-100);
        border: 1px solid var(--gray-700);
    }
    
    .worker-item .text-gray-600 {
        color: var(--gray-300) !important;
    }
    
    .slot {
        background-color: var(--gray-100);
        color: var(--gray-800);
        border-color: var(--gray-300);
    }
    
    .slot .empty-position {
        color: var(--gray-800);
        background-color: var(--gray-200);
    }

    /* Improve contrast for worker preferences in dark mode */
    .worker-preference-preferred {
        background-color: rgba(16, 185, 129, 0.2) !important;
        border: 1px solid var(--green-500) !important;
        color: var(--gray-100) !important;
    }

    .worker-preference-rather-not {
        background-color: rgba(245, 158, 11, 0.2) !important;
        border: 1px solid var(--yellow-700) !important;
        color: var(--gray-100) !important;
    }

    .worker-preference-unavailable {
        background-color: rgba(239, 68, 68, 0.2) !important;
        border: 1px solid #ef4444 !important;
        color: var(--gray-100) !important;
    }

    /* Ensure assigned workers are visible in dark mode */
    .assigned-worker {
        background-color: var(--gray-700) !important;
        color: var(--gray-100) !important;
        border: 1px solid var(--gray-600);
    }

    .assigned-worker span {
        color: var(--gray-100) !important;
    }

    /* Template mode in dark mode */
    .template-only:not(.hidden) .slot {
        background-color: var(--gray-200);
        color: var(--gray-800);
    }

    /* Ensure "Any Worker" text is visible */
    .slot[data-empty="true"] div:first-child,
    .slot div:first-child:contains("Any Worker") {
        color: var(--gray-800) !important;
        font-weight: 500;
    }
}

/* Shift Management Responsive Styles */
@media (max-width: 768px) {
    /* Worker sidebar */
    .worker-item {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    /* Shift grid */
    .grid-cols-1.md\:grid-cols-7 {
        grid-template-columns: repeat(1, 1fr);
        gap: 1rem;
    }
    
    /* Modal adjustments */
    #slotModal .relative,
    #renameModal .relative {
        width: 90%;
        margin: 0 auto;
    }
    
    /* Button and input sizing */
    .form-select,
    .form-input,
    button {
        min-height: 44px; /* Better touch targets */
    }
    
    /* Mode toggle buttons */
    .mode-button {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Week navigation */
    #weekDisplay {
        font-size: 1.25rem;
    }
    
    /* Shift sections */
    .shift-container {
        margin-bottom: 1rem;
    }
    
    .shift-slots {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .slot {
        padding: 0.75rem;
    }
}

/* Shift Grid Layout Improvements */
.grid-cols-1.md\:grid-cols-7 {
    display: grid;
    grid-template-columns: repeat(7, minmax(100px, 1fr));
    gap: 0.25rem;
    align-items: start;
    width: 100%;
}

/* Day Column */
.grid-cols-1.md\:grid-cols-7 > div {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    min-width: 100px; /* Further reduced minimum width */
}

/* Slot adjustments for smaller widths */
.slot {
    width: 100%;
    min-height: 3.5rem; /* Slightly reduced height */
    display: flex;
    flex-direction: column;
    font-size: 0.75rem; /* Even smaller font */
    padding: 0.35rem;
}

/* Worker name and info in slots */
.assigned-worker {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.25rem;
}

/* Worker item adjustments */
.worker-item {
    padding: 0.5rem;
    font-size: 0.875rem;
}

/* Day Header adjustments */
.grid-cols-1.md\:grid-cols-7 > div h3 {
    height: 2.5rem; /* Reduced height */
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

/* Medium screen optimizations */
@media (min-width: 768px) and (max-width: 1023px) {
    .grid-cols-1.md\:grid-cols-7 {
        gap: 0.25rem; /* Even smaller gap on medium screens */
    }
    
    .slot {
        padding: 0.4rem;
    }
}

/* Container for the entire shift schedule */
.hide-in-definitions {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1rem; /* Add padding to account for scrollbar */
    margin-bottom: -1rem; /* Offset the padding */
}

/* Day Header */
.grid-cols-1.md\:grid-cols-7 > div h3 {
    flex: 0 0 auto;
    height: 3rem; /* Fixed height for day headers */
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

/* Shift Container */
.shift-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Slots Container */
.shift-slots {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
    overflow-y: auto;
}

/* Individual Slot */
.slot {
    width: 100%;
    min-height: 4rem; /* Minimum height for slots */
    display: flex;
    flex-direction: column;
}

/* Slot Header */
.slot > div:first-child {
    flex: 0 0 auto;
}

/* Slot Content */
.slot > div:last-child {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .grid-cols-1.md\:grid-cols-7 {
        grid-template-columns: 1fr;
    }
    
    .grid-cols-1.md\:grid-cols-7 > div h3 {
        height: auto;
        padding: 0.5rem 0;
    }
    
    .slot {
        min-height: 3rem;
    }
}

/* Shift Management Layout Improvements */
@media (min-width: 1024px) {
    .flex.flex-col.lg\:flex-row.gap-4 {
        display: flex;
        gap: 0.5rem;
    }

    .w-full.lg\:w-1\/4 {
        flex: 0 0 20%; /* Reduced from 25% to 20% */
        max-width: 20%; /* Reduced from 25% to 20% */
    }

    .w-full.lg\:w-3\/4 {
        flex: 0 0 80%; /* Increased from 75% to 80% */
        max-width: 80%; /* Increased from 75% to 80% */
    }
}

/* Medium screen optimizations */
@media (min-width: 768px) and (max-width: 1023px) {
    .flex.flex-col.lg\:flex-row.gap-4 {
        flex-direction: column;
    }

    .w-full.lg\:w-1\/4 {
        width: 100%;
        margin-bottom: 1rem;
    }

    .w-full.lg\:w-3\/4 {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Ensure the shift grid scrolls horizontally */
    .space-y-4.hide-in-definitions {
        min-width: min-content;
    }

    /* Add padding for the scrollbar */
    .bg-white.rounded-lg.shadow-md.p-4.mb-4 {
        margin-bottom: 1rem;
    }

    /* Horizontal scrolling worker list for medium screens */
    .worker-list {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        margin: 0 -0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    .worker-item {
        flex: 0 0 auto;
        width: 200px;
        margin: 0 0.5rem;
    }
}

/* Improved shift grid layout */
.shift-management-grid {
    display: grid;
    gap: 1rem;
    width: 100%;
}

@media (min-width: 1024px) {
    .shift-management-grid {
        grid-template-columns: repeat(7, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .shift-management-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 767px) {
    .shift-management-grid {
        grid-template-columns: 1fr;
    }
}

/* Improved shift container stability */
.shift-container {
    background: var(--secondary-color);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.shift-header {
    padding: 1rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--border-color);
}

.shift-content {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Worker slot improvements */
.worker-slot {
    background: var(--gray-50);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.worker-slot:last-child {
    margin-bottom: 0;
}

/* Mode toggle button improvements */
.mode-button {
    white-space: nowrap;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
}

@media (max-width: 640px) {
    .mode-button {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Form Select Improvements */
.form-select {
    color: var(--gray-800);
    background-color: white;
}

.form-select option {
    color: var(--gray-800);
    background-color: white;
    padding: 8px;
}

.form-select:focus {
    border-color: var(--retro-purple);
    box-shadow: 0 0 0 2px rgba(189, 147, 249, 0.2);
}

/* Placeholder text improvements */
.form-select option[value=""] {
    color: var(--gray-600);
}

/* Dark mode improvements */
@media (prefers-color-scheme: dark) {
    .form-select {
        background-color: var(--gray-100);
        color: var(--gray-800);
        border-color: var(--gray-300);
    }

    .form-select option {
        background-color: var(--gray-100);
        color: var(--gray-800);
    }

    .form-select option[value=""] {
        color: var(--gray-600);
    }

    /* Ensure text is visible in worker items */
    .worker-item {
        background-color: var(--gray-100);
        color: var(--gray-800);
        border: 1px solid var(--gray-300);
    }

    .worker-item .text-gray-600 {
        color: var(--gray-700) !important;
    }
}

/* Tab Navigation Responsive Fixes */
@media (max-width: 640px) {
    #currentWeekTab,
    #nextWeekTab {
        padding: 0.5rem;
    }

    #currentWeekTab span,
    #nextWeekTab span {
        font-size: 0.875rem;
        line-height: 1.25;
        word-wrap: break-word;
        max-width: 100%;
    }

    #currentWeekTab .flex,
    #nextWeekTab .flex {
        flex-direction: column;
        gap: 0.25rem;
    }

    #currentWeekTab svg,
    #nextWeekTab svg {
        width: 1.25rem;
        height: 1.25rem;
    }

    #currentWeekDate,
    #nextWeekDate {
        font-size: 0.75rem;
        white-space: normal;
        word-wrap: break-word;
    }
}

/* Preference colors for shift containers */
.shift-container.preference-preferred {
    border: 2px solid #4ade80 !important;
    background-color: rgba(74, 222, 128, 0.05) !important;
}

.shift-container.preference-rather-not {
    border: 2px solid #fbbf24 !important;
    background-color: rgba(251, 191, 36, 0.05) !important;
}

.shift-container.preference-unavailable {
    border: 2px solid #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.05) !important;
}

/* Preference colors for individual slots */
.slot.preference-preferred {
    border: 1px solid #4ade80 !important;
    background-color: rgba(74, 222, 128, 0.1) !important;
}

.slot.preference-rather-not {
    border: 1px solid #fbbf24 !important;
    background-color: rgba(251, 191, 36, 0.1) !important;
}

.slot.preference-unavailable {
    border: 1px solid #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.1) !important;
}

/* Worker preference colors */
.worker-preference-preferred {
    background-color: rgba(74, 222, 128, 0.2) !important;
    border: 1px solid #4ade80 !important;
}

.worker-preference-rather-not {
    background-color: rgba(251, 191, 36, 0.2) !important;
    border: 1px solid #fbbf24 !important;
}

.worker-preference-unavailable {
    background-color: rgba(239, 68, 68, 0.2) !important;
    border: 1px solid #ef4444 !important;
}

/* Ensure preference colors don't override selection styles */
.selected-worker {
    border: 2px solid #3b82f6 !important;
    background-color: rgba(59, 130, 246, 0.1) !important;
}

.selected-slot {
    border: 2px solid #3b82f6 !important;
    background-color: rgba(59, 130, 246, 0.1) !important;
}

/* Slot-specific preference styles */
.slot.preference-preferred {
    background-color: rgba(0, 255, 0, 0.2) !important;
}

.slot.preference-rather-not {
    background-color: rgba(255, 165, 0, 0.2) !important;
}

.slot.preference-unavailable {
    background-color: rgba(255, 0, 0, 0.2) !important;
}

/* When a worker is assigned, show a stronger color */
.slot.has-worker.preference-preferred {
    background-color: rgba(0, 255, 0, 0.4) !important;
}

.slot.has-worker.preference-rather-not {
    background-color: rgba(255, 165, 0, 0.4) !important;
}

.slot.has-worker.preference-unavailable {
    background-color: rgba(255, 0, 0, 0.4) !important;
}

/* Compact button styles */
.btn-compact {
    padding: 0.5rem 1rem;
    line-height: 1.2;
    height: auto;
    min-height: 2.25rem;
}

/* Excel button style */
.btn-excel {
    background-color: #217346;
    color: white;
    border-color: #185a35;
}

.btn-excel:hover {
    background-color: #1a5c38;
    border-color: #134429;
} 