/* Tracker - Custom Styles */

/* ========================================
   LAYOUT - Fixed Sidebar, Scrollable Content
   ======================================== */

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Sidebar - Fixed Position */
.sidebar {
    width: 260px;
    min-width: 260px;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

/* Main Content - Scrollable */
.main-content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: #f8f9fa;
}

.page-content {
    padding: 1.5rem;
    min-height: 100%;
}

/* Sticky Toolbar */
.sticky-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #f8f9fa;
    padding-bottom: 0.5rem;
    margin: -1.5rem -1.5rem 1rem -1.5rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
}

/* ========================================
   SIDEBAR STYLES
   ======================================== */

.sidebar-section {
    margin-bottom: 0.5rem;
}

.sidebar-header {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.sidebar-link {
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s;
}

.sidebar-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-link.active {
    color: #fff;
    background-color: #0d6efd;
}

.user-section {
    background-color: rgba(0, 0, 0, 0.2);
}

/* ========================================
   CARDS
   ======================================== */

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

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

/* ========================================
   TABLES
   ======================================== */

.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-bottom: 2px solid #dee2e6;
    border-right: 1px solid #dee2e6;
    white-space: nowrap;
    position: relative;
    user-select: none;
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
    height: 44px;
}

.table th:last-child {
    border-right: none;
}

.table td {
    vertical-align: middle;
    border-right: 1px solid #f0f0f0;
    padding: 0.5rem;
}

.table td:last-child {
    border-right: none;
}

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

/* ========================================
   FROZEN COLUMNS & TABLE SCROLL
   ======================================== */

.table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.table-frozen {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: 100%;
}

.table-frozen th,
.table-frozen td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Frozen columns */
.table-frozen .frozen-col {
    position: sticky !important;
    background: #fff;
    z-index: 2;
}

.table-frozen thead .frozen-col {
    background: #f8f9fa !important;
    z-index: 4 !important;
}

/* First frozen column (checkbox) */
.table-frozen .frozen-col:first-child {
    left: 0 !important;
    min-width: 40px;
    width: 40px;
}

/* Second frozen column (Work ID / Description) */
.table-frozen th.frozen-col:nth-child(2),
.table-frozen td.frozen-col:nth-child(2) {
    left: 40px !important;
    min-width: 250px;
    border-right: 3px solid #adb5bd !important;
    box-shadow: 3px 0 6px rgba(0,0,0,0.15);
}

.table-frozen tbody tr:hover .frozen-col {
    background: #e8f4fd !important;
}

/* ========================================
   COLUMN RESIZING
   ======================================== */

.resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    background: transparent;
    z-index: 10;
}

.resize-handle:hover {
    background: rgba(13, 110, 253, 0.3);
}

.resize-handle.resizing {
    background: #0d6efd;
}

th.resizing {
    background-color: #e3f2fd !important;
}

/* Header row styling */
.table-light th {
    background-color: #f8f9fa !important;
}

/* ========================================
   TOOLBAR & FILTER PANEL
   ======================================== */

.toolbar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-panel-container {
    max-width: 40%;
}

.filter-panel {
    background: #fff;
    border: 2px solid #ffc107;
    border-radius: 0.375rem;
    padding: 1rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-label {
    font-weight: 500;
    font-size: 0.8rem;
    min-width: 80px;
    color: #6c757d;
}

.filter-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
}

.filter-checkboxes .form-check-inline {
    margin-right: 0;
}

/* Bulk Actions Panel */
.bulk-panel-container {
    max-width: 40%;
}

.bulk-panel {
    background: #fff;
    border: 2px solid #ffc107;
    border-radius: 0.375rem;
    padding: 1rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.bulk-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.bulk-label {
    font-weight: 500;
    font-size: 0.8rem;
    min-width: 100px;
    color: #6c757d;
}

/* ========================================
   PAGINATION
   ======================================== */

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    color: #6c757d;
    font-size: 0.875rem;
}

.pagination {
    margin-bottom: 0;
}

/* ========================================
   FORMS
   ======================================== */

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* ========================================
   BADGES
   ======================================== */

.badge {
    font-weight: 500;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

/* ========================================
   MODALS
   ======================================== */

.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn-group-sm > .btn {
    padding: 0.25rem 0.5rem;
}

/* ========================================
   LOGIN PAGE
   ======================================== */

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

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        width: 100%;
    }
    
    .filter-panel-container,
    .bulk-panel-container {
        max-width: 100%;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ========================================
   COLUMN WIDTH CLASSES
   ======================================== */

.col-select { 
    width: 40px; 
    min-width: 40px; 
    max-width: 40px; 
    text-align: center;
}

.col-workid-desc { 
    min-width: 250px; 
}

.col-actions { 
    width: 80px; 
    min-width: 80px; 
    max-width: 80px; 
    text-align: center;
}

/* ========================================
   BREAKDOWN MODAL
   ======================================== */

#breakdownModal .table td:first-child {
    min-width: 200px;
}

#breakdownModal .form-control-sm {
    font-size: 0.875rem;
}

/* Weekly Time Inputs */
.col input[type="number"] {
    text-align: center;
}

/* ========================================
   UPLOAD PREVIEW
   ======================================== */

#previewSection .table-warning {
    background-color: rgba(255, 193, 7, 0.1);
}

#previewSection .desc-input {
    min-width: 200px;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .sidebar,
    .toolbar,
    .filter-bar,
    .btn-group,
    .sticky-toolbar {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        max-width: 100%;
    }
}
