/* ========================================
   Equipment Catalog - Modern List Page Styles
   Following standard J4 list page patterns
   ======================================== */

/* ========== Container ========== */
.equipment-catalog-container {
    padding: 0;
    width: 100%;
    /* Override the list-page-container overflow-x: hidden that's cutting off content */
    overflow-x: visible !important;
}

/* ========== Catalog Filters - Modern Compact Layout ========== */
.catalog-filters {
    padding: 1rem;
    margin-bottom: 1rem;
}

.catalog-filter-layout {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Date Filter Row - Above the matrix */
.filter-row-date {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
}

/* Filter Matrix - Grid of filters */
.filter-matrix {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Filter Row - Flexbox layout */
.filter-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

/* Filter Field - Equal width in matrix */
.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 180px;
    flex: 0 0 180px;
}

.filter-field-date {
    width: auto;
    flex: 0 0 auto;
}

/* Filter Labels - Compact style */
.catalog-filters .filter-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Filter Inputs - Consistent sizing */
.catalog-filters .filter-input,
.catalog-filters .filter-select {
    width: 100%;
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    border-radius: 4px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.catalog-filters .filter-input:focus,
.catalog-filters .filter-select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px rgba(106, 179, 255, 0.15);
}

/* Checkbox inline with label */
.filter-checkbox-inline {
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Date Range Inline */
.date-range-inline {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.date-range-inline .filter-date-input-sm {
    width: 90px;
    padding: 0.375rem 0.375rem;
    font-size: 0.75rem;
}

.date-separator {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.date-range-disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Filter Actions - Buttons */
.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    margin-left: auto;
    padding-bottom: 2px;
}

.btn-filter-action {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-filter-action:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-filter-action .material-symbols-outlined {
    font-size: 1rem;
    color: #ffc107;
}

.btn-filter-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-filter-reset:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-filter-reset .material-symbols-outlined {
    font-size: 1.125rem;
}

/* Responsive: Tablet */
@media (max-width: 1200px) {
    .filter-field {
        width: 150px;
        flex: 0 0 150px;
    }
}

/* Responsive: Mobile */
@media (max-width: 768px) {
    .filter-row,
    .filter-row-date {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .filter-field {
        width: calc(50% - 0.375rem);
        flex: 0 0 calc(50% - 0.375rem);
    }

    .filter-field-date {
        width: 100%;
        flex: 1 1 100%;
    }

    .filter-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .filter-field {
        width: 100%;
        flex: 1 1 100%;
    }

    .date-range-inline {
        flex-wrap: wrap;
    }

    .date-range-inline .filter-date-input-sm {
        flex: 1;
        width: auto;
    }
}

/* ========== Help Box ========== */
.help-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.help-box-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: none;
    font-size: 0.938rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.help-box-toggle:hover {
    background: var(--bg-hover);
}

.help-box-toggle:hover .help-box-title {
    color: #90CAF9;
}

.help-box-toggle .material-symbols-outlined {
    font-size: 20px;
    color: #6ab3ff;
    flex-shrink: 0;
}

.help-box-title {
    color: #6ab3ff;
    transition: color 0.2s;
}

.help-box-content {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

.help-section {
    margin-bottom: 1.5rem;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
}

.help-icon {
    font-size: 1.25rem;
}

.help-section ul {
    margin: 0;
    padding-left: 1.5rem;
    list-style: disc;
}

.help-section li {
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.help-section li:last-child {
    margin-bottom: 0;
}

.help-section strong {
    color: var(--text-primary);
    font-weight: 600;
}

.help-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.375rem;
    vertical-align: middle;
}

.help-section-highlight {
    background: rgba(255, 152, 0, 0.05);
    border: 1px solid rgba(255, 152, 0, 0.2);
    border-radius: 6px;
    padding: 1rem;
}

.help-section-highlight h4 {
    color: var(--accent);
}

.help-section p {
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0 0 0.75rem 0;
}

.help-section p:last-child {
    margin-bottom: 0;
}

.help-note {
    font-style: italic;
    color: var(--text-primary);
    margin-top: 0.5rem;
}

/* ========== Filter Action Buttons Stacked ========== */
.filter-action-buttons-stacked {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
    width: 100%; /* Take full width of grid cell */
    padding-bottom: 1rem; /* Space below buttons from container border */
}

.filter-action-buttons-stacked button {
    width: 100%;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== Quick Action Buttons ========== */
/* NOTE: Button styles now use the common .btn-interactive-outline class from buttons.css */
.filter-quick-actions {
    grid-column: span 2;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ========== Table Specific Styles ========== */
.equipment-catalog-table {
    min-width: 1400px;
}

.equipment-catalog-table .sortable-header {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    user-select: none;
}

.equipment-catalog-table th {
    cursor: pointer;
}

.equipment-catalog-table th:hover {
    background: var(--bg-hover);
}

/* Column 1: ID (narrow) */
.equipment-catalog-table th:nth-child(1),
.equipment-catalog-table td:nth-child(1) {
    width: 70px;
    max-width: 70px;
}

/* Column 2: Entry Type (narrower, with text wrapping) */
.equipment-catalog-table th:nth-child(2),
.equipment-catalog-table td:nth-child(2) {
    width: 180px;
    max-width: 180px;
    white-space: normal;
    word-wrap: break-word;
}

/* Column 3: Functional Component (wider) */
.equipment-catalog-table th:nth-child(3),
.equipment-catalog-table td:nth-child(3) {
    width: 140px;
    max-width: 140px;
}

/* Column 4: Type (wider than Make/Model) */
.equipment-catalog-table th:nth-child(4),
.equipment-catalog-table td:nth-child(4) {
    width: 160px;
    max-width: 160px;
}

/* Column 5: Make (same as Model) */
.equipment-catalog-table th:nth-child(5),
.equipment-catalog-table td:nth-child(5) {
    width: 140px;
    max-width: 140px;
}

/* Column 6: Model (same as Make) */
.equipment-catalog-table th:nth-child(6),
.equipment-catalog-table td:nth-child(6) {
    width: 140px;
    max-width: 140px;
}

/* Column 7: Files (narrow, centered) */
.equipment-catalog-table th:nth-child(7),
.equipment-catalog-table td:nth-child(7) {
    width: 60px;
    max-width: 60px;
}

/* Column 8: Academy (narrow for Yes/No) */
.equipment-catalog-table th:nth-child(8),
.equipment-catalog-table td:nth-child(8) {
    width: 80px;
    max-width: 80px;
}

/* ========== Entry Type Badge ========== */
.entry-type-badge {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.entry-type-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.25rem; /* Align with first line of text */
}

.entry-type-label {
    font-size: 0.875rem;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.4;
}

/* Entry Type Colors - Match existing legend colors */
.series-type {
    background: rgba(0, 123, 255, 1);
}

.model-type {
    background: rgba(40, 167, 69, 1);
}

.pending-type {
    background: rgba(255, 193, 7, 1);
}

.invalid-type {
    background: rgba(220, 53, 69, 1);
}

.legacy-type {
    background: rgba(108, 117, 125, 1);
}

.unknown-type {
    background: rgba(158, 158, 158, 1);
}

/* ========== Status Icons ========== */
.status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.status-icon .material-symbols-outlined {
    font-size: 18px;
    vertical-align: middle;
}

.status-success {
    color: var(--success-color, #28a745);
}

.status-warning {
    color: var(--warning-color, #ffc107);
}

.status-error {
    color: var(--error-color, #dc3545);
}

/* ========== Legend Container ========== */
.legend-container {
    padding: 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.legend-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.813rem;
    color: var(--text-secondary);
}

.legend-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* Legend dot colors - matching entry type badges */
.legend-box.series-type {
    background: rgba(0, 123, 255, 1);
    border-radius: 50%;
    width: 12px;
    height: 12px;
    border: none;
}

.legend-box.model-type {
    background: rgba(40, 167, 69, 1);
    border-radius: 50%;
    width: 12px;
    height: 12px;
    border: none;
}

.legend-box.pending-type {
    background: rgba(255, 193, 7, 1);
    border-radius: 50%;
    width: 12px;
    height: 12px;
    border: none;
}

.legend-box.invalid-type {
    background: rgba(220, 53, 69, 1);
    border-radius: 50%;
    width: 12px;
    height: 12px;
    border: none;
}

.legend-box.legacy-type {
    background: rgba(108, 117, 125, 1);
    border-radius: 50%;
    width: 12px;
    height: 12px;
    border: none;
}

/* ========== Table Links and Actions ========== */
.table-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.table-link:hover {
    text-decoration: underline;
}

.action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    text-decoration: none;
    transition: all 0.2s;
}

.action-link:hover {
    color: var(--accent-hover);
    transform: scale(1.1);
}

.action-link .material-symbols-outlined {
    font-size: 20px;
}

/* ========== Loading State ========== */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.loading-state .material-symbols-outlined {
    font-size: 48px;
    margin-bottom: 1rem;
    color: var(--accent);
}

.loading-state p {
    font-size: 0.938rem;
    margin: 0;
}

@keyframes rotating {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.rotating {
    animation: rotating 2s linear infinite;
}

/* ========== Empty State ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state .material-symbols-outlined {
    font-size: 64px;
    margin-bottom: 1rem;
    color: var(--text-tertiary);
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.empty-state .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.938rem;
}

.empty-state .btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

/* ========== Filter Checkbox Styling ========== */
.filter-checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0.375rem 0;
}

.filter-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ========== Info Message ========== */
.info-message {
    background: var(--info-bg, rgba(13, 110, 253, 0.1));
    border: 1px solid var(--info-border, rgba(13, 110, 253, 0.3));
    color: var(--info-color, #0d6efd);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* ========== Responsive Adjustments ========== */
@media (max-width: 1024px) {
    .filter-quick-actions {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .legend-items {
        flex-direction: column;
        gap: 0.75rem;
    }

    .equipment-catalog-table {
        font-size: 0.813rem;
    }

    .filter-quick-actions {
        display: none;
    }
}

/* ========== File Count Badge ========== */
.file-count-badge {
    display: inline-block;
    min-width: 24px;
    padding: 0.125rem 0.375rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    text-align: center;
    font-weight: 500;
}

.file-count-has-files {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
}

/* ========== Text Utilities ========== */
.text-center {
    text-align: center !important;
}

.text-right {
    text-align: right !important;
}

.text-left {
    text-align: left !important;
}

/* ========== Submodels Display ========== */
.submodels-cell {
    max-width: 300px;
}

.submodels-list {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.no-submodels {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ========== Make Aliases Display ========== */
.aliases-cell {
    max-width: 250px;
}

.aliases-list {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
    font-style: italic;
}

/* Rotating animation for loading */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.rotating {
    animation: rotate 1s linear infinite;
}

/* ========== Search Button ========== */
.filter-field-search {
    width: auto;
    flex: 0 0 auto;
}

.btn-search {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--accent, #6ab3ff);
    border: 1px solid var(--accent, #6ab3ff);
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    height: 34px;
}

.btn-search:hover:not(:disabled) {
    background: var(--accent-hover, #5aa3ef);
    border-color: var(--accent-hover, #5aa3ef);
}

.btn-search:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-search .material-symbols-outlined {
    font-size: 1.125rem;
}

.btn-search .spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}

/* Small spinner for buttons */
.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}
