/* ─── CSV IMPORT PREVIEW DESIGN (ZENITH EQUITY) ─── */

.ze-csv-preview-container {
    padding: var(--ze-space-xl, 32px);
    background-color: var(--ze-color-surface-container-lowest, #ffffff);
    border: var(--ze-border-default, 1px solid #E2E8F0);
    border-radius: var(--ze-radius-lg, 16px);
    box-shadow: var(--ze-shadow-level-1, 0px 4px 6px -1px rgba(15, 23, 42, 0.03));
    margin-bottom: var(--ze-space-xl, 32px);
}

.ze-csv-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--ze-space-md, 16px);
    margin-bottom: var(--ze-space-xl, 32px);
    border-bottom: 1px dashed var(--ze-color-outline-variant, #E2E8F0);
    padding-bottom: var(--ze-space-md, 16px);
}

.ze-csv-header-content {
    flex: 1;
}

.ze-csv-preview-provider-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--ze-color-surface-container-low, #f8fafc);
    border: 1px solid var(--ze-color-outline-variant, #e2e8f0);
    border-radius: var(--ze-radius-md, 12px);
    padding: 6px;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.ze-csv-preview-provider-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--ze-radius-sm, 6px);
}

.ze-csv-preview-header h2 {
    font-family: var(--ze-font-headline-lg-family, Geist, sans-serif);
    font-size: var(--ze-font-headline-lg-size, 28px);
    font-weight: 700;
    color: var(--ze-color-on-background, #0b1c30);
    margin: 0 0 var(--ze-space-xs, 8px) 0;
}

.ze-csv-preview-header p {
    color: var(--ze-color-on-surface-variant, #64748b);
    font-size: 15px;
    margin: 0;
}

.ze-csv-preview-section {
    margin-bottom: var(--ze-space-xl, 32px);
}

.ze-csv-preview-section h3 {
    font-family: var(--ze-font-headline-sm-family, Geist, sans-serif);
    font-size: var(--ze-font-headline-sm-size, 20px);
    font-weight: 600;
    color: var(--ze-color-on-background, #0b1c30);
    margin: 0 0 var(--ze-space-md, 16px) 0;
}

.ze-csv-preview-section .description {
    font-size: 14px;
    color: var(--ze-color-on-surface-variant, #64748b);
    margin: -8px 0 16px 0;
}

/* Premium Alert Boxes */
.ze-csv-preview-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: var(--ze-space-md, 16px);
    border-radius: var(--ze-radius-md, 12px);
    margin-bottom: var(--ze-space-lg, 24px);
    font-size: 15px;
    line-height: 1.5;
}

.ze-csv-preview-alert.success {
    background-color: rgba(0, 108, 73, 0.06);
    border: 1px solid rgba(0, 108, 73, 0.2);
    color: var(--ze-color-secondary, #006c49);
}

.ze-csv-preview-alert.success span {
    color: var(--ze-color-secondary, #006c49);
}

.ze-csv-preview-alert.error {
    background-color: rgba(186, 26, 26, 0.06);
    border: 1px solid rgba(186, 26, 26, 0.2);
    color: var(--ze-color-error, #ba1a1a);
}

.ze-csv-preview-alert.error span {
    color: var(--ze-color-error, #ba1a1a);
}

/* Table Design */
.ze-csv-preview-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--ze-space-lg, 24px);
}

.ze-csv-preview-table th {
    background-color: var(--ze-color-surface-container-low, #f8fafc);
    color: var(--ze-color-on-surface-variant, #475569);
    font-family: var(--ze-font-label-sm-family, Geist, sans-serif);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    border-bottom: 2px solid var(--ze-color-outline-variant, #E2E8F0);
    text-align: left;
}

.ze-csv-preview-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--ze-color-outline-variant, #f1f5f9);
    vertical-align: middle;
    color: var(--ze-color-on-surface, #0b1c30);
    font-size: 14px;
}

.ze-csv-preview-table tr:hover {
    background-color: var(--ze-color-surface-container-lowest, #fafafa);
}

.ze-csv-preview-table tr.ze-row-empty-source-dest {
    background-color: rgba(217, 119, 6, 0.09);
}

.ze-csv-preview-table tr.ze-row-empty-source-dest:hover {
    background-color: rgba(217, 119, 6, 0.16);
}

.ze-csv-preview-table tr.ze-row-empty-source-dest td:first-child {
    box-shadow: inset 6px 0 0 0 #d97706;
}

/* Form inputs & dropdowns */
.ze-preview-input,
.ze-preview-select {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border-radius: var(--ze-radius-sm, 6px);
    border: 1px solid var(--ze-color-outline-variant, #cbd5e1);
    background-color: #ffffff;
    color: var(--ze-color-on-surface, #0b1c30);
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.ze-preview-input:focus,
.ze-preview-select:focus {
    outline: none;
    border-color: var(--ze-color-primary, #006c49);
    box-shadow: 0 0 0 3px rgba(0, 108, 73, 0.1);
}

.ze-preview-input.datetime-input {
    font-family: monospace;
    font-size: 13px;
    max-width: 180px;
}

.ze-preview-input.amount-input {
    font-weight: 700;
    max-width: 120px;
}

/* Badges for read-only state */
.ze-csv-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--ze-radius-full, 9999px);
    background-color: var(--ze-color-surface-container, #f1f5f9);
    color: var(--ze-color-on-surface-variant, #475569);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ze-csv-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--ze-radius-full, 9999px);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ze-csv-type-badge.type-buy {
    background-color: rgba(56, 189, 248, 0.08);
    color: #0284c7;
}

.ze-csv-type-badge.type-sell {
    background-color: rgba(74, 222, 128, 0.08);
    color: #16a34a;
}

.ze-csv-type-badge.type-dividend {
    background-color: rgba(45, 212, 191, 0.08);
    color: #0d9488;
}

.ze-csv-type-badge.type-income {
    background-color: rgba(34, 197, 94, 0.08);
    color: #15803d;
}

.ze-csv-type-badge.type-expense {
    background-color: rgba(248, 113, 113, 0.08);
    color: #dc2626;
}

.ze-csv-type-badge.type-transfer {
    background-color: rgba(148, 163, 184, 0.08);
    color: #475569;
}

/* Color codes on amount cell */
.amount-cell.type-income,
.amount-cell.type-dividend,
.amount-cell.type-sell {
    color: var(--ze-color-secondary, #006c49);
}

.amount-cell.type-expense,
.amount-cell.type-buy {
    color: var(--ze-color-error, #ba1a1a);
}

.amount-cell.type-transfer {
    color: var(--ze-color-on-background, #0b1c30);
}

.ze-csv-preview-empty {
    padding: var(--ze-space-lg, 24px);
    text-align: center;
    background-color: var(--ze-color-surface-container-low, #f8fafc);
    border: 1px dashed var(--ze-color-outline-variant, #E2E8F0);
    border-radius: var(--ze-radius-md, 12px);
    color: var(--ze-color-on-surface-variant, #64748b);
    font-size: 15px;
}

/* Responsive Table Wrapper */
.ze-table-responsive {
    width: 100%;
    margin-bottom: var(--ze-space-lg, 24px);
}

@media (max-width: 1024px) {
    .ze-table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}


/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ze-csv-preview-container {
        padding: var(--ze-space-md, 16px);
    }

    .ze-preview-input.datetime-input,
    .ze-preview-input.amount-input {
        max-width: 100%;
    }
}

/* Custom Dropdown & Search Input overrides inside CSV Preview */
.ze-csv-preview-container .tv-choice-wrap {
    width: 100% !important;
    margin: 0 !important;
}

.ze-csv-preview-container .tv-search-input {
    padding: 0 16px !important;
}

/* Search Input inside Custom Dropdown Options */
.tv-dropdown-search-wrap {
    padding: 8px 12px;
    border-bottom: 1px dashed var(--ze-color-outline-variant, #E2E8F0);
    background-color: var(--ze-color-surface-container-lowest, #ffffff);
}

.tv-dropdown-search-input {
    width: 100% !important;
    height: 32px !important;
    padding: 0 8px !important;
    border-radius: var(--ze-radius-sm, 4px) !important;
    border: 1px solid var(--ze-color-outline-variant, #cbd5e1) !important;
    background-color: var(--ze-color-surface-container-lowest, #ffffff) !important;
    color: var(--ze-color-on-surface, #0b1c30) !important;
    font-size: 13px !important;
    box-sizing: border-box !important;
    outline: none !important;
    transition: border-color 0.2s ease;
}

.tv-dropdown-search-input:focus {
    border-color: var(--ze-color-secondary, #006c49) !important;
    box-shadow: 0 0 0 2px rgba(0, 108, 73, 0.1) !important;
}

/* Amount Input Group with Prefix & Suffix */
.ze-amount-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.ze-amount-prefix {
    font-weight: 700;
    font-size: 16px;
    width: 14px;
    text-align: center;
    transition: color 0.2s ease;
}

.ze-amount-input-group.type-income .ze-amount-prefix,
.ze-amount-input-group.type-dividend .ze-amount-prefix,
.ze-amount-input-group.type-sell .ze-amount-prefix {
    color: var(--ze-color-secondary, #006c49);
}

.ze-amount-input-group.type-income .amount-input,
.ze-amount-input-group.type-dividend .amount-input,
.ze-amount-input-group.type-sell .amount-input {
    color: var(--ze-color-secondary, #006c49) !important;
}

.ze-amount-input-group.type-expense .ze-amount-prefix,
.ze-amount-input-group.type-buy .ze-amount-prefix {
    color: var(--ze-color-error, #ba1a1a);
}

.ze-amount-input-group.type-expense .amount-input,
.ze-amount-input-group.type-buy .amount-input {
    color: var(--ze-color-error, #ba1a1a) !important;
}

.ze-amount-input-group.type-transfer .ze-amount-prefix {
    color: var(--ze-color-on-surface-variant, #64748b);
}

.ze-amount-input-group.type-transfer .amount-input {
    color: var(--ze-color-on-surface, #0b1c30) !important;
}

.ze-amount-suffix {
    font-weight: 600;
    font-size: 13px;
    color: var(--ze-color-on-surface-variant, #64748b);
    background-color: var(--ze-color-surface-container, #f1f5f9);
    padding: 4px 8px;
    border-radius: var(--ze-radius-sm, 4px);
    text-transform: uppercase;
    min-width: 42px;
    text-align: center;
}

/* Tooltip styling for Partner/Contact Descriptions list */
.ze-company-tooltip-wrap {
    position: relative;
    display: inline-block;
    margin-left: 8px;
    cursor: pointer;
    vertical-align: middle;
}

.ze-company-tooltip-icon {
    font-size: 11px;
    color: var(--ze-color-primary, #006c49);
    background: rgba(0, 108, 73, 0.1);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    user-select: none;
    transition: all 0.2s ease;
}

.ze-company-tooltip-wrap:hover .ze-company-tooltip-icon {
    background-color: var(--ze-color-primary, #006c49);
    color: #ffffff;
}

.ze-company-tooltip-content {
    visibility: hidden;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1e293b; /* Dark Slate */
    color: #f8fafc; /* Light Slate */
    text-align: left;
    padding: 10px 14px;
    border-radius: var(--ze-radius-md, 8px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.25), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    border: 1px solid #334155;
    z-index: 1000;
    width: max-content;
    max-width: 480px;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 12px;
    font-weight: normal;
}

.ze-company-tooltip-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.ze-company-tooltip-wrap:hover .ze-company-tooltip-content {
    visibility: visible;
    opacity: 1;
}

.ze-company-tooltip-content strong {
    display: block;
    margin-bottom: 6px;
    color: #ffffff;
    font-size: 12px;
}

.ze-company-tooltip-content ul {
    margin: 0;
    padding-left: 16px;
    list-style-type: disc;
}

.ze-company-tooltip-content li {
    margin-bottom: 4px;
    color: #cbd5e1; /* Light gray text */
    word-break: break-word;
    line-height: 1.4;
}

/* Tooltip styling for Transaction Descriptions column */
.ze-transaction-description-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.ze-description-tooltip-content {
    visibility: hidden;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1e293b; /* Dark Slate */
    color: #f8fafc; /* Light Slate */
    padding: 8px 12px;
    border-radius: var(--ze-radius-sm, 4px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #334155;
    z-index: 1000;
    min-width: 180px;
    max-width: 280px;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 11px;
    font-weight: normal;
    pointer-events: auto;
    word-break: break-word;
    text-align: left;
    line-height: 1.4;
}

.ze-transaction-description-wrap:hover .ze-description-tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Tooltip styling for Transaction Details (Stückzahl & Kurs) */
.ze-details-tooltip-wrap {
    position: relative;
    display: inline-block;
    cursor: pointer;
    vertical-align: middle;
}

.ze-details-tooltip-icon {
    font-size: 11px;
    color: var(--ze-color-secondary, #006c49);
    background: rgba(0, 108, 73, 0.1);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    user-select: none;
    transition: all 0.2s ease;
}

.ze-details-tooltip-wrap:hover .ze-details-tooltip-icon {
    background-color: var(--ze-color-secondary, #006c49);
    color: #ffffff;
}

.ze-details-tooltip-content {
    visibility: hidden;
    position: absolute;
    bottom: 125%;
    right: 0;
    background-color: #1e293b; /* Dark Slate */
    color: #f8fafc; /* Light Slate */
    text-align: left;
    padding: 10px 14px;
    border-radius: var(--ze-radius-md, 8px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.25), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    border: 1px solid #334155;
    z-index: 1000;
    width: max-content;
    max-width: 320px;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 12px;
    font-weight: normal;
}

.ze-details-tooltip-wrap:hover .ze-details-tooltip-content {
    visibility: visible;
    opacity: 1;
}

.ze-details-tooltip-content div {
    margin-bottom: 4px;
}

.ze-details-tooltip-content div:last-child {
    margin-bottom: 0;
}

.ze-details-tooltip-content strong {
    color: #ffffff;
}

/* Fees input custom width */
.ze-preview-input.fees-input {
    font-weight: 500;
    max-width: 90px;
}

/* Orange colored fees when higher than zero */
.fees-cell.has-fees {
    color: #d97706 !important; /* Premium Amber/Orange */
}

.ze-fees-input-group.has-fees .fees-input {
    color: #d97706 !important; /* Premium Amber/Orange */
}

/* Product Stands Forecast (Prognose) */
.ze-stand-timestamp-cell {
    font-size: 13px;
    color: var(--ze-color-on-surface-variant, #64748b);
}

.ze-stand-delta-cell {
    text-align: right;
    font-weight: 600;
}

.ze-stand-delta-cell.positive {
    color: var(--ze-color-secondary, #006c49);
}

.ze-stand-delta-cell.negative {
    color: var(--ze-color-error, #ba1a1a);
}

.ze-stand-new-val-cell {
    text-align: right;
    font-weight: 700;
    color: var(--ze-color-on-background, #0b1c30);
}

/* Tooltip styling for Transaction Datetime column */
.ze-transaction-datetime-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.ze-datetime-tooltip-content {
    visibility: hidden;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1e293b; /* Dark Slate */
    color: #f8fafc; /* Light Slate */
    padding: 8px 12px;
    border-radius: var(--ze-radius-sm, 4px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #334155;
    z-index: 1000;
    min-width: 150px;
    max-width: 250px;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 11px;
    font-weight: normal;
    pointer-events: auto;
    word-break: break-word;
    text-align: left;
    line-height: 1.4;
}

.ze-transaction-datetime-wrap:hover .ze-datetime-tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Read-only preview table inputs and dropdowns overrides */
.ze-csv-preview-table.read-only input {
    cursor: default;
}

.ze-csv-preview-table.read-only .tv-custom-dropdown {
    cursor: default;
    pointer-events: none;
}

/* Tooltip hover bridge to close the small gap between trigger and content */
.ze-description-tooltip-content::after,
.ze-details-tooltip-content::after,
.ze-datetime-tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 12px;
    background: transparent;
    pointer-events: auto;
}

/* Hover bridge for company tooltip (positioned on the wrapper to avoid overflow clipping) */
.ze-company-tooltip-wrap:hover::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 16px;
    background: transparent;
    pointer-events: auto;
    z-index: 1001;
}