/**
 * Hedge Module Styles
 * 对冲策略模块样式
 */

/* Container */
.hedge-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.hedge-header {
    margin-bottom: 24px;
}

.hedge-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1f2937;
}

.hedge-nav {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 12px;
}

.hedge-nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.hedge-nav-item:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.hedge-nav-item.active {
    background-color: #eff6ff;
    color: #2563eb;
    font-weight: 500;
}

.hedge-nav-item i {
    font-size: 16px;
}

/* Stats Row */
.hedge-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.hedge-stat-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.hedge-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
}

.hedge-stat-label {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

/* Actions Bar */
.hedge-actions-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

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

.hedge-btn-primary {
    background-color: #2563eb;
    color: #ffffff;
}

.hedge-btn-primary:hover {
    background-color: #1d4ed8;
}

.hedge-btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
}

.hedge-btn-secondary:hover {
    background-color: #e5e7eb;
}

/* Pair Cards */
.hedge-pairs-list,
.hedge-snapshot-list,
.hedge-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hedge-pair-card,
.hedge-snapshot-card,
.hedge-alert-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.hedge-pair-card:hover,
.hedge-snapshot-card:hover,
.hedge-alert-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hedge-pair-card.active {
    border-left: 4px solid #10b981;
}

.hedge-pair-card.inactive {
    border-left: 4px solid #9ca3af;
    opacity: 0.7;
}

.hedge-snapshot-card.needs-rebalance {
    border-left: 4px solid #f59e0b;
}

/* Alert Severity Colors */
.hedge-alert-card.severity-critical {
    border-left: 4px solid #dc2626;
}

.hedge-alert-card.severity-high {
    border-left: 4px solid #f97316;
}

.hedge-alert-card.severity-medium {
    border-left: 4px solid #f59e0b;
}

.hedge-alert-card.severity-low {
    border-left: 4px solid #6b7280;
}

.hedge-alert-card.resolved {
    opacity: 0.6;
}

/* Card Headers */
.hedge-pair-header,
.hedge-snapshot-header,
.hedge-alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #f3f4f6;
    background-color: #fafafa;
}

.hedge-pair-title,
.hedge-snapshot-title,
.hedge-alert-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.hedge-pair-name,
.hedge-snapshot-pair,
.hedge-alert-pair {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.hedge-pair-method,
.hedge-alert-type {
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: #e5e7eb;
    color: #4b5563;
}

.hedge-pair-status,
.hedge-snapshot-badge,
.hedge-alert-severity,
.hedge-alert-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.hedge-pair-status.status-active,
.hedge-alert-status.status-resolved {
    background-color: #d1fae5;
    color: #065f46;
}

.hedge-pair-status.status-inactive {
    background-color: #f3f4f6;
    color: #6b7280;
}

.hedge-snapshot-badge {
    display: flex;
    align-items: center;
    gap: 4px;
}

.hedge-snapshot-badge.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.hedge-alert-severity.severity-critical {
    background-color: #fee2e2;
    color: #991b1b;
}

.hedge-alert-severity.severity-high {
    background-color: #ffedd5;
    color: #9a3412;
}

.hedge-alert-severity.severity-medium {
    background-color: #fef3c7;
    color: #92400e;
}

.hedge-alert-severity.severity-low {
    background-color: #e5e7eb;
    color: #4b5563;
}

.hedge-snapshot-date {
    font-size: 13px;
    color: #6b7280;
}

/* Actions */
.hedge-pair-actions,
.hedge-alert-actions {
    display: flex;
    gap: 8px;
}

.hedge-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background-color: transparent;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.hedge-action-btn:hover {
    background-color: #e5e7eb;
    color: #374151;
}

.hedge-action-btn-danger:hover {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Card Body */
.hedge-pair-body,
.hedge-snapshot-body,
.hedge-alert-body {
    padding: 16px;
}

.hedge-pair-section,
.hedge-snapshot-section {
    margin-bottom: 16px;
}

.hedge-pair-section:last-child,
.hedge-snapshot-section:last-child {
    margin-bottom: 0;
}

.hedge-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hedge-pair-grid,
.hedge-snapshot-grid,
.hedge-alert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.hedge-pair-item,
.hedge-snapshot-item,
.hedge-alert-item {
    display: flex;
    flex-direction: column;
}

.hedge-item-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.hedge-item-value {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
}

.hedge-item-value.hedge-highlight {
    color: #2563eb;
    font-weight: 600;
}

.hedge-item-value.text-success {
    color: #10b981;
}

.hedge-item-value.text-warning {
    color: #f59e0b;
}

.hedge-item-value.text-danger {
    color: #ef4444;
}

.hedge-item-value.text-muted {
    color: #9ca3af;
}

.hedge-item-value.correlation-up {
    color: #10b981;
}

.hedge-item-value.correlation-down {
    color: #ef4444;
}

.hedge-item-value.correlation-neutral {
    color: #6b7280;
}

/* Rebalance Hints */
.hedge-rebalance-hint,
.hedge-rebalance-reason {
    margin-top: 12px;
    padding: 10px 12px;
    background-color: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    font-size: 13px;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Alert Message */
.hedge-alert-message {
    margin-bottom: 12px;
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 6px;
    font-size: 14px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hedge-alert-action {
    margin-top: 12px;
    padding: 10px 12px;
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    font-size: 13px;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Priority Badges */
.priority-high {
    padding: 2px 6px;
    border-radius: 4px;
    background-color: #fee2e2;
    color: #991b1b;
    font-weight: 600;
}

.priority-medium {
    padding: 2px 6px;
    border-radius: 4px;
    background-color: #fef3c7;
    color: #92400e;
    font-weight: 600;
}

.priority-low {
    padding: 2px 6px;
    border-radius: 4px;
    background-color: #e5e7eb;
    color: #4b5563;
    font-weight: 600;
}

/* Card Footer */
.hedge-pair-footer,
.hedge-snapshot-footer,
.hedge-alert-footer {
    padding: 12px 16px;
    border-top: 1px solid #f3f4f6;
    background-color: #fafafa;
}

.hedge-meta {
    font-size: 12px;
    color: #9ca3af;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Empty State */
.hedge-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.hedge-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast:not(.error) {
    background-color: #10b981;
}

.toast.error {
    background-color: #ef4444;
}

.toast.warning {
    background-color: #f59e0b;
}

/* Pair CRUD Modal */
body.hedge-modal-open {
    overflow: hidden;
}

.hedge-modal[hidden] {
    display: none;
}

.hedge-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.hedge-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.hedge-modal-dialog {
    position: relative;
    width: min(880px, 100%);
    max-height: 90vh;
    overflow: auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.hedge-modal-header,
.hedge-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px;
}

.hedge-modal-header {
    border-bottom: 1px solid #e5e7eb;
}

.hedge-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #111827;
}

.hedge-modal-close {
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
}

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

.hedge-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.hedge-form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    color: #374151;
}

.hedge-form-field input,
.hedge-form-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: #ffffff;
}

.hedge-form-field input:focus,
.hedge-form-field select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.hedge-form-checkbox {
    justify-content: end;
}

.hedge-form-checkbox input {
    width: 18px;
    height: 18px;
}

.hedge-modal-footer {
    justify-content: flex-end;
    padding: 20px 0 0;
}

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

    .hedge-pair-grid,
    .hedge-snapshot-grid,
    .hedge-alert-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hedge-actions-bar {
        flex-direction: column;
    }

    .hedge-form-grid {
        grid-template-columns: 1fr;
    }

    .hedge-modal {
        padding: 12px;
    }

    .hedge-modal-header,
    .hedge-modal-body {
        padding: 16px;
    }

    .hedge-pair-title,
    .hedge-snapshot-title,
    .hedge-alert-title {
        flex-direction: column;
        align-items: flex-start;
    }
}
