/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Layout Principal */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    position: relative;
}

.header h1 {
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    color: #666;
    font-size: 1.1em;
}

.logout-btn {
    position: absolute !important;
    top: 20px;
    right: 20px;
}

/* Login */
.login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    margin: 100px auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.login-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}

/* Navegación */
.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.nav-tab {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-tab.active {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Tabs Content */
.tab-content {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2em;
}

.tab-content h3 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.3em;
}

/* Formularios */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

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

/* Botones */
.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
    font-size: 14px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
}

.btn-secondary:hover {
    box-shadow: 0 10px 20px rgba(149, 165, 166, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.btn-danger:hover {
    box-shadow: 0 10px 20px rgba(231, 76, 60, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.btn-success:hover {
    box-shadow: 0 10px 20px rgba(46, 204, 113, 0.3);
}

/* SKU Display */
.sku-display {
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    font-weight: bold;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #dee2e6;
    text-align: center;
    color: #495057;
}

/* Resumen de Costos */
.cost-summary {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    margin-top: 30px;
    text-align: center;
    box-shadow: 0 15px 30px rgba(46, 204, 113, 0.2);
}

.cost-summary h3 {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: white;
}

.cost-summary .total-cost {
    font-size: 2.5em;
    font-weight: 700;
    margin: 20px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cost-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.cost-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

.cost-item strong {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9em;
}

/* Optimización de Material */
.material-optimization {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    margin-top: 20px;
    box-shadow: 0 15px 30px rgba(52, 152, 219, 0.2);
}

.material-optimization h3 {
    color: white;
    margin-bottom: 20px;
}

.optimization-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.optimization-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

.optimization-item strong {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9em;
}

/* Tablas */
.catalog-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.catalog-table th,
.catalog-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e1e8ed;
}

.catalog-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.catalog-table tr:hover {
    background-color: #f8f9fa;
}

.catalog-table tr:last-child td {
    border-bottom: none;
}

/* Alertas */
.alert {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 500;
    position: relative;
    border-left: 4px solid;
}

.alert-success {
    background-color: rgba(212, 237, 218, 0.9);
    border-color: #28a745;
    color: #155724;
}

.alert-error {
    background-color: rgba(248, 215, 218, 0.9);
    border-color: #dc3545;
    color: #721c24;
}

.alert-info {
    background-color: rgba(209, 236, 241, 0.9);
    border-color: #17a2b8;
    color: #0c5460;
}

.alert-warning {
    background-color: rgba(255, 243, 205, 0.9);
    border-color: #ffc107;
    color: #856404;
}

/* Estados */
.hidden {
    display: none !important;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.slide-in {
    animation: slideIn 0.3s ease-in-out;
}

/* Búsqueda */
.search-container {
    margin-bottom: 20px;
}

.search-input {
    width: 300px;
    padding: 10px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 25px;
    font-size: 14px;
    background: white;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        padding: 15px;
    }
    
    .header {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .logout-btn {
        position: static !important;
        margin-top: 15px;
    }
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-tabs {
        flex-direction: column;
        gap: 5px;
    }
    
    .cost-breakdown {
        grid-template-columns: 1fr;
    }
    
    .optimization-grid {
        grid-template-columns: 1fr;
    }
    
    .catalog-table {
        font-size: 12px;
    }
    
    .catalog-table th,
    .catalog-table td {
        padding: 8px;
    }
    
    .tab-content {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
    
    .cost-summary .total-cost {
        font-size: 2em;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .login-container {
        margin: 50px auto;
        padding: 30px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .catalog-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Impresión */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .header,
    .nav-tabs,
    .btn {
        display: none;
    }
    
    .tab-content {
        background: white;
        box-shadow: none;
        border-radius: 0;
    }
    
    .cost-summary,
    .material-optimization {
        background: #f8f9fa !important;
        color: black !important;
    }
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Efectos adicionales */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}