/* Dashboard Specific Styles */

/* Multi-select dropdown styles */
.multi-select-container {
    position: relative;
    width: 100%;
}

.multi-select-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    min-height: 38px;
    transition: border-color 0.2s;
}

.multi-select-display:hover {
    border-color: #999;
}

.multi-select-display.active {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.multi-select-placeholder {
    color: #999;
    font-size: 14px;
}

.multi-select-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
}

.multi-select-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #667eea;
    color: white;
    border-radius: 4px;
    font-size: 12px;
}

.dropdown-arrow {
    color: #666;
    transition: transform 0.2s;
}

.multi-select-display.active .dropdown-arrow {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-width: 100%;
}

.multi-select-search {
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.multi-select-search input {
    width: 100%;
    padding: 6px 10px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.multi-select-options {
    max-height: 250px;
    overflow-y: auto;
    padding: 4px;
}

.multi-select-option {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 4px;
}

.multi-select-option:hover {
    background: #f5f5f5;
}

.multi-select-option.selected {
    background: #f0f4ff;
}

.multi-select-option input[type="checkbox"] {
    margin-right: 8px;
}

.multi-select-option label {
    cursor: pointer;
    margin: 0;
    flex: 1;
    font-size: 14px;
}

.multi-select-actions {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    border-top: 1px solid #eee;
    gap: 8px;
}

.multi-select-actions button {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
}

.multi-select-actions .btn-primary {
    background: #667eea;
    color: white;
    border: none;
}

.multi-select-actions .btn-primary:hover {
    background: #5a67d8;
}

/* Success button for XLSX download */
.btn-success {
    background: #48bb78;
    color: white;
    border: none;
}

.btn-success:hover {
    background: #38a169;
}

.btn-bulk-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

/* Spinning animation for loading state */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Bulk Actions - Redesigned */
.bulk-actions-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 16px 20px;
    margin-right: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.bulk-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.bulk-selected-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.bulk-selected-info svg {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    padding: 4px;
}

.bulk-selected-count {
    font-size: 14px;
}

.bulk-selected-count strong {
    font-size: 18px;
    font-weight: 700;
}

.bulk-actions-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bulk-status-select {
    min-width: 220px;
    padding: 10px 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

.btn-bulk-apply {
    padding: 10px 24px;
    min-width: 180px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-bulk-apply:hover:not(:disabled) {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-bulk-apply:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-bulk-apply svg {
    width: 18px;
    height: 18px;
}

.btn-bulk-clear {
    padding: 10px 20px;
    min-width: 100px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.btn-bulk-clear:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-bulk-clear svg {
    width: 16px;
    height: 16px;
}

/* Progress Bar Styles */
.bulk-progress-container {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.bulk-progress-info {
    display: flex;
    justify-content: space-between;
    color: white;
    font-size: 14px;
    margin-bottom: 8px;
}

.bulk-progress-bar {
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.bulk-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 12px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.bulk-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.bulk-progress-details {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    color: white;
    font-size: 13px;
}

.progress-success {
    color: #90EE90;
}

.progress-skipped {
    color: #FFE4B5;
}

.progress-failed {
    color: #FFB6C1;
}

.checkbox-column {
    width: 40px;
    text-align: center;
}

.order-checkbox {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

#selectAllOrders {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Stats Section */
.stats-section {
    margin-bottom: 30px;
}

.stats-container,
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--stat-color, var(--gray-300));
}

.stat-card.new-orders::before {
    background: linear-gradient(90deg, #3498db, #2980b9);
}

.stat-card.in-process::before {
    background: linear-gradient(90deg, #f39c12, #e67e22);
}

.stat-card.waiting-supplies::before {
    background: linear-gradient(90deg, #8b5cf6, #7c3aed);
}

.stat-card.ready-ship::before {
    background: linear-gradient(90deg, #27ae60, #229954);
}

.stat-card.urgent::before {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.08);
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: color-mix(in srgb, var(--stat-color, #3498db) 10%, transparent);
}

.stat-card.new-orders .stat-icon {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.stat-card.in-process .stat-icon {
    background: rgba(243, 156, 18, 0.1);
    color: #f39c12;
}

.stat-card.waiting-supplies .stat-icon {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.stat-card.ready-ship .stat-icon {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
}

.stat-card.urgent .stat-icon {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.stat-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-body {
    flex: 1;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 12px;
    color: var(--gray-800);
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.trend-positive {
    color: #27ae60;
    font-weight: 600;
}

.trend-negative {
    color: #e74c3c;
    font-weight: 600;
}

.trend-neutral {
    color: var(--gray-500);
    font-weight: 600;
}

.trend-label {
    color: var(--gray-500);
}

/* Filters Section */
.filters-section {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.filters-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.filter-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 13px;
}

/* Table Section */
.table-section {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.table-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Search Box */
.search-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 300px;
}

.search-icon {
    color: var(--gray-400);
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    transition: var(--transition-base);
}

.search-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Table */
.table-container {
    position: relative;
    min-height: 400px;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
}

.orders-table thead {
    background: var(--gray-50);
}

.orders-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
}

.orders-table tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition-base);
    position: relative;
}

.orders-table tbody tr:hover {
    background: var(--gray-50);
}

.orders-table td {
    padding: 16px;
    vertical-align: middle;
}

/* Order Number */
.order-number {
    font-weight: 600;
    color: var(--secondary-color);
}

/* Customer Info */
.customer-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.customer-name {
    font-weight: 500;
    color: var(--gray-800);
}

.customer-email {
    font-size: 12px;
    color: var(--gray-600);
}

.customer-company {
    font-size: 13px;
    color: var(--gray-700);
    font-style: italic;
}

/* Date Info */
.date-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.date-str {
    font-weight: 500;
    color: var(--gray-800);
}

.days-elapsed {
    font-size: 12px;
    color: var(--gray-600);
}

/* Product Pills */
.product-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.product-pill {
    display: inline-block;
    padding: 4px 8px;
    background: transparent;
    color: var(--gray-800);
    font-size: 16px;
    font-weight: 500;
    border-radius: 12px;
}

/* Step Badge */
.step-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.step-badge svg {
    width: 16px;
    height: 16px;
}

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

.status-new {
    background: #e3f2fd;
    color: #1976d2;
}

.status-processing {
    background: #fff3cd;
    color: #856404;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-base);
}

.btn-icon:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-icon svg {
    width: 16px;
    height: 16px;
    color: var(--gray-600);
}

/* Loading State */
.table-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.table-loading p {
    color: var(--gray-600);
}

/* Empty State */
.table-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--gray-500);
}

.table-empty svg {
    margin-bottom: 16px;
    opacity: 0.3;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    border-top: 1px solid var(--gray-200);
}

.page-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-base);
}

.page-btn:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-size: 14px;
    color: var(--gray-600);
}

/* Order removal animation */
@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

@keyframes highlightSuccess {
    0% {
        outline: 2px solid transparent;
        outline-offset: 0px;
    }
    50% {
        outline: 3px solid #22c55e;
        outline-offset: 2px;
    }
    100% {
        outline: 2px solid transparent;
        outline-offset: 0px;
    }
}

.order-row-removing {
    animation: highlightSuccess 0.6s ease-out;
    background-color: #f0fdf4 !important;
}

.order-row-sliding-out {
    animation: slideOutRight 0.5s ease-in-out forwards;
}

/* Smooth height transition for row removal */
.orders-table tbody tr.collapsing {
    transition: all 0.3s ease-out;
    height: 0 !important;
    opacity: 0;
    transform: scaleY(0);
    overflow: hidden;
}

/* Responsive */
@media (max-width: 1024px) {
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .search-wrapper {
        width: 100%;
    }
    
    .orders-table {
        font-size: 13px;
    }
    
    .orders-table th,
    .orders-table td {
        padding: 8px;
    }
    
    .product-pills {
        max-width: 150px;
    }
}

/* New Status Badge Styles for Better Readability */
.status-badge-readable {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

/* Default status colors with good contrast */
.status-badge-readable.status-new,
.status-badge-readable.status-queued {
    background: #e3f2fd;
    color: #1565c0;
    border-color: #bbdefb;
}

.status-badge-readable.status-processing,
.status-badge-readable.status-on-hold {
    background: #fff3e0;
    color: #ef6c00;
    border-color: #ffcc02;
}

.status-badge-readable.status-in-productie,
.status-badge-readable.status-production {
    background: #f3e5f5;
    color: #7b1fa2;
    border-color: #ce93d8;
}

.status-badge-readable.status-ready,
.status-badge-readable.status-ready-to-ship {
    background: #e8f5e8;
    color: #2e7d32;
    border-color: #a5d6a7;
}

.status-badge-readable.status-completed,
.status-badge-readable.status-delivered {
    background: #e0f2f1;
    color: #00695c;
    border-color: #80cbc4;
}

.status-badge-readable.status-cancelled,
.status-badge-readable.status-failed {
    background: #ffebee;
    color: #c62828;
    border-color: #ef9a9a;
}

.status-badge-readable.status-null {
    background: #dc3545;
    color: white;
    border-color: #bd2130;
    font-weight: bold;
}

/* Source Badge Styles */
.source-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Specific source colors with white text */
.source-badge[style*="#61245B"] {
    color: white !important;
}

.source-badge[style*="#EC8B5D"] {
    color: white !important;
}

/* Sortable Date Column */
.sortable-date {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.sortable-date:hover {
    background-color: rgba(0,0,0,0.05);
}

.sort-icon {
    margin-left: 6px;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.sortable-date:hover .sort-icon {
    opacity: 1;
}

.date-cell {
    white-space: nowrap;
}