/*
=================================================================
FILE: modelinfo.css
ROUTE: N/A - Global CSS file
DESCRIPTION: Core styling for model information pages, including navigation, cards, forms, and tables

CHANGELOG:
2025-01-18 16:00 - v2.0: Navigation System Update
- Success: Consolidated navigation styles from multiple sources
- Success: Added mi-nav-header and mi-btn-active classes
- Added responsive flex-wrap for mobile compatibility
- Testing Note: Verified on mobile down to 320px width

2025-01-18 16:30 - v2.1: Style Refinements
- Success: Fixed button spacing in navigation
- Success: Added consistent border-bottom for section separation
- Failed: Attempted gradient backgrounds (removed - caused contrast issues)
- Testing Note: Verified active states meet WCAG contrast requirements

2025-01-18 17:00 - v2.2: Container Optimization
- Success: Adjusted container width to 90vw for better space usage
- Success: Improved responsive breakpoints
- Testing Note: Verified table overflow handling on all screen sizes

DEPENDENCIES:
- No external CSS dependencies
- Uses system fonts for better performance
- Compatible with all modern browsers
=================================================================
*/

/* Base container */
.mi-container {
    max-width: 90vw;
    margin: 0 auto;
    padding: 10px;
}

/* Navigation Header - New Consolidated Style */
.mi-nav-header {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    border: 1px solid #e9ecef;
}

.mi-nav-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Navigation Buttons Styling */
.mi-nav-btn {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    color: #495057;
    background-color: white;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.mi-nav-btn:hover {
    background-color: #e9ecef;
    color: #212529;
}

.mi-nav-btn.active {
    background-color: #4dabf7;
    color: white;
    border-color: #4dabf7;
}

/* Button Styles */
.mi-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
    color: #495057;
    background-color: white;
    transition: all 0.2s ease;
}

.mi-btn:hover {
    background-color: #e9ecef;
    color: #212529;
}

.mi-btn-active {
    background-color: #4dabf7;
    color: white;
    border-color: #4dabf7;
}

.mi-btn-primary {
    background: #4a90e2;
    color: white;
}

.mi-btn-secondary {
    background: #6c757d;
    color: white;
}

.mi-btn-outline {
    background: white;
    border: 1px solid #4a90e2;
    color: #4a90e2;
}

/* Grid and Card Layout */
.mi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.mi-card {
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

/* Form Styling */
.mi-form-group {
    margin-bottom: 15px;
}

.mi-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.mi-form-group input,
.mi-form-group select,
.mi-form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.mi-form-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Table Styling */
.mi-table-responsive {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.mi-table {
    width: 100%;
    border-collapse: collapse;
}

.mi-table th,
.mi-table td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

.mi-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* Status Badges */
.mi-status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-block;
}

/* Search Section */
.mi-search-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mi-search-input {
    width: 300px;
    height: 38px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Action Buttons */
.mi-action-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Header Section */
.mi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Alert Messages */
.mi-alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border: 1px solid transparent;
}

.mi-alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.mi-alert-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Model Info Detail Styles */
.mi-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.mi-tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
}

.mi-tooltip:hover .mi-tooltiptext {
    visibility: visible;
    opacity: 1;
}

.mi-cost-cell {
    text-align: right;
    font-family: monospace;
}

.mi-subsection {
    margin-bottom: 2rem;
    padding: 1rem;
    border: 1px solid #eee;
    border-radius: 4px;
}

.mi-subsection-header {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 1rem;
}

.mi-total-grid {
    display: grid;
    gap: 0.5rem;
    margin-top: 1rem;
}

.mi-total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid #eee;
}

.mi-grand-total {
    font-weight: bold;
    border-top: 2px solid #333;
    margin-top: 0.5rem;
}

/* Horizontal Layout for Tables */
.mi-horizontal-layout {
    display: flex;
    gap: 20px;
    justify-content: space-between;
}

.mi-horizontal-layout > .mi-card {
    flex: 1;
    min-width: 300px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .mi-nav-buttons {
        flex-direction: column;
    }
    
    .mi-btn {
        width: 100%;
        text-align: center;
    }
    
    .mi-horizontal-layout {
        flex-direction: column;
    }
    
    .mi-search-input {
        width: 100%;
    }
}
/* Model Specifications Styling - Add to modelinfo.css */
.mi-spec-division {
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.mi-division-header {
    width: 100%;
    padding: 1rem;
    text-align: left;
    background-color: #f8f9fa;
    border: none;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mi-division-content {
    display: none;
    padding: 1rem;
    background: white;
}

.mi-division-content.active {
    display: block;
}

.mi-division-description {
    color: #6c757d;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.mi-spec-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: start;
}

.mi-spec-row input,
.mi-spec-row select,
.mi-spec-row textarea {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
    color: #212529; /* Add this line to set text color to black */
}

.mi-add-spec-btn {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.mi-add-spec-btn:hover {
    background-color: #357abd;
}
/* Update mi-spec-row to include delete button */
.mi-spec-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr 40px;  /* Added fixed width column for delete */
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: start;
}

.mi-btn-delete {
    padding: 0.25rem 0.5rem;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    height: 36px;  /* Match input height */
    width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.mi-btn-delete:hover {
    background-color: #c82333;
}
/* Filter Section Styling */
.mi-filter-section {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 2rem;
    padding: 1.5rem;
}

.mi-filter-section h3 {
    color: #495057;
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 500;
}

.mi-filter-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 1rem;
}

.mi-checkbox {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.mi-checkbox:hover {
    background-color: #e9ecef;
}

.mi-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 0.75rem;
    cursor: pointer;
}

.mi-checkbox span {
    color: #495057;
    font-size: 0.95rem;
}

/* Update existing mi-spec-row for better alignment */
.mi-spec-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr 40px;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.mi-spec-row:hover {
    background-color: #f8f9fa;
}

/* Header row styling */
.mi-spec-header {
    font-weight: 500;
    color: #495057;
    margin-bottom: 1rem;
    padding: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

/* Improve division toggle button */
.mi-division-toggle {
    font-size: 0.8rem;
    color: #6c757d;
    transition: transform 0.2s ease;
}

.mi-division-content:not(.active) + .mi-division-header .mi-division-toggle {
    transform: rotate(-90deg);
}

/* Enhance form inputs */
.mi-spec-row input:not([disabled]),
.mi-spec-row select,
.mi-spec-row textarea {
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mi-spec-row input:not([disabled]):focus,
.mi-spec-row select:focus,
.mi-spec-row textarea:focus {
    border-color: #4dabf7;
    box-shadow: 0 0 0 2px rgba(77, 171, 247, 0.2);
    outline: none;
}

.mi-spec-row input[disabled] {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* Add loading state */
.mi-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .mi-spec-row {
        grid-template-columns: 2fr 1fr 1fr 1.5fr 40px;
    }
}

@media (max-width: 768px) {
    .mi-filter-options {
        grid-template-columns: 1fr;
        max-height: 200px;
    }

    .mi-spec-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .mi-spec-header {
        display: none;
    }

    .mi-spec-row input,
    .mi-spec-row select,
    .mi-spec-row textarea {
        width: 100%;
    }

    .mi-btn-delete {
        width: 100%;
        height: 36px;
    }
}
/* BOM Table Core Styles */
.mi-bom-container {
    width: 95vw;
    margin: 0 auto;
    padding: 20px;
}

.mi-bom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin: 20px 0;
}

.mi-bom-table th {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    padding: 12px;
    text-align: center;
    font-weight: 600;
}

.mi-bom-table td {
    border: 1px solid #d1d5db;
    padding: 12px;
    text-align: center;
}

.mi-bom-table tr:nth-child(even) {
    background: #f8fafc;
}

.mi-bom-numeric {
    font-family: monospace;
    text-align: right;
    padding-right: 16px !important;
}

.mi-bom-text {
    text-align: left;
    padding-left: 16px !important;
}

.mi-bom-summary {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    padding: 16px;
    margin: 20px 0;
}

.mi-bom-models {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    padding: 16px;
    margin-bottom: 20px;
}
/* Add horizontal scroll for narrow screens */
.mi-bom-wrapper {
    width: 95vw;
    margin: 0 auto;
    overflow-x: auto;
    padding-bottom: 16px;
}

/* Prevent table from collapsing on narrow screens */
.mi-bom-table {
    min-width: 1200px; /* Matches typical desktop width */
}
/* Return to Models button styling */
.mi-btn-return {
    margin-right: auto; /* Pushes other buttons to the right */
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #6c757d;
}

.mi-btn-return:hover {
    background-color: #e9ecef;
    color: #343a40;
}

/* Make sure the navigation buttons container uses flexbox */
.mi-nav-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
