/* Filter Section Styles */
.orders-filter-section {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filter-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.filter-toggle-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.filter-toggle-btn i {
    font-size: 16px;
}

.filter-arrow {
    transition: transform 0.3s ease;
}

.filter-toggle-btn.active .filter-arrow {
    transform: rotate(180deg);
}

.filter-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
}

.filter-content.expanded {
    max-height: 300px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 20px;
}

.filter-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filter Controls */
.search-filter {
    position: relative;
}

.search-filter input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.search-filter input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-spinner {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
    animation: spin 1s linear infinite;
}

.service-type-filter select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.service-type-filter select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.status-filter select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.status-filter select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Date Input Styling */
.date-input {
    width: 100%;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
    text-align: right;
}

.date-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Persian DatePicker Customization */
.date-input.datepicker-plot-area {
    border: none;
    box-shadow: none;
}

.date-input.datepicker-plot-area:focus {
    border: none;
    box-shadow: none;
}

/* Active Filters */
.active-filters {
    margin-bottom: 20px;
    display: none;
}

.active-filters-header {
    display: inline;
    margin-right: 8px;
}

.active-filters-title {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.active-filters-list {
    display: inline;
}

.active-filter-tag {
    display: inline;
    margin-right: 8px;
}

.active-filter-tag .filter-label {
    color: #495057;
    font-weight: 500;
    margin-right: 4px;
}

.active-filter-tag .filter-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    background: #f0f0f0;
    color: #333;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.active-filter-tag .filter-value:hover {
    background: #ff6b6b;
    color: white;
}

.active-filter-tag .remove-icon {
    font-size: 10px;
    font-weight: bold;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.active-filter-tag .filter-value:hover .remove-icon {
    opacity: 1;
}

.clear-filters-btn {
    font-size: 12px;
    padding: 6px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.clear-filters-btn:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

/* Orders Table Styles */
.orders-table-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 400px;
    width: 100%;
    display: block;
}

.orders-table {
    width: 100% !important;
    border-collapse: collapse;
    background: #fff;
    font-size: 14px;
    border-radius: 8px;
    overflow: hidden;
    table-layout: fixed;
    display: table;
}

/* Sticky Header */
.orders-table-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    width: 100%;
}

.orders-table-header th {
    padding: 16px 12px;
    text-align: right;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    position: relative;
    white-space: nowrap;
    color: #fff;
    font-family: inherit;
}

.orders-table-header th:first-child {
    border-top-right-radius: 8px;
}

.orders-table-header th:last-child {
    border-top-left-radius: 8px;
}

/* Sortable Headers */
.orders-table-header th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    position: relative;
}

.orders-table-header th.sortable:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sort-icon {
    margin-right: 4px;
    font-size: 12px;
    opacity: 0.7;
    transition: all 0.3s ease;
    display: inline-block;
}

/* Default state - show up-down arrow */
.orders-table-header th.sortable .sort-icon {
    opacity: 0.7;
}

/* ASC state - show up arrow */
.orders-table-header th.sortable.asc .sort-icon {
    opacity: 1;
    color: #fff;
}

/* DESC state - show down arrow */
.orders-table-header th.sortable.desc .sort-icon {
    opacity: 1;
    color: #fff;
}

/* Hover effect for sortable headers */
.orders-table-header th.sortable:hover .sort-icon {
    opacity: 1;
}

/* Table Body */
.orders-table-body {
    width: 100%;
}

.orders-table-body tr {
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
    background: #fff;
    width: 100%;
}

.orders-table-body tr:hover {
    background: #f8f9ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
    cursor: pointer;
}

.orders-table-body tr:hover td {
    color: #2c3e50;
}

.orders-table-body tr:last-child {
    border-bottom: none;
}

.orders-table-body td {
    padding: 16px 12px;
    text-align: right;
    vertical-align: middle;
    border: none;
    color: #333;
}

/* Column Specific Styles */
.order-id {
    width: 20%;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #333;
}

.order-patient {
    width: 25%;
    font-weight: 500;
}

.order-service {
    width: 25%;
}

.order-date {
    width: 20%;
}



.order-status {
    width: 10%;
    text-align: center;
}



/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pending {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffcc80;
}

.status-in_progress {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.status-completed {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.status-cancelled {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* Loading State */
.orders-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
}

.loading-spinner {
    font-size: 32px;
    color: #667eea;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.orders-loading p {
    margin: 0;
    font-size: 16px;
    color: #666;
}

/* Empty State */
.orders-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #666;
}

.orders-empty i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 16px;
}

.orders-empty p {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: #666;
}



/* Filter Responsive Design */
@media (max-width: 1200px) {
    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .filter-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
    }
    
    .filter-actions {
        flex-direction: column;
        padding: 0 12px 12px;
    }
    
    .filter-actions .btn {
        width: 100%;
    }
    
    .date-range-dropdown {
        min-width: 280px;
        left: -20px;
        right: -20px;
    }
    
    .date-range-calendar {
        padding: 16px;
    }
    
    .calendar-day {
        padding: 6px 2px;
        font-size: 13px;
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .orders-table {
        font-size: 13px;
    }
    
    .orders-table-header th,
    .orders-table-body td {
        padding: 12px 8px;
    }
    
    .order-service {
        min-width: 180px;
        max-width: 250px;
    }
    
    .order-note-icon {
        font-size: 11px;
        margin-right: 4px;
    }
    
    .custom-tooltip {
        max-width: 250px;
        font-size: 11px;
        padding: 6px 10px;
    }
}

@media (max-width: 768px) {
    .orders-table-container {
        overflow-x: auto;
    }
    
    .orders-table {
        min-width: 800px;
    }
}

/* Scrollbar Styling */
.orders-table-container::-webkit-scrollbar {
    height: 8px;
}

.orders-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.orders-table-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.orders-table-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Table Row Animations */
.orders-table-body tr {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.orders-table-body tr:nth-child(1) { animation-delay: 0.1s; }
.orders-table-body tr:nth-child(2) { animation-delay: 0.2s; }
.orders-table-body tr:nth-child(3) { animation-delay: 0.3s; }
.orders-table-body tr:nth-child(4) { animation-delay: 0.4s; }
.orders-table-body tr:nth-child(5) { animation-delay: 0.5s; }
.orders-table-body tr:nth-child(6) { animation-delay: 0.6s; }
.orders-table-body tr:nth-child(7) { animation-delay: 0.7s; }
.orders-table-body tr:nth-child(8) { animation-delay: 0.8s; }
.orders-table-body tr:nth-child(9) { animation-delay: 0.9s; }
.orders-table-body tr:nth-child(10) { animation-delay: 1.0s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Service Type Styling */
.service-type {
    display: inline-block;
    padding: 2px 8px;
    background: #f0f4ff;
    color: #667eea;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 4px;
    margin-left: 8px;
}

/* Order Note Icon */
.order-note-icon {
    margin-right: 4px;
    font-size: 12px;
    color: #667eea;
    cursor: help;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    vertical-align: middle;
}

.order-note-icon:hover {
    opacity: 1;
    color: #4a5568;
}

/* Custom Tooltip */
.custom-tooltip {
    position: fixed;
    z-index: 10000;
    background: #fff;
    color: #333;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e1e5e9;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    word-wrap: break-word;
    white-space: normal;
}

.custom-tooltip::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #fff;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

.custom-tooltip::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #e1e5e9;
}

.sub-services {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}



/* Patient Name Styling */
.patient-name {
    font-weight: 600;
    color: #2c3e50;
}

/* Date Styling */
.order-date-time {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #666;
}

.order-date-date {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    font-family: inherit;
    direction: ltr;
    text-align: center;
}
