/* Reports Section Styles */

.reports-container {
    padding: 0;
}

.reports-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    min-height: 600px;
}

.reports-layout.sidebar-hidden {
    grid-template-columns: minmax(0, 1fr);
}

/* LEFT SIDEBAR */
.reports-sidebar {
    position: sticky;
    top: 20px;
    align-self: start;
}

.reports-layout.sidebar-hidden .reports-sidebar {
    display: none;
}

.reports-sidebar .card {
    padding: 20px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.reports-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.reports-panel-toggle {
    white-space: nowrap;
}

/* Report Type Selection */
.report-types {
    margin-bottom: 24px;
}

.report-group {
    margin-bottom: 20px;
}

.report-group-title {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #e5e7eb;
}

.report-radio-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.report-radio-option:hover {
    background-color: #f3f4f6;
}

.report-radio-option input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
}

.report-radio-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: #2563eb;
}

.report-radio-option span {
    font-size: 14px;
    color: #374151;
}

/* Date Range Controls */
.report-date-controls {
    margin-bottom: 20px;
    padding-top: 16px;
    border-top: 2px solid #e5e7eb;
}

.report-date-controls .form-group {
    margin-bottom: 12px;
}

.report-date-controls label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 6px;
}

.report-date-controls .form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.date-presets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 12px;
}

.date-presets .btn {
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
}

/* Action Buttons */
.report-actions {
    padding-top: 16px;
    border-top: 2px solid #e5e7eb;
}

.report-actions .btn {
    font-size: 14px;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 6px;
}

/* RIGHT PANEL */
.reports-main {
    min-height: 600px;
    min-width: 0;
}

.reports-main .card {
    padding: 0;
}

.reports-main-toolbar {
    display: flex;
    justify-content: flex-start;
    padding: 16px 24px 0;
}

.reports-layout.sidebar-hidden .reports-main-toolbar {
    padding-bottom: 8px;
}

/* Report Header */
.report-header {
    padding: 20px 24px;
    border-bottom: 2px solid #e5e7eb;
    background: #f9fafb;
}

.report-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

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

.report-header-top h3 {
    margin: 0;
}

.report-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.report-header-action-btn {
    white-space: nowrap;
}

.report-metadata {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #6b7280;
}

.report-metadata-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.report-metadata-item strong {
    color: #374151;
}

/* Report Content */
.report-content {
    min-height: 400px;
}

.report-placeholder {
    padding: 40px 20px;
}

.report-results-shell {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.report-table-scroll-top {
    overflow-x: auto;
    overflow-y: hidden;
    height: 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.report-table-scroll-top-inner {
    height: 1px;
}

/* Report Table */
.report-table-container {
    overflow-y: auto;
    overflow-x: auto;
    padding: 0;
    max-height: min(68vh, 900px);
    scrollbar-gutter: stable both-edges;
}

.report-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.report-table-audit {
    min-width: 1280px;
}

.report-table-audit thead th,
.report-table-audit tbody td {
    padding-left: 8px;
    padding-right: 8px;
}

.report-table-audit .audit-col-number {
    min-width: 74px;
    width: 74px;
}

.report-table-audit .audit-col-meta {
    min-width: 92px;
    max-width: 110px;
}

.report-table-audit .audit-col-meta,
.report-table-audit .audit-detail-cell {
    overflow-wrap: anywhere;
}

.report-table-container-audit {
    overflow-x: scroll;
    scrollbar-gutter: stable both-edges;
}

.report-content.report-density-compact .report-table-container {
    max-height: min(74vh, 980px);
}

.report-table thead {
    background-color: #f3f4f6;
    border-bottom: 2px solid #d1d5db;
}

.report-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background-color: #f3f4f6;
    z-index: 10;
}

.report-table thead th.text-right {
    text-align: right;
}

.audit-sort-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: transparent;
    padding: 0;
    color: inherit;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.audit-sort-button:hover,
.audit-sort-button:focus {
    color: #1d4ed8;
}

.audit-sort-button.is-active {
    color: #1d4ed8;
}

.audit-sort-indicator {
    font-size: 11px;
    line-height: 1;
}

.report-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.15s;
}

.report-table tbody tr:hover {
    background-color: #f9fafb;
}

.report-table tbody td {
    padding: 10px 16px;
    color: #1f2937;
}

.report-table tbody td.text-right {
    text-align: right;
    font-family: 'Monaco', 'Courier New', monospace;
}

.report-table tbody td.text-center {
    text-align: center;
}

.report-table-listing-queue .listing-queue-actions-col {
    width: 56px;
    min-width: 56px;
    max-width: 56px;
    text-align: center;
    padding-left: 10px;
    padding-right: 10px;
}

.report-table-listing-queue .listing-queue-actions-col input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    vertical-align: middle;
}

.listing-queue-detail-cell {
    min-width: 220px;
    max-width: 320px;
}

.listing-queue-attribute-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.listing-queue-attribute-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 20px;
    padding: 2px 7px;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.listing-queue-attribute-empty {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    margin-top: 6px;
    padding: 2px 7px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
}

.report-action-btn {
    min-width: 92px;
}

.report-filter-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.report-filter-presets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.report-filter-presets-compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-filter-preset-btn {
    appearance: none;
    border: 1px solid #d7deea;
    background: #f8fafc;
    color: #1f3b63;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.report-filter-preset-btn:hover,
.report-filter-preset-btn:focus {
    background: #eef4ff;
    border-color: #bfd0f3;
    color: #17345c;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
    outline: none;
}

.report-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px 12px;
}

.report-checkbox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
}

.report-checkbox-grid-compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.report-severity-critical {
    box-shadow: inset 0 0 0 1px rgba(185, 28, 28, 0.08);
}

.report-severity-warning {
    box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.12);
}

.report-severity-info {
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.10);
}

.report-status-ok {
    background: #dcfce7;
    color: #166534;
}

.report-status-overlisted {
    background: #fee2e2;
    color: #991b1b;
}

.report-status-underlisted {
    background: #dbeafe;
    color: #1d4ed8;
}

.report-status-keep_live {
    background: #dcfce7;
    color: #166534;
}

.report-status-relist_test {
    background: #fef3c7;
    color: #92400e;
}

.report-status-review_pricing {
    background: #fee2e2;
    color: #991b1b;
}

.report-status-low_priority {
    background: #e5e7eb;
    color: #374151;
}

.report-status-bundle_remainder {
    background: #ede9fe;
    color: #6d28d9;
}

.report-status-not_in_sellersync,
.report-status-missing_sku,
.report-status-inactive_product {
    background: #fef3c7;
    color: #92400e;
}

.audit-subdetail {
    margin-top: 6px;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
}

.audit-subdetail-separator {
    color: #cbd5e1;
    margin: 0 6px;
}

.audit-detail-cell {
    min-width: 130px;
    max-width: 180px;
}

.report-content.report-density-compact .audit-detail-cell {
    min-width: 92px;
    max-width: 110px;
}

.audit-detail-preview {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.audit-detail-preview.audit-detail-preview-compact {
    display: block;
}

.audit-detail-title {
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.audit-detail-title-clamped {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.audit-detail-toggle {
    border: 0;
    background: none;
    padding: 0;
    color: #2563eb;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.audit-detail-toggle:hover,
.audit-detail-toggle:focus {
    color: #1d4ed8;
    text-decoration: underline;
}

.audit-detail-content {
    margin-top: 8px;
}

.report-content.report-density-compact .audit-detail-title-compact-hidden {
    display: none;
}

.audit-qty-cell {
    min-width: 90px;
    position: relative;
}

.audit-qty-toggle {
    display: inline-flex;
    align-items: flex-end;
    border: 0;
    background: transparent;
    padding: 0;
    margin-left: auto;
    color: #2563eb;
    cursor: pointer;
    font: inherit;
    text-decoration: none;
}

.audit-qty-main {
    font-family: 'Monaco', 'Courier New', monospace;
    font-weight: 600;
    color: inherit;
}

.audit-qty-toggle:hover .audit-qty-main,
.audit-qty-toggle:focus .audit-qty-main {
    text-decoration: underline;
}

.audit-qty-breakdown {
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid #bfd0f3;
    border-radius: 10px;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
    text-align: left;
    color: #334155;
    font-size: 12px;
    line-height: 1.45;
    font-family: inherit;
    min-width: 132px;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 6;
}

.audit-qty-breakdown div + div {
    margin-top: 4px;
}

.audit-qty-breakdown strong {
    color: #1e3a8a;
    font-weight: 700;
}

.audit-sticky-col-1,
.audit-sticky-col-2 {
    position: sticky;
    background: inherit;
    z-index: 4;
}

.audit-sticky-col-1 {
    left: 0;
}

.audit-sticky-col-2 {
    left: 124px;
}

.report-table thead .audit-sticky-col-1,
.report-table thead .audit-sticky-col-2 {
    z-index: 11;
    background-color: #f3f4f6;
}

.report-table tbody .audit-sticky-col-1,
.report-table tbody .audit-sticky-col-2 {
    background-color: #fff;
}

.report-table tbody tr:hover .audit-sticky-col-1,
.report-table tbody tr:hover .audit-sticky-col-2 {
    background-color: #f9fafb;
}

.audit-sticky-col-1::after,
.audit-sticky-col-2::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: #e5e7eb;
}

.report-density-toggle-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.report-density-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
}

.report-density-toggle-group .btn.is-active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

/* Profit/Loss Color Coding */
.profit-positive {
    color: #059669;
    font-weight: 600;
}

.profit-negative {
    color: #dc2626;
    font-weight: 600;
}

.margin-good {
    color: #059669;
}

.margin-warning {
    color: #d97706;
}

.margin-poor {
    color: #dc2626;
}

/* Report Totals */
.report-totals {
    padding: 20px 24px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    border-top: 3px solid #2563eb;
}

.report-totals h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: #111827;
}

.totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.total-item {
    background: white;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.total-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.total-value {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    font-family: 'Monaco', 'Courier New', monospace;
}

.total-value.positive {
    color: #059669;
}

.total-value.negative {
    color: #dc2626;
}

/* Loading State */
.report-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6b7280;
}

.report-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

/* Error State */
.report-error {
    padding: 20px 24px;
    background: #fef2f2;
    border-left: 4px solid #dc2626;
    color: #991b1b;
}

.report-error h4 {
    margin: 0 0 8px 0;
    color: #991b1b;
    font-size: 16px;
}

.report-error p {
    margin: 0;
    font-size: 14px;
}

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

.report-empty h4 {
    color: #6b7280;
    margin-bottom: 8px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .reports-layout {
        grid-template-columns: 1fr;
    }

    .reports-sidebar {
        position: static;
    }

    .reports-sidebar .card {
        max-height: none;
    }

    .date-presets {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .report-table {
        font-size: 12px;
    }

    .report-table thead th,
    .report-table tbody td {
        padding: 8px 12px;
    }

    .totals-grid {
        grid-template-columns: 1fr;
    }

    .report-metadata {
        flex-direction: column;
        gap: 8px;
    }

    .audit-sticky-col-2 {
        left: 122px;
    }
}

/* Print Styles */
@media print {
    .reports-sidebar {
        display: none;
    }

    .reports-layout {
        grid-template-columns: 1fr;
    }

    .report-table {
        font-size: 10px;
    }

    .report-table thead th {
        background-color: #f3f4f6 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .profit-positive,
    .profit-negative,
    .margin-good,
    .margin-warning,
    .margin-poor {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Scrollbar Styling for Report Tables */
.report-table-container::-webkit-scrollbar {
    height: 8px;
}

.report-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.report-table-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.report-table-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}
