/* ============================================================
   Common Component Styles - GitHub Time Logger
   PinkRoccade Local Government
   
   Additional styles for common components used across multiple pages.
   This complements the main site.css file.
   ============================================================ */

/* ================================
FILTER ENHANCEMENTS
   ================================ */

/* Enhanced dropdown styling for filters */
.filter-panel .dropdown-menu {
    border: none;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 0.75rem 0;
    max-height: 400px;
    overflow-y: auto;
    min-width: 100%;
    position: absolute !important;
    z-index: 1072 !important;
    top: 100% !important;
    left: 0 !important;
    right: auto !important;
    transform: none !important;
    margin-top: 0.125rem;
}

.filter-panel .dropdown-menu.show {
    display: block;
}

.filter-panel .dropdown {
    position: relative;
    z-index: 1070;
}

.filter-panel .dropdown.show {
    z-index: 1072;
}

.filter-panel .dropdown-menu .form-check {
    padding: 0.5rem 1.25rem;
    margin-bottom: 0;
    transition: background-color 0.2s ease;
    display: flex;
  align-items: center;
    min-height: 2.5rem;
    position: relative;
    width: 100%;
 box-sizing: border-box;
}

.filter-panel .dropdown-menu .form-check:hover {
    background-color: rgba(230, 0, 126, 0.05);
}

.filter-panel .dropdown-menu .form-check-input {
    margin-top: 0;
    margin-right: 0.75rem;
    margin-left: 0;
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    position: relative;
    z-index: 1;
}

.filter-panel .dropdown-menu .form-check-label {
  cursor: pointer;
    user-select: none;
    width: 100%;
padding: 0;
    margin: 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    line-height: 1.4;
    position: relative;
    z-index: 1;
}

/* Ensure icons in labels are properly aligned */
.filter-panel .dropdown-menu .form-check-label i {
    flex-shrink: 0;
    width: 1.2rem;
    text-align: center;
    margin-right: 0.5rem;
}

/* Fix for very small dropdowns */
.filter-panel .dropdown-menu {
    min-width: 220px;
}

/* Divider in dropdown */
.filter-panel .dropdown-menu hr {
  margin: 0.5rem 0;
    border-color: #dee2e6;
}

/* Action buttons in dropdown */
.filter-panel .dropdown-menu .btn-link {
    color: var(--prlg-primary);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    margin: 0 0.75rem;
}

.filter-panel .dropdown-menu .btn-link:hover {
    background-color: rgba(230, 0, 126, 0.1);
    color: var(--prlg-primary);
}

/* Action button container */
.filter-panel .dropdown-menu .d-flex {
    padding: 0 0.5rem;
}

/* Fix dropdown toggle button styling */
.filter-panel .dropdown-toggle {
    border: 1px solid #ced4da;
    background-color: white;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.filter-panel .dropdown-toggle:hover {
    border-color: var(--prlg-primary);
}

.filter-panel .dropdown-toggle:focus {
    border-color: var(--prlg-primary);
    box-shadow: 0 0 0 0.2rem rgba(230, 0, 126, 0.25);
}

.filter-panel .dropdown-toggle.show {
    border-color: var(--prlg-primary);
    box-shadow: 0 0 0 0.2rem rgba(230, 0, 126, 0.25);
}

/* Button state styling */
.filter-panel .dropdown-toggle.all-selected {
    background-color: #f8f9fa;
    border-color: #ced4da;
}

.filter-panel .dropdown-toggle.has-selections {
    background-color: rgba(230, 0, 126, 0.1);
    border-color: var(--prlg-primary);
    color: var(--prlg-primary);
    font-weight: 500;
}

/* Override Bootstrap dropdown positioning issues */
.filter-panel .dropdown-menu {
    position: absolute !important;
    will-change: transform !important;
    contain: layout style paint !important;
}

/* Ensure dropdowns appear above other content */
.filter-panel .dropdown.show .dropdown-menu {
    z-index: 1072 !important;
}

/* Fix potential overflow issues on parent containers */
.filter-panel {
    overflow: visible !important;
}

.filter-panel .card-body {
 overflow: visible !important;
}

/* Prevent Bootstrap's transform3d issues */
.filter-panel .dropdown-menu[data-bs-popper] {
    transform: none !important;
    top: 100% !important;
    left: 0 !important;
    right: auto !important;
}

/* Ensure proper positioning for all filter dropdowns */
.filter-panel .row {
    position: relative;
 z-index: 1060;
}

.filter-panel .col-md-3 {
    position: relative;
    z-index: 1061;
}

/* Responsive adjustments for filter dropdowns */
@media (max-width: 768px) {
    .filter-panel .dropdown-menu {
        max-height: 250px;
        font-size: 0.85rem;
        min-width: 200px;
    }
    
.filter-panel .dropdown-menu .form-check {
        padding: 0.4rem 1rem;
        min-height: 2rem;
    }
    
    .filter-panel .dropdown-menu .form-check-input {
        width: 0.9rem;
   height: 0.9rem;
        margin-right: 0.5rem;
    }
}

/* Compact filters styling */
.compact-filters .btn-sm {
    font-size: 0.8rem;
    padding: 0.375rem 0.75rem;
}

/* Ensure dropdowns work properly on mobile */
@media (max-width: 576px) {
    .filter-panel .dropdown-menu {
        position: fixed !important;
     top: auto !important;
        left: 0.5rem !important;
        right: 0.5rem !important;
        width: auto !important;
        max-height: 60vh;
min-width: auto;
    }
    
    .filter-panel .dropdown-menu .form-check {
        padding: 0.6rem 1rem;
        min-height: 2.5rem;
    }

    .filter-panel .dropdown-menu .form-check-label {
        font-size: 0.9rem;
    }
}

/* Additional z-index fixes for complex layouts */
.container-fluid > .row:has(.filter-panel) {
    position: relative;
    z-index: 1060;
}

/* Ensure modals don't interfere with dropdowns */
.modal {
    z-index: 1055;
}

.modal-backdrop {
  z-index: 1054;
}

/* Tooltips should be above dropdowns */
.tooltip {
    z-index: 1080;
}

/* ================================
   TABLE ENHANCEMENTS
   ================================ */

/* Enhanced table styling for reports */
.table-enhanced {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table-enhanced thead th {
    background-color: var(--prlg-primary);
    color: white;
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 1rem;
}

.table-enhanced tbody tr {
    transition: background-color 0.2s ease;
}

.table-enhanced tbody tr:hover {
    background-color: rgba(230, 0, 126, 0.03);
}

.table-enhanced tbody td {
  border-color: #f1f3f4;
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

/* Time display in tables */
.time-display {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--prlg-primary);
  background-color: rgba(230, 0, 126, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

/* ================================
   EMPTY STATES
 ================================ */

/* Enhanced empty state styling */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--prlg-gray);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
    color: var(--prlg-primary);
}

.empty-state h5 {
    color: var(--prlg-dark);
    margin-bottom: 1rem;
    font-weight: 600;
}

.empty-state p {
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.empty-state .btn {
    margin-top: 0.5rem;
}

/* ================================
   LOADING STATES
   ================================ */

/* Enhanced loading button states */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
  cursor: wait;
}

.btn.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-sm.loading::after {
    width: 0.8rem;
height: 0.8rem;
}

.btn-lg.loading::after {
    width: 1.2rem;
    height: 1.2rem;
}

/* Loading overlay for content areas */
.loading-overlay {
    position: relative;
}

.loading-overlay::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
 right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  width: 2rem;
    height: 2rem;
    border: 3px solid var(--prlg-primary);
    border-top: 3px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1001;
}

/* ================================
   BADGE IMPROVEMENTS
 ================================ */

/* Enhanced badge styling */
.badge-enhanced {
    font-weight: 500;
  border-radius: 6px;
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-user {
    background-color: var(--prlg-secondary);
    color: white;
}

.badge-time {
    background-color: var(--prlg-success);
    color: white;
}

.badge-issue {
    background-color: var(--prlg-primary);
    color: white;
}

/* ================================
   ALERT IMPROVEMENTS
   ================================ */

/* Enhanced alert styling for reports/error pages */
.alert-enhanced {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.alert-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: currentColor;
}

.alert-enhanced .alert-heading {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-enhanced .alert-heading i {
    font-size: 1.1rem;
}

/* ================================
   REPORTS PAGE ENHANCEMENTS
   ================================ */

/* Sortable table headers */
.sortable {
    cursor: pointer;
    transition: background-color 0.2s ease;
    user-select: none;
}

.sortable:hover {
    background-color: rgba(230, 0, 126, 0.1) !important;
}

.sortable i.ms-1 {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.sortable:hover i.ms-1 {
    opacity: 1;
}

/* Active sort indicator */
.sortable i.fa-sort-up,
.sortable i.fa-sort-down {
    opacity: 1;
    color: var(--prlg-primary);
}

/* Table view toggle buttons */
.btn-group .btn.active {
    background-color: var(--prlg-primary);
    border-color: var(--prlg-primary);
    color: white;
}

/* Description cell enhancements */
.description-cell {
    position: relative;
}

.description-cell .btn-link {
    font-size: 0.7rem;
    padding: 0 !important;
    vertical-align: top;
}

/* Enhanced filter panel */
.filter-panel .form-control:focus,
.filter-panel .form-select:focus {
    border-color: var(--prlg-primary);
    box-shadow: 0 0 0 0.2rem rgba(230, 0, 126, 0.25);
}

/* Table footer styling */
.card-footer {
    background-color: #f8f9fa;
    border-top: 2px solid var(--prlg-primary);
}

/* Enhanced time display in reports */
.time-display {
    background-color: rgba(230, 0, 126, 0.1);
    border: 1px solid rgba(230, 0, 126, 0.2);
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Badge enhancements for reports */
.badge-user {
    background-color: var(--prlg-secondary);
    color: white;
    display: inline-flex;
  align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
 font-weight: 500;
}

/* Time range styling */
.text-success.fw-medium {
    color: var(--prlg-success) !important;
}

/* GitHub link styling */
.text-prlg-primary.fw-medium:hover {
    color: var(--prlg-accent) !important;
    text-decoration: underline !important;
}

/* Filter info display */
.filter-info {
    font-style: italic;
    color: var(--prlg-gray);
}

/* Loading button animations */
.loading-btn.loading {
    position: relative;
  pointer-events: none;
}

.loading-btn.loading::after {
  content: "";
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Mobile-specific improvements */
@media (max-width: 768px) {
    .table-responsive {
        border-radius: 8px;
   border: 1px solid #dee2e6;
    }
    
    .filter-panel .dropdown-menu {
        max-height: 250px;
    }
    
    .empty-state {
        padding: 2rem 1rem;
    }
    
    .empty-state-icon {
        font-size: 3rem;
    }
    
    .table-enhanced .btn-group-sm {
        flex-direction: column;
   gap: 0.25rem;
    }
    
    .description-cell {
        max-width: 150px;
    }
    
    .page-header .d-flex {
      flex-direction: column;
     align-items: flex-start !important;
        gap: 1rem;
}
    
    .card-footer .row {
     flex-direction: column;
        text-align: center;
    }
    
    .card-footer .col-md-3 {
        margin-bottom: 0.5rem;
        padding: 0.5rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }
 
  .card-footer .col-md-3:last-child {
        border-bottom: none;
    }
}

@media (max-width: 576px) {
    .filter-panel .card-body .row {
flex-direction: column;
    }
    
    .filter-panel .col-md-3 {
        margin-bottom: 0.75rem;
    }
    
    .btn-group {
        flex-direction: column;
 width: 100%;
    }
    
    .table-enhanced {
   font-size: 0.85rem;
    }
    
    .time-display {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }
    
    .badge-user {
 font-size: 0.7rem;
        padding: 0.25rem 0.4rem;
    }
    
    .filter-panel .dropdown-menu .form-check {
        padding: 0.4rem 0.8rem;
    }
    
    .filter-panel .dropdown-menu .form-check-label {
        font-size: 0.85rem;
    }
}

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

@media print {
    .table-enhanced thead th {
        background-color: #f8f9fa !important;
        color: black !important;
        border: 1px solid #000 !important;
    }
    
    .btn {
        display: none !important;
    }
    
    .filter-panel {
    display: none !important;
  }
    
    .loading-overlay::before,
    .loading-overlay::after {
    display: none !important;
    }
}

/* ================================
   ACCESSIBILITY IMPROVEMENTS
   ================================ */

/* High contrast mode support */
@media (prefers-contrast: high) {
 .table-enhanced {
        border: 2px solid currentColor;
    }
    
    .filter-panel .dropdown-menu {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .loading-overlay::after,
    .btn.loading::after {
    animation: none;
    }
    
    .filter-panel .dropdown-menu .form-check {
        transition: none;
    }
}