/* css/timesheet.css */
/* Timesheet system styling */

:root {
    --timesheet-primary: #355946;
    --timesheet-secondary: #7BA05B;
    --timesheet-accent: #9B8B5B;
    --timesheet-red: var(--red, #dc3545);
    --timesheet-green: #28a745;
    --timesheet-blue: #007bff;
    --timesheet-gray: #6c757d;
    --timesheet-light-gray: #f8f9fa;
    --timesheet-border: #dee2e6;
    --timesheet-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Container Layouts */
.timesheet-container,
.admin-timesheet-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.timesheet-header {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--timesheet-shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.header-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

/* Navigation */
.month-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}

.month-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--timesheet-primary);
    margin: 0;
    min-width: 200px;
    text-align: center;
}

.nav-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: white;
    border: 2px solid var(--timesheet-border);
    border-radius: 50%;
    color: var(--timesheet-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-arrow:hover {
    background: var(--timesheet-primary);
    color: white;
    border-color: var(--timesheet-primary);
}

/* Monthly Summary */
.monthly-summary,
.teacher-summary {
    margin-bottom: 24px;
}

.summary-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--timesheet-shadow);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.summary-item {
    text-align: center;
    padding: 16px;
    border-radius: 6px;
    background: var(--timesheet-light-gray);
}

.summary-label {
    display: block;
    font-size: 0.875rem;
    color: var(--timesheet-gray);
    margin-bottom: 8px;
    font-weight: 500;
}

.summary-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--timesheet-primary);
}

.summary-item.estimated-pay {
    background: linear-gradient(135deg, var(--timesheet-secondary), var(--timesheet-accent));
}

.summary-item.estimated-pay .summary-value {
    color: white;
}

.summary-item.estimated-pay .summary-label {
    color: rgba(255, 255, 255, 0.9);
}

/* Calendar Styles */
.timesheet-calendar {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--timesheet-shadow);
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: var(--timesheet-primary);
}

.day-name {
    padding: 5px 0;
    text-align: center;
    font-weight: 600;
    color: white;
    font-size: 18px;
}

.calendar-body {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    background: var(--timesheet-border);
}

.calendar-day {
    background: white;
    min-height: 120px;
    padding: 8px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.calendar-day.empty {
    background: var(--timesheet-light-gray);
    opacity: 0.5;
}

.calendar-day.weekend {
    background: #f8f9fa;
    display: none;
}

.calendar-day.today {
    background: #e8f4fd;
    border: 2px solid var(--timesheet-blue);
}

.calendar-day.completed {
    border: 2px solid var(--timesheet-green);
    background: #f0f9f0;
}

.calendar-day.time-off {
    background: #fff3cd;
    border: 2px solid #ffc107;
}

.calendar-day.has-request {
    border: 2px solid var(--timesheet-red);
    background: #fff0f0;
}

.day-number {
    font-weight: 600;
    color: var(--timesheet-primary);
    margin-bottom: 4px;
    font-size: 0.875rem;
}

.day-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.time-display {
    font-size: 0.75rem;
    color: var(--timesheet-gray);
    line-height: 1.2;
}

.status-badge {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    text-align: center;
    margin: 2px 0;
}

.status-badge.completed {
    background: var(--timesheet-green);
    color: white;
}

.status-badge.time-off {
    background: #ffc107;
    color: #212529;
}

.status-badge.pending {
    background: var(--timesheet-gray);
    color: white;
}

.day-actions {
    display: flex;
    gap: 4px;
    margin-top: auto;
}

.complete-btn,
.adjust-btn,
.time-off-btn {
    background: none;
    border: 1px solid var(--timesheet-border);
    border-radius: 4px;
    padding: 4px;
    cursor: pointer;
    color: var(--timesheet-gray);
    transition: all 0.2s ease;
    font-size: 0.75rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.complete-btn:hover {
    background: var(--timesheet-green);
    color: white;
    border-color: var(--timesheet-green);
}

.adjust-btn:hover {
    background: var(--timesheet-blue);
    color: white;
    border-color: var(--timesheet-blue);
}

.time-off-btn:hover {
    background: #ffc107;
    color: #212529;
    border-color: #ffc107;
}

.request-status {
    font-size: 0.625rem;
    padding: 1px 4px;
    border-radius: 3px;
    text-align: center;
    margin-top: 2px;
}

.request-status.pending {
    background: var(--timesheet-red);
    color: white;
}

.request-status.approved {
    background: var(--timesheet-green);
    color: white;
}

.request-status.denied {
    background: var(--timesheet-gray);
    color: white;
}

/* Admin-specific styles */
.admin-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    box-shadow: var(--timesheet-shadow);
    gap: 20px;
}

.teacher-selection {
    display: flex;
    align-items: center;
    gap: 12px;
}

.teacher-selection label {
    font-weight: 600;
    color: var(--timesheet-primary);
}

.teacher-selection select {
    padding: 8px 12px;
    border: 2px solid var(--timesheet-border);
    border-radius: 6px;
    font-size: 1rem;
    min-width: 300px;
}

.request-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    color: var(--timesheet-red);
    font-size: 0.875rem;
    cursor: help;
}

.no-teacher-selected {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.empty-state {
    text-align: center;
    color: var(--timesheet-gray);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 16px;
    color: var(--timesheet-border);
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--timesheet-primary);
}

/* Pending Requests */
.pending-requests-alert,
.pending-requests-summary {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-direction: column;
}

.pending-requests-summary {
    background: white;
    border: 2px solid var(--timesheet-red);
}

#all-requests-list {
    width: 100%;
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.summary-header h3 {
    margin: 0;
    color: var(--timesheet-red);
}

.request-previews {
    display: flex;
    gap: 15px;
    width: 100%;
    justify-content: space-between;
}

.request-preview {
    background: var(--timesheet-light-gray);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 130px;
}

.request-preview.more {
    background: var(--timesheet-red);
    color: white;
    align-items: center;
    justify-content: center;
}

.requests-list,
.teacher-requests {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--timesheet-shadow);
}

.teacher-requests h3 {
    margin-bottom: 16px;
    color: var(--timesheet-primary);
}

.request-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--timesheet-border);
    border-radius: 6px;
    margin-bottom: 12px;
    background: var(--timesheet-light-gray);
}

.request-info {
    flex: 1;
}

.request-type {
    font-weight: 600;
    color: var(--timesheet-primary);
    margin-bottom: 4px;
}

.request-date {
    font-size: 0.875rem;
    color: var(--timesheet-gray);
    margin-bottom: 4px;
}

.request-notes {
    font-size: 0.875rem;
    color: var(--timesheet-gray);
    font-style: italic;
}

.teacher-name {
    font-weight: 600;
    color: var(--timesheet-primary);
    margin-bottom: 4px;
}

.request-actions {
    display: flex;
    gap: 8px;
}

.btn-approve,
.btn-deny {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-approve {
    background: var(--timesheet-green);
    color: white;
}

.btn-approve:hover {
    background: #218838;
}

.btn-deny {
    background: var(--timesheet-red);
    color: white;
}

.btn-deny:hover {
    background: #c82333;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content.large {
    max-width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--timesheet-border);
    background: var(--timesheet-light-gray);
    border-radius: 8px 8px 0 0;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    color: var(--timesheet-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--timesheet-gray);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-close:hover {
    color: var(--timesheet-red);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--timesheet-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--timesheet-border);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--timesheet-primary);
}

.current-schedule {
    background: var(--timesheet-light-gray);
    padding: 12px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 1rem;
    color: var(--timesheet-primary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--timesheet-border);
    flex-shrink: 0;
}

/* Button Styles */
.btn-primary,
.btn-secondary,
.btn-small {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background: #2a4538;
}

.btn-secondary {
    background: var(--timesheet-gray);
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* Notifications */
.top-notification {
    background: var(--timesheet-green);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
}

.top-notification.error {
    background: var(--timesheet-red);
}

/* Responsive Design */
@media (max-width: 768px) {
    .timesheet-container,
    .admin-timesheet-container {
        padding: 16px;
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        justify-content: center;
    }

    .summary-card {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 16px;
    }

    .month-navigation {
        gap: 16px;
    }

    .month-title {
        font-size: 1.5rem;
        min-width: 150px;
    }

    .admin-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .teacher-selection {
        justify-content: center;
    }

    .teacher-selection select {
        min-width: auto;
        width: 100%;
    }

    .calendar-day {
        min-height: 100px;
        padding: 6px;
    }

    .day-actions {
        gap: 2px;
    }

    .complete-btn,
    .adjust-btn,
    .time-off-btn {
        width: 24px;
        height: 24px;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .request-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .request-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .summary-card {
        grid-template-columns: 1fr;
    }

    .request-previews {
        flex-direction: column;
    }
}

/* Schedule Management Styles */
.schedule-management-content {
    max-height: 60vh;
    overflow-y: auto;
}

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

.schedule-section h4 {
    color: var(--timesheet-primary);
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.unscheduled-teachers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.teacher-btn {
    padding: 8px 16px;
    font-size: 0.875rem;
    border-radius: 4px;
    cursor: pointer;
}

.schedules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.schedule-card {
    background: var(--timesheet-light-gray);
    border: 1px solid var(--timesheet-border);
    border-radius: 6px;
    padding: 16px;
}

.schedule-card h5 {
    margin: 0 0 12px 0;
    color: var(--timesheet-primary);
    font-size: 1rem;
}

.schedule-details {
    margin-bottom: 12px;
}

.schedule-details div {
    margin-bottom: 4px;
    font-size: 0.875rem;
    color: var(--timesheet-gray);
}

.schedule-card .btn-primary {
    width: 100%;
    padding: 8px 16px;
    font-size: 0.875rem;
}

.day-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.day-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--timesheet-light-gray);
    border: 1px solid var(--timesheet-border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.day-checkbox:hover {
    background: #e9ecef;
}

.day-checkbox input[type="checkbox"] {
    margin: 0;
    width: auto;
}

.day-checkbox input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: var(--timesheet-primary);
}

.day-checkbox:has(input:checked) {
    background: var(--timesheet-secondary);
    color: white;
    border-color: var(--timesheet-secondary);
}

.day-checkbox:has(input:checked) span {
    color: white;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--timesheet-gray);
}

.error {
    color: var(--timesheet-red);
    text-align: center;
    padding: 20px;
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 6px;
}

/* Schedule Editor Styles */
.schedule-editor-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.schedule-editor-header {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--timesheet-shadow);
}

.schedule-form {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--timesheet-shadow);
}

.schedule-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--timesheet-border);
}

.schedule-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.schedule-section h3 {
    color: var(--timesheet-primary);
    margin-bottom: 16px;
    font-size: 1.25rem;
}

.pay-config {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.weekly-schedule {
    display: grid;
    gap: 16px;
}

.day-schedule {
    border: 2px solid var(--timesheet-border);
    border-radius: 8px;
    padding: 16px;
    transition: all 0.3s ease;
}

.day-schedule.active {
    border-color: var(--timesheet-secondary);
    background: var(--timesheet-light-gray);
}

.day-header {
    background: var(--light-green);
    border-radius: 5px 5px 0 0;
    margin: -17px -17px 10px;
    padding: 0 20px;
}

.day-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 600;
    color: var(--timesheet-primary);
}

.day-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.day-times {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 16px;
    align-items: end;
    transition: opacity 0.3s ease;
}

.day-times.disabled {
    opacity: 0.4;
}

.time-input {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.time-input label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--timesheet-gray);
}

.time-input input[type="time"] {
    padding: 8px 12px;
    border: 1px solid var(--timesheet-border);
    border-radius: 4px;
    font-size: 1rem;
}

.time-input input[type="time"]:focus {
    outline: none;
    border-color: var(--timesheet-primary);
}

.hours-display {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--timesheet-secondary);
    border-radius: 4px;
    min-width: 100px;
    justify-content: center;
}

.hours-calc {
    font-weight: 600;
    color: white;
    font-size: 0.875rem;
}

.schedule-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--timesheet-border);
}

/* Responsive design for schedule editor */
@media (max-width: 768px) {
    .schedule-editor-container {
        padding: 16px;
    }

    .pay-config {
        grid-template-columns: 1fr;
    }

    .day-times {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .hours-display {
        min-width: auto;
    }

    .schedule-actions {
        flex-direction: column;
    }

    .schedule-actions button {
        width: 100%;
    }
}

/* Teacher Schedule Cards */
.teacher-schedule-list {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--timesheet-shadow);
}

.teacher-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 16px;
}

.teacher-schedule-card {
    border: 1px solid var(--timesheet-border);
    border-radius: 6px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.teacher-schedule-card:hover {
    border-color: var(--timesheet-secondary);
    box-shadow: 0 2px 8px rgba(53, 89, 70, 0.1);
}

.teacher-info h4 {
    margin: 0 0 6px 0;
    color: var(--timesheet-primary);
    font-size: 1.1rem;
}

.teacher-schedule-summary {
    display: flex;
    gap: 12px;
    align-items: center;
}

.schedule-type {
    background: var(--timesheet-secondary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.rate {
    color: var(--timesheet-gray);
    font-size: 0.875rem;
}

.no-schedule {
    color: var(--timesheet-red);
    font-size: 0.875rem;
    font-style: italic;
}

.teacher-actions .btn-primary {
    padding: 8px 16px;
    font-size: 0.875rem;
}

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

    .teacher-schedule-card {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .teacher-actions {
        align-self: stretch;
    }

    .teacher-actions .btn-primary {
        width: 100%;
        text-align: center;
    }
}

/* Request Time Details */
.request-times {
    margin-top: 8px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--timesheet-border);
}

.time-detail {
    margin-bottom: 6px;
    padding: 6px 10px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.time-detail:last-child {
    margin-bottom: 0;
}

.time-detail strong {
    color: var(--timesheet-primary);
    display: inline-block;
    min-width: 80px;
}

.time-detail.requested {
    background: #e8f4fd;
    border-left: 3px solid var(--timesheet-blue);
    border-radius: 4px;
}

.time-detail.time-off-full {
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    border-radius: 4px;
    font-weight: 500;
}

.time-detail.time-off-full strong {
    color: #856404;
}

/* Request Preview Time Badges */
.time-range {
    font-size: 0.75rem;
    color: var(--timesheet-blue);
    font-weight: 600;
    padding: 2px 6px;
    background: #e8f4fd;
    border-radius: 3px;
}

.time-off-badge {
    font-size: 0.75rem;
    color: #856404;
    font-weight: 600;
    padding: 2px 6px;
    background: #fff3cd;
    border-radius: 3px;
}