/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    min-height: 120px; /* Accommodate banner height + padding */
}

/* Banner Image */
.banner-image {
    flex: 1;
    width: 100%;
    max-width: calc(100% - 200px); /* Leave space for user info */
    height: 80px;
    object-fit: cover;
    object-position: center;
    margin-bottom: 0; /* Remove bottom margin to center in row */
    margin-right: 20px;
}

/* Responsive banner for mobile */
@media (max-width: 768px) {
    .banner-image {
        height: 60px;
        max-width: 100%;
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .user-info {
        align-self: flex-end;
    }
}

h1 {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 10px;
}

/* User Info Display */
.user-info {
    background: #3498db;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0; /* Remove bottom margin to center in row */
    align-self: center; /* Center vertically in the header row */
}

.user-label {
    opacity: 0.9;
}

.user-id {
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
}

.user-switch-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s;
}

.user-switch-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Target Status Banner */
.target-status-banner {
    width: 100%;
    padding: 15px 20px;
    border-radius: 6px;
    text-align: center;
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.target-status-banner.red {
    background-color: #e74c3c;
    color: white;
    border: 2px solid #c0392b;
}

.target-status-banner.green {
    background-color: #27ae60;
    color: white;
    border: 2px solid #229954;
}

.target-status-banner.yellow {
    background-color: #f39c12;
    color: white;
    border: 2px solid #e67e22;
}

.target-status-banner.info {
    background-color: #3498db;
    color: white;
    border: 2px solid #2980b9;
}

.target-status-line1 {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.target-status-line2,
.target-status-line3 {
    font-size: 1rem;
    font-weight: normal;
    margin: 2px 0;
}



/* Controls */
.controls {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.date-range-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.date-range-controls label {
    font-weight: 600;
    color: #34495e;
}

.date-range-controls input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 14px;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

#current-month {
    font-size: 1.5rem;
    color: #2c3e50;
    min-width: 200px;
    text-align: center;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-nav {
    background-color: #ecf0f1;
    color: #2c3e50;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.btn-nav:hover {
    background-color: #d5dbdb;
}

/* Calendar */
.calendar-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.calendar {
    width: 100%;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background-color: #34495e;
    color: white;
}

.day-header {
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

.calendar-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #ecf0f1;
}

.calendar-day {
    background: white;
    min-height: 80px;
    padding: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.calendar-day:hover {
    background-color: #f8f9fa;
}

.calendar-day.other-month {
    background-color: #f8f9fa;
    color: #bdc3c7;
}

.calendar-day.selected {
    background-color: #3498db;
    color: white;
}

.calendar-day.bulk-selected {
    background-color: #9b59b6;
    color: white;
    border: 2px solid #8e44ad;
}

.calendar-day.bulk-selected:hover {
    background-color: #8e44ad;
}

.day-number {
    font-weight: 600;
    font-size: 14px;
}

.day-status {
    margin-top: 5px;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Status indicators */
.status-indicator,
.day-status {
    border: 2px solid transparent;
}

/* Status colors - Updated color scheme */
.in-office,
.day-status.in_office {
    background-color: #27ae60; /* Green */
    color: white;
    border-color: #27ae60;
}

.training,
.day-status.training {
    background-color: #3498db; /* Blue */
    color: white;
    border-color: #3498db;
}

.at-home,
.day-status.at_home {
    background-color: #e74c3c; /* Red */
    color: white;
    border-color: #e74c3c;
}

.on-leave,
.day-status.on_leave {
    background-color: #f39c12; /* Amber */
    color: white;
    border-color: #f39c12;
}

.public-holiday,
.day-status.public_holiday {
    background-color: #d2b48c; /* Light Brown */
    color: white;
    border-color: #d2b48c;
}

.weekend,
.day-status.weekend {
    background-color: #95a5a6; /* Grey */
    color: white;
    border-color: #95a5a6;
}

/* Status form */
.status-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.status-form h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #34495e;
}

.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
}

.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Bulk selection styles */
.bulk-selection-info {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
    color: #495057;
}

.bulk-count-text {
    color: #6c757d;
    font-size: 14px;
}

.bulk-instructions {
    margin-top: 20px;
    padding: 15px;
    background-color: #e3f2fd;
    border-radius: 4px;
    border-left: 4px solid #2196f3;
}

.bulk-instructions p {
    margin-bottom: 10px;
    font-weight: 600;
    color: #1976d2;
}

.bulk-instructions ul {
    margin: 0;
    padding-left: 20px;
}

.bulk-instructions li {
    margin-bottom: 5px;
    color: #424242;
    font-size: 14px;
}

.bulk-instructions kbd {
    background-color: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 3px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.2);
    color: #333;
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 2px 4px;
    white-space: nowrap;
}

/* Legend */
.legend {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legend h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: inline-block;
}

/* Messages */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message,
.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 400px;
}

.error-message {
    background-color: #e74c3c;
    color: white;
}

.success-message {
    background-color: #27ae60;
    color: white;
}

.error-close,
.success-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Form validation styles */
.form-group input.invalid,
.form-group select.invalid {
    border-color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

.form-group input.valid,
.form-group select.valid {
    border-color: #27ae60;
    box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.2);
}

.validation-errors {
    margin-top: 5px;
}

.validation-error {
    color: #e74c3c;
    font-size: 12px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.validation-error::before {
    content: "⚠";
    font-size: 14px;
}

.validation-warning {
    color: #f39c12;
    font-size: 12px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.validation-warning::before {
    content: "⚠";
    font-size: 14px;
}

/* Confirmation dialog styles */
.confirmation-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1002;
}

.confirmation-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.confirmation-content h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.confirmation-content p {
    margin-bottom: 20px;
    color: #34495e;
    line-height: 1.5;
}

.confirmation-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Form disabled state */
.form-disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .metrics-summary {
        min-width: auto;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .date-range-controls {
        justify-content: center;
    }
    
    .calendar-nav {
        justify-content: center;
    }
    
    #current-month {
        font-size: 1.2rem;
        min-width: auto;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 5px;
    }
    
    .day-status {
        font-size: 10px;
        padding: 2px 4px;
    }
    
    .legend-items {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .calendar-day {
        min-height: 50px;
        padding: 3px;
    }
    
    .day-number {
        font-size: 12px;
    }
    
    .day-status {
        font-size: 9px;
        padding: 1px 2px;
    }
    
    .day-header {
        padding: 10px 5px;
        font-size: 12px;
    }
}