/* Base Layout Styles */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
}

footer {
    margin-top: auto;
}

/* Card Styles */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: none;
    transition: all 0.3s ease-in-out;
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

/* Table Styles */
.table {
    margin-bottom: 0;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Component Styles */
.badge {
    font-size: 0.875em;
    padding: 0.35em 0.65em;
}

.modal-content {
    border: none;
    border-radius: 0.5rem;
}

.btn {
    border-radius: 0.25rem;
}

.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.alert {
    border-radius: 0.25rem;
}

/* Form Styles */
.input-group-text {
    background-color: #f8f9fa;
}

input[type="number"] {
    text-align: right;
}

.form-label {
    font-weight: 500;
}

.input-group > .form-control {
    border-radius: 0.25rem;
}

/* Form Validation Styles */
.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 stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%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-valid {
    border-color: #198754;
    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='%23198754' 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);
}

/* Employee Assignment Styles */
.employee-card {
    transition: all 0.3s ease-in-out;
    margin-bottom: 1rem;
    border: 1px solid rgba(0,0,0,.125);
}

.employee-card.border-primary {
    border: 2px solid #0d6efd !important;
}

.employee-card:hover {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Status Section Styles */
.status-section {
    transition: all 0.3s ease-in-out;
}

.status-options {
    background-color: #f8f9fa;
    border-left: 3px solid #0d6efd;
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
}

/* Checkbox and Label Styles */
.form-check-label {
    cursor: pointer;
}

.form-check-input {
    cursor: pointer;
}

.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.status-checkbox:checked + .form-check-label {
    color: #0d6efd;
    font-weight: 500;
}

/* Button Group Styles */
.btn-group-sm {
    margin-right: 10px;
}

.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Status Badge Styles */
.status-badge {
    display: inline-block;
    padding: 0.25em 0.4em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
}

.status-badges .badge {
    font-size: 0.85em;
    padding: 0.4em 0.6em;
    margin-right: 0.5em;
    margin-bottom: 0.5em;
}

/* Notes Section Styles */
.note-item {
    position: relative;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 15px;
}

.note-meta {
    color: #6c757d;
    font-size: 0.85rem;
    text-align: right;
}

/* Animation Styles */
.highlight-section {
    animation: highlightBg 2s ease-out;
}

@keyframes highlightBg {
    0% {
        background-color: rgba(13, 110, 253, 0.1);
    }
    100% {
        background-color: transparent;
    }
}

/* Dashboard Card Styles */
.border-left-primary {
    border-left: 4px solid #4e73df !important;
}

.border-left-success {
    border-left: 4px solid #1cc88a !important;
}

.border-left-warning {
    border-left: 4px solid #f6c23e !important;
}

.border-left-danger {
    border-left: 4px solid #e74a3b !important;
}

.text-gray-300 {
    color: #dddfeb !important;
}

.text-gray-800 {
    color: #5a5c69 !important;
}

.text-xs {
    font-size: .7rem;
}

/* Calendar Styles */
.fc {
    max-width: 1200px;
    margin: 0 auto;
}

.fc-event-title {
    font-size: 0.9em;
    white-space: normal;
    overflow: hidden;
    font-weight: 500;
}

.fc-day-today {
    background-color: #c5facf !important;
}

.fc-header-toolbar {
    margin-bottom: 1.5em !important;
}

.fc-event {
    margin: 2px 0;
    border-radius: 3px;
}

/* Enhanced Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Container and Layout */
    .container {
        padding: 0 12px;
    }

    /* Dashboard Header */
    .page-header {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .col-md-6.text-end {
        text-align: left !important;
        margin-top: 10px;
    }

    .col-md-6.text-end .btn {
        width: 100%;
        margin-bottom: 8px;
    }

    /* Stats Cards */
    .col-xl-3 {
        padding: 0 8px;
    }

    .card {
        margin-bottom: 15px;
    }

    .card .card-body {
        padding: 12px;
    }

    .card .fa-2x {
        font-size: 1.5em;
    }

    /* Date Range Controls */
    .card-header .d-flex {
        flex-direction: column;
        gap: 10px;
    }

    .card-header .d-flex.gap-2 {
        width: 100%;
    }

    #start_date,
    #end_date,
    #refresh-stats {
        width: 100%;
        min-height: 38px;
    }

    /* Table Adjustments */
    .table-responsive {
        margin: 0 -12px;
        padding: 0 12px;
        width: calc(100% + 24px);
    }

    .table {
        font-size: 0.85rem;
    }

    .table td, 
    .table th {
        padding: 0.5rem;
    }

    /* Hide less important columns */
    .table th:nth-child(4),
    .table td:nth-child(4),
    .table th:nth-child(6),
    .table td:nth-child(6) {
        display: none;
    }

    /* Compact Badges */
    .badge {
        font-size: 0.7rem;
        padding: 0.3em 0.5em;
    }

    /* Button Adjustments */
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Form Controls */
    input[type="date"] {
        -webkit-appearance: none;
        background-color: #fff;
    }
}

/* Tablet Specific Styles */
@media (min-width: 769px) and (max-width: 1024px) {
    .col-xl-3 {
        width: 50%;
        margin-bottom: 15px;
    }

    .card-header .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    #start_date,
    #end_date {
        width: 150px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) {
    .card .card-body:active {
        background-color: rgba(0, 0, 0, 0.02);
    }

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

/* iOS Safari Fixes */
@supports (-webkit-touch-callout: none) {
    .card-header .d-flex.gap-2 {
        gap: 0.5rem !important;
    }
    
    input[type="date"] {
        padding: 0 8px;
    }
}

/* Loading States */
.opacity-50 {
    opacity: 0.5;
}

/* Refresh Button Animation */
#refresh-stats {
    min-width: 100px;
}

#refresh-stats i {
    transition: transform 0.3s ease-in-out;
}

#refresh-stats:active i {
    transform: rotate(180deg);
}

/* Dark Mode Support 
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #f8f9fa;
    }

    .card {
        background-color: #2d2d2d;
        border-color: #404040;
    }

    .card-header {
        background-color: #333;
        border-color: #404040;
    }

    .table {
        color: #f8f9fa;
    }

    .text-gray-800 {
        color: #e9ecef !important;
    }

    input[type="date"] {
        background-color: #333;
        color: #f8f9fa;
        border-color: #404040;
    }
} 
    */

/* Recent Jobs Mobile Styles */
@media (max-width: 768px) {
    /* Card Header */
    .card.shadow .card-header {
        padding: 15px;
    }

    .card.shadow .card-header .d-flex {
        flex-direction: column;
        gap: 10px;
        align-items: stretch !important;
    }

    .card.shadow .card-header .btn {
        width: 100%;
    }

    /* Table Responsive Layout */
    .table-responsive {
        margin: 0;
        padding: 0;
        border: none;
    }

    .table {
        font-size: 0.9rem;
    }

    /* Hide table header on mobile */
    .table thead {
        display: none;
    }

    /* Convert rows to cards */
    .table tbody tr {
        display: block;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        margin-bottom: 15px;
        padding: 12px;
        background-color: #fff;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    /* Style each cell as a flex row */
    .table tbody td {
        display: flex;
        padding: 8px 0;
        border: none;
        align-items: center;
    }

    /* Add labels for each cell */
    .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        width: 110px;
        min-width: 110px;
        color: #495057;
        flex-shrink: 0;
    }

    /* Job number styling */
    .table tbody td:nth-child(2) {
        font-size: 1.1em;
    }

    .table tbody td:nth-child(2) a {
        color: #0d6efd;
        font-weight: 600;
    }

    /* Amount and Balance styling */
    .table tbody td:nth-child(5),
    .table tbody td:nth-child(6) {
        font-family: monospace;
    }

    /* Status badges */
    .table .badge {
        font-size: 0.75rem;
        padding: 0.5em 0.75em;
        white-space: nowrap;
    }

    /* Actions cell styling */
    .table tbody td:last-child {
        position: relative;
        display: flex;
        padding: 8px 0;
        margin-top: 5px;
        border-top: 1px solid #dee2e6;
    }

    /* Button styling for mobile */
    .table tbody td:last-child .btn {
        position: absolute;
        left: 110px;
        top: 6px;
        padding: 4px 12px;
        font-size: 0.8rem;
        min-width: 60px;
        height: 28px;
        line-height: 20px;
        border-radius: 4px;
    }
}

/* Touch device interactions */
@media (hover: none) {
    .table tbody tr:active {
        transform: scale(0.98);
    }
}

/* Jobs Table Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Override general table styles specifically for jobs table */
    #jobsTable.table {
        font-size: 0.9rem;
        margin: 0;
        border: none;
    }

    #jobsTable.table thead {
        display: none;
    }

    #jobsTable.table tbody tr {
        display: block;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        margin-bottom: 15px;
        padding: 12px;
        background-color: #fff;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    #jobsTable.table tbody td {
        display: flex !important; /* Use !important to override general table styles */
        padding: 8px 0;
        border: none;
        align-items: center;
    }

    #jobsTable.table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        width: 110px;
        min-width: 110px;
        color: #495057;
        flex-shrink: 0;
    }

    /* Job number styling */
    #jobsTable.table tbody td:nth-child(2) {
        font-size: 1.1em;
    }

    #jobsTable.table tbody td:nth-child(2) a {
        color: #0d6efd;
        font-weight: 600;
    }

    /* Actions buttons specific styling */
    body table#jobsTable tbody td:last-child {
        border-top: 1px solid #dee2e6 !important;
        margin-top: 10px !important;
        padding-top: 10px !important;
    }

    body table#jobsTable tbody td:last-child .buttons {
        display: flex !important;
        gap: 10px !important;
        margin-left: 110px !important;
        width: calc(100% - 110px) !important; /* Add this */
    }

    /* Button specific styles */
    body table#jobsTable tbody td:last-child .btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 70px !important;
        padding: 4px 12px !important;
        font-size: 0.8rem !important;
        height: 28px !important;
        line-height: 1 !important;
    }

    body table#jobsTable tbody td:last-child .btn-primary,
    body table#jobsTable tbody td:last-child .btn-danger {
        position: static !important; /* Add this */
    }

    /* Status badges */
    #jobsTable.table .badge {
        font-size: 0.75rem;
        padding: 0.5em 0.75em;
        white-space: nowrap;
    }

    /* Actions cell styling */
    #jobsTable.table tbody td:last-child {
        position: relative;
        display: flex !important;
        padding: 8px 0;
        margin-top: 5px;
        border-top: 1px solid #dee2e6;
    }

    /* Button container styling */
    #jobsTable.table tbody td:last-child .buttons {
        display: flex;
        gap: 10px;
        margin-left: 110px;
    }

    #jobsTable.table tbody td:last-child .btn {
        padding: 4px 12px;
        font-size: 0.8rem;
        min-width: 60px;
        height: 28px;
        line-height: 20px;
        border-radius: 4px;
    }
}

/* Admin Status check boxes (viewjobs) */
.status-control {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 4px;
    background-color: #f8f9fa;
    margin-bottom: 5px;
}

.status-checkbox {
    margin-right: 10px;
}

.status-label {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.status-control:has(.status-checkbox:checked) {
    background-color: #e8f0fe;
}

.status-control:has(.status-checkbox:disabled) {
    opacity: 0.7;
}

/* Touch device interactions */
@media (hover: none) {
    #jobsTable.table tbody tr:active {
        transform: scale(0.98);
    }
}