* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Login Screen */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-container h1 {
    color: #667eea;
    margin-bottom: 10px;
    text-align: center;
}

.login-container h2 {
    color: #666;
    margin-bottom: 30px;
    text-align: center;
    font-size: 18px;
}

.demo-info {
    margin-top: 20px;
    padding: 15px;
    background: #f0f0f0;
    border-radius: 5px;
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* Header */
header {
    background: white;
    padding: 20px 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #667eea;
}

.header-actions {
    display: flex;
    gap: 20px;
    align-items: center;
}

/* Navigation Bar */
.navbar {
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    padding: 0 40px;
    gap: 5px;
}

.nav-item {
    padding: 15px 25px;
    text-decoration: none;
    color: #666;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-item:hover {
    color: #667eea;
    background: #f9f9f9;
}

.nav-item.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: #f9f9f9;
}

/* Admin Pages */
.admin-page {
    display: none;
}

.admin-page.active {
    display: block;
}

/* Employee Pages */
.employee-page {
    display: none;
}

.employee-page.active {
    display: block;
}

/* Dashboard */
.dashboard {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
}

/* Card */
.card {
    background: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.card h2 {
    color: #667eea;
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-danger {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    font-size: 12px;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-edit {
    background: #ffc107;
    color: #333;
    padding: 8px 16px;
    font-size: 12px;
    margin-right: 5px;
}

.btn-edit:hover {
    background: #e0a800;
}

/* Date Input Wrapper */
.date-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.date-input-wrapper input[type="date"] {
    flex: 1;
    padding-right: 40px;
}

.date-icon {
    position: absolute;
    right: 10px;
    font-size: 20px;
    cursor: pointer;
    user-select: none;
    z-index: 3;
    pointer-events: auto;
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Time Input Wrapper - same style as date */
.time-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.time-input-wrapper input[type="time"] {
    flex: 1;
    padding-right: 40px;
}

.time-icon {
    position: absolute;
    right: 10px;
    font-size: 20px;
    cursor: pointer;
    user-select: none;
    z-index: 3;
    pointer-events: auto;
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Date and Time Inputs */
input[type="date"],
input[type="time"] {
    cursor: text;
    position: relative;
}

/* Hide the native picker indicator */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    display: none;
}

input[type="date"]::-webkit-datetime-edit,
input[type="time"]::-webkit-datetime-edit {
    cursor: text;
}

/* Alert */
.alert {
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-danger {
    background: #fee;
    border: 2px solid #dc3545;
    color: #dc3545;
}

.alert h3 {
    margin-bottom: 10px;
}

/* Shift List */
.shift-item {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #667eea;
}

.shift-item.open-shift {
    border-left-color: #dc3545;
    background: #fee;
}

.shift-info {
    flex: 1;
}

.shift-time {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.shift-duration {
    font-size: 12px;
    color: #666;
}

.shift-actions {
    display: flex;
    gap: 5px;
}

.shift-item-small {
    background: #f9f9f9;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid #667eea;
}

.shift-item-small .shift-time {
    font-size: 14px;
}

.shift-item-small .shift-duration {
    font-size: 11px;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #555;
}

table tr:hover {
    background: #f9f9f9;
}

/* Calendar */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 5px;
}

.calendar-controls span {
    font-weight: 600;
    font-size: 18px;
    color: #667eea;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.calendar-header {
    font-weight: 600;
    text-align: center;
    padding: 10px;
    background: #667eea;
    color: white;
    border-radius: 5px;
}

.calendar-day {
    min-height: 140px;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    background: white;
    position: relative;
}

.calendar-day.other-month {
    background: #f9f9f9;
    color: #999;
}

.calendar-day.has-uncovered {
    background: #fee;
    border-color: #dc3545;
}

.day-number {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 14px;
}

.calendar-shifts {
    font-size: 10px;
}

.calendar-shift {
    background: #667eea;
    color: white;
    padding: 4px 6px;
    border-radius: 3px;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    line-height: 1.3;
    word-wrap: break-word;
}

.calendar-shift.uncovered {
    background: #dc3545;
}

.checkbox-container {
    display: flex;
    align-items: center;
}

.checkbox-container input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .calendar-grid {
        gap: 5px;
    }
    
    .calendar-day {
        min-height: 80px;
        padding: 5px;
    }
    
    .dashboard {
        padding: 0 10px;
    }
}

.no-data {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

.no-data-small {
    color: #999;
    padding: 10px;
    font-style: italic;
    font-size: 14px;
}

.employee-shifts-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.employee-shifts-section:last-child {
    border-bottom: none;
}

.employee-shifts-name {
    color: #667eea;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.preferred-badge {
    background: #ffc107;
    color: #333;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.shift-count {
    font-size: 14px;
    color: #666;
    font-weight: normal;
    margin-left: auto;
}

.employee-shifts-list {
    display: grid;
    gap: 10px;
}

.shift-item-small {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 5px;
    border-left: 3px solid #667eea;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 10px;
    padding: 0;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
    color: #667eea;
    margin: 0;
}

.close {
    font-size: 32px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
}

.close:hover {
    color: #333;
}

.modal-content form {
    padding: 30px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

/* Print Styles */
@media print {
    /* Default: Portrait for timesheet */
    @page {
        size: A4 portrait;
        margin: 1cm;
    }
    
    /* Landscape for calendar */
    body.printing-calendar {
        @page {
            size: A4 landscape;
            margin: 0.5cm;
        }
    }
    
    /* Timesheet printing - hide everything except timesheet */
    #timesheetPrintArea:not(:empty) ~ * {
        display: none !important;
    }
    
    #timesheetPrintArea {
        display: block !important;
    }
    
    .timesheet-container {
        padding: 1cm;
        max-width: 100%;
    }
    
    .timesheet-table th,
    .timesheet-table td {
        padding: 8px;
    }
    
    .signature-section {
        page-break-inside: avoid;
    }
    
    /* Calendar printing */
    body * {
        visibility: hidden;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    #printArea, #printArea * {
        visibility: visible;
    }
    
    #timesheetPrintArea, #timesheetPrintArea * {
        visibility: visible;
    }
    
    #printArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    
    .calendar-controls,
    .btn,
    header,
    .navbar,
    .no-print {
        display: none !important;
    }
    
    .calendar-grid {
        page-break-inside: avoid;
    }
    
    .calendar-day {
        min-height: 80px;
        border: 1px solid #333;
        page-break-inside: avoid;
        background: white !important;
    }
    
    .calendar-shift {
        font-size: 9px;
        padding: 2px 4px;
        background: white !important;
        color: black !important;
        border: 1px solid #333 !important;
    }
    
    .calendar-header {
        background: white !important;
        color: black !important;
        border: 1px solid #333;
    }
    
    h1, h2 {
        color: #000 !important;
    }
    
    .preferred-badge,
    .shift-count,
    .calendar-shift.uncovered {
        background: white !important;
        color: black !important;
        border: 1px solid #333 !important;
    }
    
    * {
        background: white !important;
        color: black !important;
    }
}

.success-message {
    color: #28a745;
    padding: 15px;
    background: #d4edda;
    border-radius: 5px;
    margin-top: 15px;
}

.error-message {
    color: #dc3545;
    padding: 15px;
    background: #fee;
    border-radius: 5px;
    margin-top: 15px;
}

/* Timesheet Print Styles */
.timesheet-print {
    background: white;
    padding: 0;
    margin: 0;
}

.timesheet-container {
    max-width: 21cm;
    margin: 0 auto;
    padding: 2cm 1.5cm;
    font-family: Arial, sans-serif;
}

.timesheet-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #333;
    padding-bottom: 20px;
}

.timesheet-header h1 {
    margin: 0 0 20px 0;
    font-size: 28px;
    color: #333;
}

.timesheet-info {
    text-align: left;
    margin: 20px 0;
}

.timesheet-info p {
    margin: 8px 0;
    font-size: 14px;
}

.timesheet-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.timesheet-table th,
.timesheet-table td {
    border: 1px solid #333;
    padding: 10px;
    text-align: left;
}

.timesheet-table th {
    background-color: #f5f5f5;
    font-weight: bold;
    font-size: 14px;
}

.timesheet-table td {
    font-size: 13px;
}

.timesheet-table tfoot td {
    font-weight: bold;
    background-color: #f5f5f5;
    font-size: 14px;
}

.timesheet-footer {
    margin-top: 50px;
}

.signature-section {
    display: flex;
    justify-content: space-between;
    margin-top: 60px;
}

.signature-line {
    width: 45%;
    text-align: center;
}

.signature-line p:first-child {
    border-top: 1px solid #333;
    padding-top: 5px;
    margin-bottom: 5px;
}

.signature-line p:last-child {
    margin: 0;
    font-size: 12px;
    color: #666;
}

.shifts-summary {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
}

/* Timesheet print media query */
@media print {
    .timesheet-print {
        margin: 0;
        padding: 0;
    }
    
    .timesheet-container {
        padding: 1cm;
        max-width: 100%;
    }
    
    .timesheet-table th,
    .timesheet-table td {
        padding: 8px;
    }
    
    .signature-section {
        page-break-inside: avoid;
    }
}

