/* 
 * Ant Design Components CSS
 * Consolidated common styles for AutoQuery
 * Priority: Ant Design patterns
 */

/* ===== Ant Design Variables - Aligned with project primary color ===== */
:root {
    --ant-primary-color: #635bff; /* Updated to match project primary */
    --ant-success-color: #52c41a;
    --ant-warning-color: #faad14;
    --ant-error-color: #ff4d4f;
    --ant-info-color: #635bff; /* Updated to match project primary */
    --ant-text-color: rgba(0, 0, 0, 0.85);
    --ant-text-color-secondary: rgba(0, 0, 0, 0.45);
    --ant-disabled-color: rgba(0, 0, 0, 0.25);
    --ant-border-color: #d9d9d9;
    --ant-border-radius: 2px;
    --ant-box-shadow: none; /* Removed all shadows for consistency */
}

/* ===== Ant Design Table Styles ===== */
.ant-table-wrapper {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.ant-table {
    font-size: 14px;
    color: var(--ant-text-color);
    background: #fff;
}

.ant-table-container {
    position: relative;
}

.ant-table-content {
    overflow: auto;
}

.ant-table table {
    width: 100%;
    text-align: left;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-collapse: separate;
    border-spacing: 0;
}

.ant-table-thead > tr > th {
    position: relative;
    color: var(--gray-700);
    font-weight: 500;
    text-align: left;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    transition: background 0.3s ease;
    padding: 16px;
}

.ant-table-tbody > tr > td {
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.3s;
    padding: 16px;
}

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

.ant-table-tbody > tr:last-child > td {
    border-bottom: none;
}

/* Table Links */
.ant-table-link {
    color: var(--primary);
    text-decoration: none;
    outline: none;
    cursor: pointer;
    transition: color 0.3s;
}

.ant-table-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Table Text Secondary */
.ant-table-text-secondary {
    color: var(--gray-600);
}

/* Table Actions */
.ant-table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ant-divider {
    width: 1px;
    height: 14px;
    background: rgba(0, 0, 0, 0.06);
}

/* Fixed Columns */
.ant-table-cell-fix-right {
    position: sticky;
    right: 0;
    background: #fff;
}

.ant-table-tbody > tr:hover > .ant-table-cell-fix-right {
    background: var(--gray-50);
}

/* Empty State */
.ant-empty {
    margin: 32px 0;
    text-align: center;
}

.ant-empty-image {
    height: 40px;
    margin-bottom: 8px;
}

.ant-empty-image svg {
    height: 100%;
    margin: auto;
    opacity: 0.5;
}

.ant-empty-description {
    color: var(--ant-text-color-secondary);
    font-size: 14px;
}

/* ===== Ant Design Card Styles ===== */
.ant-card {
    box-sizing: border-box;
    margin: 0 0 24px;
    padding: 0;
    color: var(--ant-text-color);
    font-size: 14px;
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: none;
}

.ant-card-head {
    min-height: 48px;
    padding: 0 24px;
    color: var(--ant-text-color);
    font-weight: 500;
    font-size: 16px;
    background: transparent;
    border-bottom: 1px solid #f0f0f0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.ant-card-head-wrapper {
    display: flex;
    align-items: center;
    height: 100%;
}

.ant-card-head-title {
    display: inline-block;
    flex: 1;
    padding: 16px 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ant-card-extra {
    margin-left: auto;
    padding: 16px 0;
    color: var(--ant-text-color-secondary);
    font-weight: normal;
    font-size: 14px;
}

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

/* ===== Ant Design Button Styles ===== */
.ant-btn {
    line-height: 1.5715;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    white-space: nowrap;
    text-align: center;
    background-image: none;
    border: 1px solid transparent;
    box-shadow: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
    user-select: none;
    touch-action: manipulation;
    height: 32px;
    padding: 4px 15px;
    font-size: 14px;
    border-radius: var(--radius-md);
    color: var(--ant-text-color);
    background: #fff;
    border-color: #d9d9d9;
}

.ant-btn:hover {
    color: var(--ant-primary-color);
    border-color: var(--ant-primary-color);
}

.ant-btn-primary {
    color: #fff;
    background: var(--ant-primary-color);
    border-color: var(--ant-primary-color);
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);
    box-shadow: none;
}

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

.ant-btn-default {
    background: #fff;
    border-color: #d9d9d9;
}

.ant-btn-danger {
    color: #fff;
    background: var(--ant-error-color);
    border-color: var(--ant-error-color);
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);
    box-shadow: none;
}

.ant-btn-danger:hover {
    color: #fff;
    background: #ff7875;
    border-color: #ff7875;
}

.ant-btn-link {
    color: var(--ant-primary-color);
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.ant-btn-link:hover {
    color: #40a9ff;
    background: transparent;
    border-color: transparent;
}

.ant-btn-lg {
    height: 40px;
    padding: 6.4px 15px;
    font-size: 16px;
    border-radius: var(--radius-md);
}

.ant-btn-sm {
    height: 24px;
    padding: 0 7px;
    font-size: 14px;
    border-radius: var(--radius);
}

.ant-btn-block {
    width: 100%;
}

.ant-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.5;
}

.ant-btn[disabled]:hover {
    color: rgba(0, 0, 0, 0.25);
    background: #f5f5f5;
    border-color: #d9d9d9;
}

/* Button with icon */
.anticon {
    display: inline-block;
    font-style: normal;
    line-height: 0;
    text-align: center;
    vertical-align: -0.125em;
}

.anticon svg {
    display: inline-block;
}

/* ===== Ant Design Tag/Badge Styles ===== */
.ant-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    line-height: 20px;
    white-space: nowrap;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    opacity: 1;
    transition: all 0.3s;
}

.ant-tag-success {
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.ant-tag-processing {
    color: var(--primary);
    background: rgba(99, 91, 255, 0.1);
    border-color: rgba(99, 91, 255, 0.3);
}

.ant-tag-error {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.ant-tag-warning {
    color: var(--warning);
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.3);
}

.ant-tag-default {
    color: var(--gray-700);
    background: var(--gray-100);
    border-color: var(--gray-300);
}

/* ===== Ant Design Modal Styles ===== */
.ant-modal-root {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.ant-modal-mask {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.45);
}

.ant-modal-wrap {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    overflow: auto;
    outline: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ant-modal {
    position: relative;
    width: auto;
    margin: 0 auto;
    padding-bottom: 24px;
}

.ant-modal-content {
    position: relative;
    background-color: #fff;
    background-clip: padding-box;
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: none;
    pointer-events: auto;
}

.ant-modal-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    padding: 0;
    color: rgba(0, 0, 0, 0.45);
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    background: transparent;
    border: 0;
    outline: 0;
    cursor: pointer;
    transition: color 0.3s;
}

.ant-modal-close-x {
    display: block;
    width: 56px;
    height: 56px;
    font-size: 16px;
    font-style: normal;
    line-height: 56px;
    text-align: center;
    text-transform: none;
    text-rendering: auto;
}

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

.ant-modal-header {
    padding: 16px 24px;
    color: var(--ant-text-color);
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.ant-modal-title {
    margin: 0;
    color: var(--ant-text-color);
    font-weight: 500;
    font-size: 16px;
    line-height: 22px;
    word-wrap: break-word;
}

.ant-modal-body {
    padding: 24px;
    font-size: 14px;
    line-height: 1.5715;
    word-wrap: break-word;
}

.ant-modal-footer {
    padding: 10px 16px;
    text-align: right;
    background: transparent;
    border-top: 1px solid #f0f0f0;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.ant-modal-footer .ant-btn + .ant-btn {
    margin-left: 8px;
}

/* ===== Ant Design Alert Styles ===== */
.ant-alert {
    box-sizing: border-box;
    margin: 0;
    padding: 8px 15px;
    color: rgba(0, 0, 0, 0.85);
    font-size: 14px;
    line-height: 1.5715;
    list-style: none;
    position: relative;
    display: flex;
    align-items: center;
    word-wrap: break-word;
    border-radius: 2px;
}

.ant-alert-success {
    background-color: #f6ffed;
    border: 1px solid #b7eb8f;
}

.ant-alert-info {
    background-color: #e6f7ff;
    border: 1px solid #91d5ff;
}

.ant-alert-warning {
    background-color: #fffbe6;
    border: 1px solid #ffe58f;
}

.ant-alert-error {
    background-color: #fff2f0;
    border: 1px solid #ffccc7;
}

.ant-alert-with-description {
    align-items: flex-start;
    padding: 15px 15px 15px 24px;
}

.ant-alert-icon {
    margin-right: 8px;
    font-size: 16px;
}

.ant-alert-content {
    flex: 1;
    min-width: 0;
}

.ant-alert-message {
    color: rgba(0, 0, 0, 0.85);
    font-size: 16px;
}

.ant-alert-description {
    color: rgba(0, 0, 0, 0.65);
    font-size: 14px;
    line-height: 22px;
}

/* ===== Ant Design Progress Styles ===== */
.ant-progress {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    color: rgba(0, 0, 0, 0.85);
    font-size: 14px;
    line-height: 1.5715;
    list-style: none;
    display: inline-block;
}

.ant-progress-line {
    position: relative;
    width: 100%;
    font-size: 14px;
}

.ant-progress-outer {
    display: inline-block;
    width: 100%;
    margin-right: 0;
    padding-right: 0;
}

.ant-progress-inner {
    position: relative;
    display: inline-block;
    width: 100%;
    overflow: hidden;
    vertical-align: middle;
    background-color: #f0f0f0;
    border-radius: 100px;
}

.ant-progress-bg {
    position: relative;
    height: 8px;
    background-color: var(--ant-primary-color);
    border-radius: 100px;
    transition: all 0.4s cubic-bezier(0.08, 0.82, 0.17, 1) 0s;
}

.ant-progress-success-bg {
    background-color: var(--ant-success-color);
}

.ant-progress-text {
    width: 2em;
    margin-left: 8px;
    font-size: 14px;
    line-height: 1;
    white-space: nowrap;
    text-align: left;
    vertical-align: middle;
    word-break: normal;
}

/* ===== Form Styles ===== */
.ant-form-item {
    margin-bottom: 24px;
}

.ant-form-item-label {
    display: inline-block;
    flex-grow: 0;
    overflow: hidden;
    white-space: nowrap;
    text-align: right;
    vertical-align: middle;
}

.ant-form-item-label > label {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 32px;
    color: rgba(0, 0, 0, 0.85);
    font-size: 14px;
}

.ant-form-item-control {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.ant-input {
    box-sizing: border-box;
    margin: 0;
    padding: 4px 11px;
    color: rgba(0, 0, 0, 0.85);
    font-size: 14px;
    line-height: 1.5715;
    background-color: #fff;
    background-image: none;
    border: 1px solid #d9d9d9;
    border-radius: 2px;
    transition: all 0.3s;
    width: 100%;
}

.ant-input:hover {
    border-color: #40a9ff;
}

.ant-input:focus {
    border-color: #40a9ff;
    outline: 0;
    box-shadow: none;
}

.ant-select {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    color: rgba(0, 0, 0, 0.85);
    font-size: 14px;
    font-variant: tabular-nums;
    line-height: 1.5715;
    list-style: none;
    font-feature-settings: 'tnum';
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.ant-select-selector {
    position: relative;
    background-color: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
    width: 100%;
    height: 32px;
    padding: 0 11px;
}

.ant-select:hover .ant-select-selector {
    border-color: #40a9ff;
}

.ant-select-focused .ant-select-selector {
    border-color: #40a9ff;
    outline: 0;
    box-shadow: none;
}

/* ===== Utilities - Removed: Now using Tailwind utilities ===== */
/* Keeping semantic text color classes that use Ant Design variables */
.text-muted { color: var(--gray-500); }
.text-disabled { color: var(--ant-disabled-color); }
.text-success { color: var(--ant-success-color); }
.text-danger { color: var(--ant-error-color); }
.text-warning { color: var(--ant-warning-color); }
.text-info { color: var(--ant-info-color); }

/* Responsive */
@media (max-width: 768px) {
    .ant-table {
        font-size: 12px;
    }
    
    .ant-table-thead > tr > th,
    .ant-table-tbody > tr > td {
        padding: 12px 8px;
    }
    
    .ant-modal-content {
        margin: 16px;
    }
}