/*
 * Order History V3
 */

.page-content:has(.history-page-v3) nav[aria-label="breadcrumb"],
.page-content:has(.history-page-v3) .page-header {
    display: none;
}

.history-page-v3 {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.hist-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 18px;
    padding: 26px 30px;
    position: relative;
    overflow: hidden;
}

.hist-header::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.hist-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
    gap: 12px;
}

.hist-title {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.hist-title i { font-size: 20px; opacity: 0.9; }

.hist-subtitle {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
    margin: 0;
}

.hist-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.hist-action-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* Filters */
.hist-filters {
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 14px;
    padding: 14px 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.hist-filter-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.hist-filter-group {
    flex: 1;
    min-width: 140px;
}

.hist-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0 12px;
    transition: all 0.2s ease;
}

.hist-search-box:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.hist-search-box i { color: #9ca3af; font-size: 13px; }

.hist-search-box input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 0;
    font-size: 13px;
    font-weight: 500;
    color: #1f2937;
    background: transparent;
}

.hist-search-box input::placeholder { color: #9ca3af; }

.hist-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    appearance: auto;
}

.hist-select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.hist-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.hist-filter-btn:hover {
    background: #4f46e5;
}

.hist-reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #fee2e2;
    color: #dc2626;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
}

.hist-reset-btn:hover {
    background: #fecaca;
    color: #dc2626;
}

/* Table */
.hist-table-wrapper {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
}

.hist-table-container {
    overflow-x: auto;
}

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

.hist-table thead {
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.hist-table thead th {
    padding: 13px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    text-align: left;
    white-space: nowrap;
}

.th-check { width: 40px; text-align: center !important; }

.hist-checkbox {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    cursor: pointer;
    accent-color: #6366f1;
}

.hist-row td {
    padding: 12px 14px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    vertical-align: middle;
}

.hist-row:hover { background: #fafbff; }

.td-check { text-align: center; }
.td-id { font-weight: 700; color: #6366f1; font-family: monospace; }

.td-service .hist-service-name {
    font-weight: 600;
    color: #1f2937;
    display: block;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.td-target .hist-target {
    font-size: 12px;
    color: #6b7280;
    max-width: 160px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.td-price { font-weight: 700; color: #1f2937; white-space: nowrap; }
.td-qty { color: #4b5563; font-weight: 600; text-align: center; }
.td-date { color: #6b7280; font-size: 12px; white-space: nowrap; }

/* Status Badges */
.hist-status-badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
    white-space: nowrap;
}

.status-pending { background: #fef3c7; color: #d97706; }
.status-processing { background: #dbeafe; color: #2563eb; }
.status-success, .status-completed { background: #dcfce7; color: #16a34a; }
.status-partial { background: #ede9fe; color: #7c3aed; }
.status-error, .status-canceled, .status-cancelled { background: #fee2e2; color: #dc2626; }

/* Action Buttons */
.hist-action-group {
    display: flex;
    gap: 6px;
}

.hist-btn-detail {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #6366f1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.hist-btn-detail:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.hist-btn-refill {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.refill-ready {
    background: #dcfce7;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.refill-ready:hover {
    background: #16a34a;
    color: #fff;
}

.refill-wait {
    background: #f3f4f6;
    color: #9ca3af;
    border: 1px solid #e5e7eb;
    cursor: not-allowed;
}

/* Footer */
.hist-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-top: 1px solid #f3f4f6;
    background: #fafbfc;
    flex-wrap: wrap;
    gap: 10px;
}

.hist-result-info {
    font-size: 13px;
    color: #6b7280;
}

.hist-result-info strong { color: #6366f1; }

/* Pagination override */
.hist-pagination .pagination {
    display: flex;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hist-pagination .pagination li a,
.hist-pagination .pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #4b5563;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.hist-pagination .pagination li a:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #6366f1;
}

.hist-pagination .pagination li.active span,
.hist-pagination .pagination li.active a {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

/* Dark Theme */
.dark-theme .hist-filters,
.dark-theme .hist-table-wrapper {
    background: #1e293b;
    border-color: #334155;
}

.dark-theme .hist-search-box { border-color: #334155; }
.dark-theme .hist-search-box input { color: #f1f5f9; }
.dark-theme .hist-select { background: #1e293b; border-color: #334155; color: #e2e8f0; }
.dark-theme .hist-table thead, .dark-theme .hist-table thead th { background: #0f172a; color: #94a3b8; border-color: #334155; }
.dark-theme .hist-row td { border-color: #334155; }
.dark-theme .hist-row:hover { background: #334155; }
.dark-theme .td-service .hist-service-name { color: #f1f5f9; }
.dark-theme .td-price { color: #f1f5f9; }
.dark-theme .hist-table-footer { background: #0f172a; border-color: #334155; }
.dark-theme .hist-btn-detail { background: #334155; border-color: #475569; }
.dark-theme .hist-pagination .pagination li a { background: #334155; border-color: #475569; color: #e2e8f0; }
.dark-theme .hist-header { background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%); }

/* Responsive */
@media (max-width: 768px) {
    .hist-header { padding: 22px 20px; border-radius: 14px; }
    .hist-title { font-size: 20px; }
    .hist-filter-form { flex-direction: column; }
    .hist-filter-group { width: 100%; min-width: auto; }
    .hist-filter-btn { width: 100%; justify-content: center; }
    .hist-table-footer { flex-direction: column; align-items: center; }
}
