/* ============================================
   General Styles
   ============================================ */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    color: #333;
}

/* ============================================
   Header Menu
   ============================================ */
.home-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    padding: 0 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    height: 86px;
}

.home-header .logo h2 {
    margin: 0;
    color: #1890ff;
    font-weight: 700;
}

.home-header-menu-item {
    margin: 0 15px;
    font-size: 15px;
    cursor: pointer;
    font-weight: 500;
}

.home-header-menu-item a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.home-header-menu-item a:hover, .home-header-menu-item span:hover {
    color: #1890ff;
}

.header-menu-container {
    height: 86px;
}

.login-btn span {
    padding: 8px 20px;
    background: #1890ff;
    color: white;
    border-radius: 4px;
    transition: all 0.3s;
}

.login-btn span:hover {
    background: #40a9ff;
    color: white;
    box-shadow: 0 4px 12px rgba(24,144,255,0.3);
}

/* User Info in header */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    padding: 6px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.user-badge:hover {
    color: white !important;
}

.logout-btn {
    padding: 6px 14px;
    background: #ff4d4f;
    color: white !important;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: #ff7875 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(255,77,79,0.3);
}

/* ============================================
   Main Container
   ============================================ */
.main-container {
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.page-subtitle {
    color: #666;
    text-align: center;
    margin-bottom: 30px;
}

/* ============================================
   Upload Box
   ============================================ */
.upload-box {
    border: 2px dashed #d9d9d9;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.3s;
    margin-bottom: 20px;
}

.upload-box:hover {
    border-color: #1890ff;
}

.upload-icon svg {
    width: 48px;
    height: 48px;
    color: #1890ff;
    margin-bottom: 15px;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background-color: #1890ff;
    color: white;
}

.btn-primary:hover {
    background-color: #40a9ff;
}

.btn-success {
    background-color: #52c41a;
    color: white;
    font-size: 16px;
    padding: 10px 24px;
}

.btn-success:hover {
    background-color: #73d13d;
}

.btn-sm {
    font-size: 13px;
    padding: 6px 12px;
}

.btn:disabled {
    background-color: #d9d9d9;
    color: rgba(0,0,0,0.25);
    cursor: not-allowed;
}

.btn-search {
    height: 38px;
    padding: 0 20px;
}

/* ============================================
   Modal Overlay
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.45);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.ant-modal {
    width: 520px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.ant-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: rgba(0,0,0,0.45);
}

.ant-modal-close:hover {
    color: rgba(0,0,0,0.75);
}

.ant-modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
}

.ant-modal-title {
    font-size: 16px;
    line-height: 22px;
}

.ant-modal-body {
    padding: 24px;
}

/* ============================================
   Ant Form Styles
   ============================================ */
.ant-row-flex {
    display: flex;
    flex-wrap: wrap;
    margin: -6px;
}

.ant-col-12 {
    width: 50%;
    padding: 6px;
    box-sizing: border-box;
}

.ant-col-24 {
    width: 100%;
    padding: 6px;
    box-sizing: border-box;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: rgba(0,0,0,0.85);
    font-size: 14px;
}

.ant-form-item-required::before {
    content: "*";
    color: #ff4d4f;
    margin-right: 4px;
}

.ant-input {
    width: 100%;
    padding: 6px 11px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    transition: all 0.3s;
    font-size: 14px;
    box-sizing: border-box;
    height: 34px;
}

select.ant-input {
    background: white;
    cursor: pointer;
}

.ant-input:focus {
    border-color: #40a9ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,0.2);
    outline: none;
}

.ant-input-affix-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.ant-input-suffix {
    position: absolute;
    right: 10px;
    cursor: pointer;
    color: rgba(0,0,0,0.45);
}

.Captcha__ImageWrapper {
    display: flex;
    align-items: center;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    height: 32px;
    padding: 2px;
    overflow: hidden;
}

.Captcha__Image {
    height: 100%;
    width: auto;
    flex-grow: 1;
    object-fit: cover;
}

.ant-btn-icon-only {
    width: 32px;
    height: 100%;
    border: none;
    background: transparent;
    border-left: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.ant-btn-link {
    background: transparent;
    border: none;
    color: #1890ff;
    cursor: pointer;
    padding: 0;
}

/* ============================================
   Progress and Log
   ============================================ */
.progress-container {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #1890ff;
    width: 0%;
    transition: width 0.3s;
}

.log-console {
    margin-top: 20px;
    background: #282c34;
    color: #abb2bf;
    padding: 15px;
    border-radius: 8px;
    height: 200px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 13px;
}

/* ============================================
   Dashboard Styles
   ============================================ */
.dashboard-container {
    max-width: 1400px;
}

.dashboard-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
    background: white;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}

.tab-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: #e8f4ff;
    color: #1890ff;
}

.tab-btn.active {
    background: white;
    color: #1890ff;
    border-bottom-color: #1890ff;
}

.tab-content {
    display: none;
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 24px;
    min-height: 500px;
}

.tab-content.active {
    display: block;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: #1a1a2e;
}

/* Search Panel */
.search-panel {
    background: #fafbfc;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.search-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 16px;
    align-items: end;
}

.form-group-btn {
    display: flex;
    align-items: flex-end;
    padding-bottom: 0;
}

/* Results Panel */
.results-panel {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
}

.results-header {
    background: #fafbfc;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e8e8e8;
    font-size: 14px;
    font-weight: 500;
    color: #666;
}

.results-table-wrapper {
    max-height: 500px;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #bbb;
    text-align: center;
}

.empty-state svg {
    margin-bottom: 16px;
    color: #ddd;
}

.empty-state p {
    font-size: 15px;
    max-width: 400px;
}

/* Invoice Table */
.invoice-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.invoice-table thead {
    background: #fafbfc;
    position: sticky;
    top: 0;
    z-index: 1;
}

.invoice-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e8e8e8;
    white-space: nowrap;
}

.invoice-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}

.invoice-table tbody tr:hover {
    background: #e6f7ff;
}

.invoice-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.invoice-table tbody tr:nth-child(even):hover {
    background: #e6f7ff;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.status-new { background: #e6f7ff; color: #1890ff; }
.status-replace { background: #fff7e6; color: #fa8c16; }
.status-adjust { background: #f6ffed; color: #52c41a; }
.status-cancel { background: #fff1f0; color: #ff4d4f; }

/* ============================================
   Loading Overlay
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255,255,255,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(3px);
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e8e8e8;
    border-top-color: #1890ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-spinner p {
    font-size: 15px;
    color: #555;
    font-weight: 500;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .search-grid {
        grid-template-columns: 1fr;
    }
    
    .home-header {
        padding: 0 15px;
    }
    
    .main-container {
        padding: 20px;
    }
    
    .dashboard-tabs {
        flex-direction: column;
    }

    .results-actions {
        flex-direction: column;
        gap: 5px;
    }
}

/* ============================================
   Additional Button Styles
   ============================================ */
.btn-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: #fff;
    border: none;
}
.btn-warning:hover {
    background: linear-gradient(135deg, #e67e22, #d35400);
    transform: translateY(-1px);
}

.btn-default {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #d9d9d9;
}
.btn-default:hover {
    background: #e8e8e8;
    border-color: #1890ff;
    color: #1890ff;
}
.btn-default:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   Results Actions Bar
   ============================================ */
.results-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.results-header {
    flex-wrap: wrap;
    gap: 8px;
}

/* ============================================
   Pagination Controls
   ============================================ */
.pagination-controls {
    border-top: 1px solid #e8e8e8;
}

.pagination-controls button {
    min-width: 36px;
    transition: all 0.2s;
}

/* ============================================
   Invoice Detail Modal
   ============================================ */
#invoiceDetailModal .ant-modal {
    max-width: 850px;
}

#invoiceDetailModal .ant-modal-body {
    max-height: 65vh;
    overflow-y: auto;
}

#invoiceDetailModal .invoice-table th,
#invoiceDetailModal .invoice-table td {
    padding: 6px 8px;
    font-size: 12px;
}

/* ============================================
   Status Badges
   ============================================ */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.status-success {
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}
.status-danger {
    background: #fff2f0;
    color: #ff4d4f;
    border: 1px solid #ffa39e;
}
.status-warning {
    background: #fffbe6;
    color: #faad14;
    border: 1px solid #ffe58f;
}
.status-default {
    background: #f5f5f5;
    color: #8c8c8c;
    border: 1px solid #d9d9d9;
}

/* ============================================
   Selection Styles
   ============================================ */
.row-selected {
    background-color: #e6f7ff !important;
    border-left: 3px solid #1890ff;
}

.inv-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}
