/* Models Management Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    background: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    width: 100%;
    margin: 0;
    padding: 0;
}
/* Left Navigation */
.left-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: white;
    border-right: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    z-index: 100;
}
.btn-link {
    background: none;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    border: none;
    padding: 0;
    color: inherit;
    cursor: pointer;
}

.nav-header {
    border-bottom: 1px solid #e5e5e5;
    background: #fafafa;
}

.nav-header .logo {
    text-align: center;
}

.nav-header .logo img {
    max-width: 100%;
    height: auto;
}

.nav-menu {
    flex: 1;
    padding: 24px 20px;
    overflow-y: hidden;
}

.nav-section h4 {
    color: #6c757d;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    margin-top: 0;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-links li {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #495057;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: #f8f9fa;
    color: #2c3e50;
}

.nav-link.active {
    background: #2c3e50;
    color: white;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-footer {
    padding: 20px;
    border-top: 1px solid #e5e5e5;
    background: #fafafa;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #2c3e50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: #2c3e50;
    font-size: 14px;
    font-weight: 600;
}

.user-role {
    color: #628DCD;
    margin-top: 4px;
    background-color: #E3F4FF;
    padding: 4px 8px;
    border: 1px solid #628dcd5b;
    border-radius: 10px;
    font-size: 12px;
}

.logout-btn {
    width: 100%;
    background: #2c3e50;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.logout-btn:hover {
    background: #34495e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(44, 62, 80, 0.2);
}

/* Main Content */
.main-content {
    margin-left: 280px;
    padding: 24px;
    min-height: 100vh;
    background: #f5f5f5;
    width: calc(100% - 280px);
    display: block;
    box-sizing: border-box;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    margin-left: 0;
}

.page-title {
    color: #2c3e50;
    font-size: 28px;
    font-weight: 500;
    margin: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: #2c3e50;
    color: white;
}

.btn-primary:hover {
    background: #34495e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(44, 62, 80, 0.2);
}

.btn-secondary {
    background: #f8f9fa;
    color: #2c3e50;
    border: 1px solid #e5e5e5;
}

.btn-secondary:hover {
    background: #e9ecef;
}

.btn-save-step {
    height: 60% !important;
    margin-top: 8% !important;
    display: inherit !important;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-loader.active {
    display: inline-block;
}


.btn-lg {
    padding: 10px 16px;
    font-size: 16px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Models Section */
.models-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e5e5;
    overflow: hidden;
    margin: 0;
    width: 100%;
}

.section-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.section-header h2 {
    color: #2c3e50;
    font-size: 20px;
    font-weight: 500;
    margin: 0;
}

.search-container {
    position: relative;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 14px;
    width: 300px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

/* Filter Select */
.filter-select,
#statusFilter {
    padding: 8px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.filter-select:focus,
#statusFilter:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.filter-select:hover,
#statusFilter:hover {
    border-color: #cbd5e0;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

/* Table */
.table-container {
    overflow-x: auto;
    width: 100%;
}

.models-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.models-table th {
    background: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
}

.models-table td {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #495057;
}

.models-table tbody tr:hover {
    background: #f8f9fa;
}

.models-table tbody tr:last-child td {
    border-bottom: none;
}

/* Sites (Chantiers) */
.sites-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e5e5;
    overflow: hidden;
}

.sites-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.sites-table th {
    background: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
    white-space: nowrap;
}

.sites-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #495057;
    vertical-align: middle;
}

.sites-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.sites-table tbody tr:hover {
    background: #f3f6f9;
}

.sites-table td:last-child,
.sites-table th:last-child {
    text-align: left;
}

@media (max-width: 768px) {

    .sites-table th,
    .sites-table td {
        padding: 12px 10px;
        font-size: 13px;
    }
}

/* Action buttons in table */
.table-actions {
    justify-content: flex-end;
    display: flex;
    gap: 14px;
}

.action-btn {
    padding: 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn.view {
    background: #e3f2fd;
    color: #1976d2;
}

.action-btn.edit {
    background: #fff3e0;
    color: #f57c00;
}

.action-btn.delete {
    background: #ffebee;
    color: #d32f2f;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.action-icon {
    width: 16px;
    height: 16px;
}

.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

.btn-icon {
    padding: 8px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    min-width: 36px;
    min-height: 36px;
}

.btn-icon.btn-edit,
.btn-icon.btn-print {
    color: #2c3e50;
}

.btn-icon.btn-edit:hover,
.btn-icon.btn-print:hover {
    background: #e6e6e6;
    color: #1a252f;
}

.btn-icon.btn-delete {
    color: #dc3545;
}

.btn-icon.btn-delete:hover {
    background: #ffebee;
    color: #c82333;
}

.btn-icon svg {
    display: block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

.delete-modal {
    max-width: 400px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.modal-header h3 {
    color: #2c3e50;
    font-size: 20px;
    font-weight: 500;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.modal-close:hover {
    background: #e9ecef;
}

/* Form */
.modal-form {
    padding: 24px;
}

.form-section {
    margin-bottom: 32px;
}

.form-section h4 {
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e5e5;
}

.input-group {
    margin-bottom: 20px;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.input-group label {
    display: block;
    color: #495057;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.input-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Steps Management */
.steps-container {
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    background: #fafafa;
    min-height: 100px;
    padding: 16px;
}

.step-item {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
}

.step-item:last-child {
    margin-bottom: 0;
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
}

.step-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    color: #495057;
}

.step-select:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.btn-remove-step {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-step:hover {
    background: #c82333;
}

.step-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.step-details .input-group {
    margin-bottom: 0;
}

.step-details .input-group label {
    font-size: 13px;
    margin-bottom: 4px;
}

.step-details .input-group input {
    padding: 8px 12px;
    font-size: 14px;
}

/* Price Summary */
.price-summary {
    background: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 20px;
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}

.price-item.total {
    border-top: 1px solid #e5e5e5;
    margin-top: 12px;
    padding-top: 16px;
    font-weight: 600;
    font-size: 16px;
    color: #2c3e50;
}

.price-label {
    color: #495057;
}

.price-value {
    color: #2c3e50;
    font-weight: 600;
}

.price-item.total .price-value {
    color: #28a745;
    font-size: 18px;
}

/* Summary (Récapitulatif) */
.summary-section {
    margin-top: 8px;
}

.summary-content {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 20px 24px;
}

.summary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-item.total {
    border-top: 1px solid #e5e5e5;
    margin-top: 8px;
    padding-top: 14px;
    font-weight: 600;
}

.summary-label {
    color: #495057;
    font-size: 14px;
}

.summary-value {
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 20px;
    border-top: 1px solid #e5e5e5;
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    margin-bottom: 12px;
    color: #495057;
    font-size: 14px;
}

.warning-text {
    color: #dc3545;
    font-weight: 500;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    opacity: 0.5;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state h3 {
    color: #495057;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 24px;
}

/* Responsive */
@media (max-width: 768px) {
    .left-nav {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .left-nav.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 16px;
    }

    .mobile-nav-toggle {
        display: block;
        position: fixed;
        top: 20px;
        left: 20px;
        background: #2c3e50;
        color: white;
        border: none;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        font-size: 20px;
        cursor: pointer;
        z-index: 1000;
        box-shadow: 0 4px 12px rgba(44, 62, 80, 0.3);
    }

    .mobile-nav-toggle:hover {
        background: #34495e;
    }
}

.content-header {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
}

.input-row {
    grid-template-columns: 1fr;
}

.step-fields {
    grid-template-columns: 1fr;
}

.search-input {
    width: 100%;
}

.modal-content {
    margin: 10px;
    max-height: calc(100vh - 20px);
}

.table-container {
    font-size: 12px;
}

.models-table th,
.models-table td {
    padding: 12px 8px;
}

/* Status badges (sober colors) */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge--success {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #c8e6c9;
}

.badge--info {
    background: #e3f2fd;
    color: #1565c0;
    border-color: #bbdefb;
}

.badge--warning {
    background: #fff4e5;
    color: #b26a00;
    border-color: #ffe0b2;
}

.badge--muted {
    background: #f1f3f5;
    color: #495057;
    border-color: #e9ecef;
}

.badge--light {
    background: #f8f9fa;
    color: #6c757d;
    border-color: #e9ecef;
}

/* Highlight running step row */
.row--active {
    background: #f0f7ff;
}

/* Steps dropdown */
.steps-row td {
    background: #f9fafb;
    padding: 0;
    border-bottom: none;
}

.steps-dropdown {
    border-top: 1px solid #e5e5e5;
    padding: 20px;
    background: #fdfdfd;
}

.steps-empty {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}

.step-card {
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 12px;
    background: #fff;
    margin-bottom: 6px;
}

.step-card:last-child {
    margin-bottom: 0;
}

.step-card--active {
    border-color: #bbdefb;
    box-shadow: inset 3px 0 0 #64b5f6;
}

.step-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.step-card__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.step-card__number {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #2c3e50;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.step-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.step-form-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #495057;
}

.step-form-grid input,
.step-form-grid select {
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 10px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}

.form-feedback {
    font-size: 13px;
    min-height: 18px;
    color: #6c757d;
}

.form-feedback--success {
    color: #2e7d32;
}

.form-feedback--error {
    color: #b3261e;
}

.btn-toggle-steps[aria-expanded="true"] {
    background: #e9ecef;
}

.supplement-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid #bbdefb;
    border-radius: 4px;
    color: #1565c0;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.supplement-link:hover {
    background: #e3f2fd;
    border-color: #90caf9;
    color: #0d47a1;
}

.supplement-link:active {
    background: #bbdefb;
    transform: translateY(1px);
}

.supplement-link__icon {
    flex-shrink: 0;
    color: #1565c0;
    transition: transform 0.2s ease;
}

.supplement-link:hover .supplement-link__icon {
    transform: scale(1.1);
}

.supplement-link__text {
    white-space: nowrap;
}

.supplement-link__indicator {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #28a745;
    margin-left: 4px;
    flex-shrink: 0;
}

.supplement-section {
    padding: 8px 0;
}

.supplement-info {
    text-align: right;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .steps-dropdown {
        padding: 16px;
    }

    .step-form-grid {
        grid-template-columns: 1fr;
    }
}