/* Reset y estilos básicos */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Container principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Encabezado */
h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

h2 {
    color: #34495e;
    margin-bottom: 20px;
}

h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

/* Navegación */
.nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-link {
    text-decoration: none;
    color: #7f8c8d;
    padding: 10px 20px;
    border-radius: 5px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background-color: #3498db;
    color: white;
}

/* Formulario */
.form-container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.quote-form {
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

small {
    color: #7f8c8d;
    font-size: 14px;
    display: block;
    margin-top: 5px;
}

/* Botones */
.btn-calculate,
.btn,
.btn-primary,
.btn-secondary,
.btn-print {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-calculate {
    width: 100%;
    font-size: 18px;
    padding: 18px;
    margin-top: 20px;
}

.btn:hover,
.btn-calculate:hover,
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

.btn-print {
    background: linear-gradient(135deg, #27ae60, #229954);
}

.btn-search {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    padding: 12px 20px;
}

.btn-clear {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    padding: 12px 20px;
}

.btn-mini {
    padding: 8px 15px;
    font-size: 14px;
    margin: 0 5px;
}

.btn-view {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.btn-duplicate {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

/* Panel de información */
.info-panel {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.info-panel h3 {
    color: #ecf0f1;
    margin-bottom: 15px;
}

.info-panel ul {
    list-style: none;
}

.info-panel li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.info-panel li:last-child {
    border-bottom: none;
}

/* Resultados de cotización */
.result-container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.quote-header {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
    margin-bottom: 30px;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.details-section,
.costs-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.details-section ul {
    list-style: none;
}

.details-section li {
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
}

.cost-breakdown {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #ecf0f1;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #ecf0f1;
}

.cost-item:last-child {
    border-bottom: none;
}

.cost-item.subtotal {
    border-top: 2px solid #bdc3c7;
    margin-top: 15px;
    padding-top: 15px;
}

.cost-item.profit {
    color: #27ae60;
}

.cost-item.total {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    margin: 15px -20px -20px;
    padding: 20px;
    border-radius: 0 0 8px 8px;
}

.cost-value {
    font-weight: 600;
    font-size: 16px;
}

.total-price {
    font-size: 24px;
    color: #f1c40f;
}

.calculation-details {
    background: #ecf0f1;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.calculation-details ul {
    list-style: none;
}

.calculation-details li {
    padding: 8px 0;
    font-family: 'Courier New', monospace;
    background: white;
    padding: 10px;
    margin: 5px 0;
    border-radius: 5px;
}

.notes-section {
    background: #fff3cd;
    border: 2px solid #ffeaa7;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Historial */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    color: #7f8c8d;
    font-size: 14px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: #2c3e50;
    margin: 0;
}

.search-container {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.search-form {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
}

.quotes-container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.quotes-list {
    display: grid;
    gap: 20px;
}

.quote-card {
    border: 2px solid #ecf0f1;
    border-radius: 12px;
    padding: 25px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.quote-card:hover {
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.2);
}

.quote-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dee2e6;
}

.quote-date {
    color: #7f8c8d;
    font-size: 14px;
}

.quote-info {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    margin-bottom: 15px;
}

.quote-details p {
    margin: 5px 0;
}

.quote-costs {
    text-align: right;
}

.cost-breakdown-mini {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.cost-breakdown-mini p {
    margin: 2px 0;
}

.quote-total {
    font-size: 18px;
    color: #2c3e50;
}

.quote-notes {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #f39c12;
    margin-bottom: 15px;
    font-style: italic;
}

.quote-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.no-results {
    text-align: center;
    color: #7f8c8d;
    padding: 40px;
}

/* Error */
.error {
    background: #fff5f5;
    border: 2px solid #fed7d7;
    color: #c53030;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 2em;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .quote-info {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .quote-costs {
        text-align: left;
    }

    .search-form {
        flex-direction: column;
    }

    .search-input {
        min-width: 100%;
    }

    .actions {
        flex-direction: column;
    }

    .nav {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .stats-container {
        grid-template-columns: 1fr;
    }

    .stat-number {
        font-size: 2em;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.quote-card {
    animation: fadeIn 0.5s ease-out;
}

/* Impresión */
@media print {
    .nav,
    .actions,
    .quote-actions,
    .search-container {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .result-container,
    .quote-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}