* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #e8ecef;
    min-height: 100vh;
    padding: 20px;
    color: #2c3e50;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: #2c3e50;
    color: white;
    padding: 30px;
    text-align: center;
    border-bottom: 4px solid #3498db;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

main {
    padding: 30px;
}

.form-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

.form-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
}

.section-description {
    color: #6c757d;
    font-size: 0.9em;
    margin-bottom: 15px;
    font-style: italic;
}

/* Secciones de partes */
.parte-seccion {
    border: 2px solid #3498db;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.1);
}

.parte-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.parte-header h2 {
    margin: 0;
    flex: 1;
}

.btn-edit-parte {
    background: #f39c12;
    color: white;
    border: none;
    border-radius: 8px;
    width: 35px;
    height: 35px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-edit-parte:hover {
    background: #e67e22;
    transform: scale(1.1);
}

.btn-remove-parte {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    width: 35px;
    height: 35px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-remove-parte:hover {
    background: #c82333;
    transform: scale(1.1);
}

.sub-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid #3498db;
}

.sub-section h3 {
    color: #495057;
    font-size: 1.1em;
    margin-bottom: 15px;
    font-weight: 600;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 0.95em;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Estilo general para inputs de archivo */
.form-group input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.95em;
    background: #fff;
}

/* Campo de costo calculado */
.costo-display {
    padding: 12px;
    background: #e8f5e9;
    border: 2px solid #27ae60;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: 700;
    color: #27ae60;
    text-align: center;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Repuestos */
.repuestos-container {
    margin-bottom: 15px;
}

.repuesto-item {
    display: grid;
    grid-template-columns: 1.8fr 1.8fr 0.7fr 1fr 1fr 0.9fr auto;
    gap: 8px;
    margin-bottom: 10px;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.repuesto-item input,
.repuesto-item select {
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.95em;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.repuesto-selector {
    background: white;
    cursor: text;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Contenedor de autocompletado */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #3498db;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.autocomplete-list.active {
    display: block;
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: #e7f3ff;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 3px;
}

.autocomplete-item-details {
    font-size: 0.85em;
    color: #6c757d;
}

.autocomplete-item-price {
    color: #27ae60;
    font-weight: 600;
}

.repuesto-nombre[readonly],
.repuesto-codigo[readonly] {
    background: #f8f9fa;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.repuesto-precio {
    text-align: right;
}

.repuesto-subtotal {
    padding: 10px;
    background: #e8f5e9;
    border: 2px solid #27ae60;
    border-radius: 8px;
    font-weight: bold;
    color: #27ae60;
    text-align: center;
    font-size: 0.9em;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.costo-repuestos-total {
    margin-top: 15px;
    padding: 15px;
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    text-align: center;
    font-size: 1.1em;
}

.costo-repuestos-total strong {
    color: #856404;
}

.costo-repuestos-total span {
    color: #27ae60;
    font-size: 1.2em;
}

.btn-add-custom {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-add-custom:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-remove {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove:hover {
    background: #c82333;
    transform: scale(1.1);
}

.btn-add {
    background: #27ae60;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-add:hover {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.btn-save {
    background: #3498db;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.btn-save:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.4);
}

/* Imágenes */
.image-preview {
    margin-top: 15px;
    display: none;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    border: 2px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.image-preview.active {
    display: block;
}

/* Partes Guardadas */
.parte-guardada-card {
    background: white;
    border: 2px solid #27ae60;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.parte-guardada-card:hover {
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.2);
    transform: translateY(-2px);
    border-color: #229954;
}

.parte-guardada-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.parte-guardada-header h3 {
    color: #27ae60;
    margin: 0;
    font-size: 1.3em;
}

.parte-fecha {
    color: #6c757d;
    font-size: 0.85em;
    font-style: italic;
}

.parte-guardada-info {
    color: #495057;
    font-size: 0.95em;
    line-height: 1.6;
}

.parte-guardada-info p {
    margin-bottom: 8px;
}

.parte-guardada-info strong {
    color: #333;
}

/* Botones de Acción */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    min-width: 200px;
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: #3498db;
    color: white;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background: #7f8c8d;
    color: white;
    box-shadow: 0 2px 8px rgba(127, 140, 141, 0.2);
}

.btn-secondary:hover {
    background: #95a5a6;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(127, 140, 141, 0.3);
}

.btn-save-local {
    flex: 1;
    min-width: 200px;
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #27ae60;
    color: white;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.2);
}

.btn-save-local:hover {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(39, 174, 96, 0.4);
}

/* Sección de Proyectos Guardados */
.proyectos-section {
    margin-top: 30px;
}

.proyectos-list {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

.proyecto-card {
    background: white;
    border: 2px solid #3498db;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.proyecto-card:hover {
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
    transform: translateY(-2px);
    border-color: #2980b9;
}

.proyecto-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.proyecto-info h3 {
    color: #3498db;
    margin: 0 0 5px 0;
    font-size: 1.2em;
}

.proyecto-meta {
    color: #6c757d;
    font-size: 0.9em;
    margin: 3px 0;
}

.proyecto-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.btn-proyecto {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cargar {
    background: #3498db;
    color: white;
}

.btn-cargar:hover {
    background: #2980b9;
    transform: scale(1.05);
}

.btn-editar {
    background: #f39c12;
    color: white;
}

.btn-editar:hover {
    background: #e67e22;
    transform: scale(1.05);
}

.btn-eliminar-proyecto {
    background: #dc3545;
    color: white;
}

.btn-eliminar-proyecto:hover {
    background: #c82333;
    transform: scale(1.05);
}

.proyecto-vacio {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
}

footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-size: 0.9em;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }

    main {
        padding: 20px;
    }

    .form-section {
        padding: 20px;
    }

    .repuesto-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .repuesto-item > * {
        grid-column: 1;
        width: 100%;
    }
    
    .repuesto-item input,
    .repuesto-item select {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-section {
    animation: fadeIn 0.5s ease-out;
}

.parte-guardada-card {
    animation: fadeIn 0.3s ease-out;
}

