/* Custom CSS for HR Portal */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --sidebar-width: 280px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

/* Navigation */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
    color: white !important;
    text-decoration: none;
    transition: color 0.3s ease;
}

.navbar-brand:hover {
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none;
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: var(--primary-color);
    color: white;
    border-radius: 10px 10px 0 0 !important;
    font-weight: 600;
}

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
}

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

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* Tables */
.table {
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
}

.table thead th {
    background-color: var(--light-color);
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: var(--dark-color);
}

.table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* Forms */
.form-control {
    border-radius: 6px;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 8px;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
    border-left: 4px solid #28a745;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
    border-left: 4px solid #dc3545;
    animation: slideDown 0.3s ease-out, shake 0.5s ease-in-out 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
    border-left: 4px solid #ffc107;
}

.alert-info {
    background-color: #d1ecf1;
    color: #055160;
    border-left: 4px solid #0dcaf0;
}

/* Form Validation Styles */
.form-control.is-valid {
    border-color: #28a745;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6.4.4.4-.4m0 4.8-.4-.4-.4.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
    animation: fadeIn 0.3s ease-in;
}

.valid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #28a745;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Loading State */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Dashboard Cards */
.dashboard-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0b5ed7 100%);
    color: white;
    border: none;
}

.dashboard-card .card-body {
    padding: 2rem;
}

.dashboard-card h3 {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.dashboard-card p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Stats Cards */
.stats-card {
    background: white;
    border-left: 4px solid var(--primary-color);
}

.stats-card .stats-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Leave Status Badges */
.badge-pending {
    background-color: var(--warning-color);
    color: var(--dark-color);
}

.badge-approved {
    background-color: var(--success-color);
}

.badge-rejected {
    background-color: var(--danger-color);
}

/* Modal */
.modal-content {
    border: none;
    border-radius: 10px;
}

.modal-header {
    background-color: var(--primary-color);
    color: white;
    border-radius: 10px 10px 0 0;
}

.modal-header .btn-close {
    filter: invert(1);
}

/* Loading Spinner */
.loading {
    display: none;
    text-align: center;
    padding: 2rem;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-card h3 {
        font-size: 2rem;
    }
    
    .stats-card .stats-number {
        font-size: 1.5rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

/* Custom animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Sidebar Styles */
.offcanvas {
    width: var(--sidebar-width) !important;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1050 !important;
    /* Smooth synchronized transitions for hide/show */
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out, visibility 0.3s ease-in-out !important;
}

/* Ensure sidebar is above backdrop */
.offcanvas-backdrop {
    z-index: 1040 !important;
    /* Synchronize backdrop animation with sidebar */
    transition: opacity 0.3s ease-in-out !important;
}

/* Ensure backdrop fades properly - let Bootstrap handle visibility */
.offcanvas-backdrop.show {
    opacity: 0.5 !important;
}

/* Hide backdrop when not showing - but don't force removal */
.offcanvas-backdrop:not(.show) {
    opacity: 0 !important;
    pointer-events: none;
}

/* Ensure content animates smoothly with sidebar */
.offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    /* Remove !important to allow smooth opacity transitions */
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out !important;
}

.offcanvas-header .offcanvas-title a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.offcanvas-header .offcanvas-title a:hover {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

.offcanvas-body {
    /* Remove !important to allow smooth opacity transitions */
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out !important;
}

/* Ensure all content inside sidebar animates together */
.offcanvas-body * {
    transition: opacity 0.3s ease-in-out !important;
}

/* Override Bootstrap's default offcanvas transitions for smoother animation */
.offcanvas-start {
    transition: transform 0.3s ease-in-out !important;
}

/* Ensure backdrop fades in sync with sidebar */
.offcanvas-backdrop.show {
    transition: opacity 0.3s ease-in-out !important;
}

/* When sidebar is hiding, ensure content stays visible until sidebar is fully hidden */
.offcanvas.hiding .offcanvas-header,
.offcanvas.hiding .offcanvas-body {
    opacity: 1;
    transition: opacity 0.3s ease-in-out !important;
}

.offcanvas-body .nav-link {
    color: var(--dark-color);
    transition: all 0.3s ease, opacity 0.3s ease-in-out !important;
    border-radius: 0;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    /* Allow opacity to transition smoothly with sidebar */
}

.offcanvas-body .nav-link:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
    padding-left: 1.5rem;
    text-decoration: none;
    transform: translateX(5px);
}

.offcanvas-body .nav-link.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

/* Force black text for submenu items even when active */
#shiftsSubmenu .nav-link,
#leavesSubmenu .nav-link,
#shiftsSubmenu .nav-link.active,
#leavesSubmenu .nav-link.active,
#shiftsSubmenu .nav-link:hover,
#leavesSubmenu .nav-link:hover,
#shiftsSubmenu .nav-link:active,
#leavesSubmenu .nav-link:active,
#shiftsSubmenu .nav-link:focus,
#leavesSubmenu .nav-link:focus {
    color: #000 !important;
    background-color: #f8f9fa !important;
}

#shiftsSubmenu .nav-link.active:hover,
#leavesSubmenu .nav-link.active:hover {
    background-color: #e9ecef !important;
    color: #000 !important;
    transform: translateX(5px);
    padding-left: 1.5rem;
}

.offcanvas-body .nav-link.active:hover {
    background-color: var(--primary-color);
    color: white;
    transform: none;
    padding-left: 1rem;
}

.offcanvas-body .nav-link:focus {
    box-shadow: none;
    outline: none;
}

.offcanvas-body .nav-link i {
    width: 20px;
    text-align: center;
}

/* Sidebar toggle button */
.navbar .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.navbar .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.7);
    transform: scale(1.05);
}

.navbar .btn-outline-light:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.4);
}

/* Main content adjustment */
.main-content {
    transition: margin-left 0.3s ease;
}

/* Desktop sidebar improvements */
@media (min-width: 769px) {
    .offcanvas {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1040;
        /* Ensure smooth synchronized transitions */
        transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out, visibility 0.3s ease-in-out !important;
    }
    
    .offcanvas.show {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
    }
    
    /* When hiding, ensure content fades with sidebar */
    .offcanvas:not(.show) {
        opacity: 0;
        visibility: hidden;
    }
    
    .offcanvas-body .nav-link {
        padding: 0.75rem 1rem;
    }
    
    .offcanvas-body .nav-link:hover {
        transform: translateX(5px);
    }
    
    .offcanvas-body .nav-link.active:hover {
        transform: none;
    }
    
    .offcanvas-body .nav-link.active {
        border-left: 3px solid white;
    }
    
    .offcanvas-body .nav-link.active i {
        color: white;
    }
    
    .offcanvas-body .nav-link i {
        transition: color 0.3s ease;
    }
    
    .offcanvas-body .nav-link:hover i {
        color: var(--primary-color);
    }
    
    .offcanvas-body .nav-link.active:hover i {
        color: white;
    }
    
    .offcanvas-body .nav-link.active:hover {
        background-color: var(--primary-color);
        color: white;
        border-left: 3px solid white;
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
    }
}

/* Mobile sidebar improvements */
@media (max-width: 768px) {
    .offcanvas {
        width: 100% !important;
    }
    
    .offcanvas-body .nav-link {
        padding: 0.75rem 1rem;
    }
    
    .offcanvas-body .nav-link:hover {
        transform: none;
        padding-left: 1rem;
    }
}

/* Task calendar page layout */
.task-calendar-page-card > .card-header h4 {
    display: flex;
    align-items: center;
}

.task-calendar-layout .task-section,
.task-calendar-layout .evaluation-section {
    border: 1px solid rgba(13, 110, 253, 0.08);
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.06);
}

.task-calendar-layout .task-section > .card-header,
.task-calendar-layout .evaluation-section > .card-header {
    background-color: #f2f7ff;
    color: var(--dark-color);
    border-bottom: 1px solid rgba(13, 110, 253, 0.12);
}

.task-calendar-layout .task-section > .card-header h5,
.task-calendar-layout .evaluation-section > .card-header h5 {
    font-size: 1rem;
    font-weight: 600;
}

.task-calendar-layout .evaluation-filters > .card-header,
.task-calendar-layout .evaluation-results > .card-header {
    background-color: var(--light-color);
    color: var(--dark-color);
}

.task-calendar-layout #evaluationsTable {
    margin-bottom: 0;
}

@media (max-width: 1199px) {
    .task-calendar-layout .evaluation-section {
        margin-top: 0.5rem;
    }
}

/* Calendar Styles */
.fc {
    font-family: inherit;
}

.fc-toolbar {
    margin-bottom: 1.5rem;
}

.fc-toolbar-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.fc-button {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 500;
}

.fc-button:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.fc-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.fc-button-primary:not(:disabled).fc-button-active {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.fc-event {
    border-radius: 4px;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.fc-event:hover {
    opacity: 0.8;
    cursor: pointer;
}

.fc-daygrid-event {
    margin: 1px 2px;
}

.fc-timegrid-event {
    margin: 1px;
}

.fc-event-title {
    font-weight: 600;
}

.fc-day-today {
    background-color: rgba(13, 110, 253, 0.1) !important;
}

.fc-daygrid-day-number {
    font-weight: 500;
    color: var(--dark-color);
}

.fc-col-header-cell {
    background-color: var(--light-color);
    font-weight: 600;
    color: var(--dark-color);
}

.fc-daygrid-day-frame {
    min-height: 100px;
}

.fc-daygrid-day-events {
    margin-top: 0.5rem;
}

/* Calendar Modal Enhancements */
.modal-lg {
    max-width: 800px;
}

.form-control-color {
    width: 3rem;
    height: 2.375rem;
    padding: 0.375rem;
}

/* Calendar event styling improvements */
.fc-event {
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fc-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    z-index: 10 !important;
}

/* Highlight clicked events */
.fc-event.fc-event-highlighted {
    z-index: 20 !important;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.5);
}

/* Better spacing for overlapping events */
.fc-timegrid-event-harness {
    margin: 1px;
}

/* Multiple select styling */
select[multiple] {
    min-height: 120px;
}

select[multiple] option {
    padding: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

select[multiple] option:last-child {
    border-bottom: none;
}

select[multiple] option:checked {
    background-color: var(--primary-color);
    color: white;
}

/* Priority Colors */
.priority-low {
    color: #6c757d;
}

.priority-medium {
    color: #0d6efd;
}

.priority-high {
    color: #fd7e14;
}

.priority-urgent {
    color: #dc3545;
}

/* Status Colors */
.status-pending {
    color: #6c757d;
}

.status-in_progress {
    color: #0d6efd;
}

.status-completed {
    color: #198754;
}

.status-cancelled {
    color: #dc3545;
}

.star-rating-input {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.15rem;
    align-items: center;
}

.star-rating-input .eval-rating-value {
    display: none;
}

.eval-category-rating.is-invalid-rating {
    outline: 1px solid #dc3545;
    border-radius: 0.25rem;
    padding: 0.15rem;
}

/* Print styles */
@media print {
    .navbar, .btn, .modal, footer, .offcanvas {
        display: none !important;
    }
    
    .card {
        border: 1px solid #dee2e6 !important;
        box-shadow: none !important;
    }
}
