/* =============================================
   Estilos globales
   ============================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    color: #1a2332;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* =============================================
   Header y navegación
   ============================================= */
.header {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    padding: 1.25rem 2rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.header .container { display: flex; justify-content: space-between; align-items: center; }

.logo { font-size: 1.5rem; font-weight: 700; }

.nav { display: flex; gap: 0.75rem; align-items: center; }
.user-info { margin-right: 1rem; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 4px);
    background: white; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    padding: 0.75rem; min-width: 160px; z-index: 100;
}

/* =============================================
   Componentes comunes
   ============================================= */
.hidden { display: none !important; }
.btn {
    padding: 0.625rem 1.25rem; border-radius: 8px; border: none; cursor: pointer;
    font-weight: 600; transition: all 0.2s ease; text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem;
}
.btn-primary { background: #4f46e5; color: white; }
.btn-secondary { background: #e5e7eb; color: #1a2332; }
.btn-outline { border: 2px solid rgba(255,255,255,0.8); background: transparent; color: white; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }
.btn-icon { background: transparent; font-size: 1.5rem; line-height: 1; padding: 0.25rem 0.5rem; }

.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
.btn-lg { padding: 1rem 2rem; font-size: 1.125rem; }
.btn-tab { background: #e5e7eb; color: #6b7280; border-radius: 8px 8px 0 0; margin-right: -1px; }
.btn-tab.active { background: white; color: #4f46e5; font-weight: 700; }

/* =============================================
   Formularios y modales
   ============================================= */
.form-container {
    max-width: 480px; margin: 3rem auto; padding: 2.5rem; background: white; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}
.form-container.large { max-width: 1200px; }
.hint { color: #6b7280; font-size: 0.875rem; margin-bottom: 1.5rem; text-align: center; }

.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: #374148; font-weight: 600; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 0.875rem 1rem; border: 2px solid #e5e7eb; border-radius: 8px; font-size: 1rem; transition: all 0.2s ease;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #4f46e5; }

.modal {
    border: none; padding: 0; background: transparent; margin-top: 5vh; width: 100%; max-width: 600px;
}
.modal::backdrop { background: rgba(0,0,0,0.5); }
.modal-content { background: white; border-radius: 12px; padding: 2rem; }
.modal-content header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* =============================================
   Secciones principales
   ============================================= */
.section { padding: 2rem 0; min-height: calc(100vh - 80px); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.toolbar-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
#search-input { padding: 0.625rem 1rem; border: 2px solid #e5e7eb; border-radius: 8px; min-width: 200px; font-size: 0.9rem; }

.filters { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.filter-tag { background: #eef4ff; color: #4f46e5; padding: 0.375rem 0.75rem; border-radius: 20px; font-size: 0.8rem; display: inline-flex; align-items: center; gap: 0.5rem; }

/* Grid de entradas */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; margin-top: 1rem; }
.entry-card { background: white; border-radius: 12px; padding: 1.5rem; box-shadow: 0 4px 12px rgba(0,0,0,0.06); transition: transform 0.2s ease; cursor: pointer; }
.entry-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); }

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.card-type { font-size: 0.75rem; padding: 0.25rem 0.625rem; border-radius: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.type-general { background: #dbeafe; color: #1e40cf; }
.type-rodilla { background: #fce7f3; color: #db27a8; }
.type-montaje { background: #d1fafe; color: #0284c7; }
.type-mecanizado { background: #dcfce7; color: #16a534; }

.card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; line-height: 1.3; }
.card-desc { color: #6b7280; font-size: 0.9rem; margin-bottom: 0.75rem; flex-grow: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-footer { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: #9aa0a6; margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid #f3f4f6; }

.card-actions { display: flex; gap: 0.5rem; }
.action-btn { background: none; border: none; cursor: pointer; font-size: 1.25rem; padding: 0.25rem; border-radius: 4px; transition: background 0.2s ease; }
.action-btn:hover { background: #f3f4f6; }

/* Paginación */
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #e5e7eb; }

/* Importar XLSX */
.step-info { background: #f8fafc; padding: 1rem; border-radius: 8px; font-size: 0.9rem; margin-bottom: 1.5rem; }
.step-info ul { margin-top: 0.5rem; padding-left: 1.25rem; }
.import-area { text-align: center; padding: 3rem 2rem; border: 2px dashed #cbd5e1; border-radius: 12px; background: #f8fafc; transition: all 0.3s ease; margin-bottom: 1.5rem; }
.import-area.dragover { border-color: #4f46e5; background: #f0f4ff; }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-top: 1rem; max-height: 300px; overflow: auto; }
.data-table th, .data-table td { padding: 0.625rem 0.75rem; text-align: left; border-bottom: 1px solid #e5e7eb; }
.data-table th { background: #f8fafc; font-weight: 600; position: sticky; top: 0; }

.tabs { display: flex; gap: -1px; margin-bottom: 2rem; }
.tab-content { padding: 2rem 0; }

#file-list { margin-top: 1.5rem; }
.file-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; background: white; border-radius: 8px; margin-bottom: 0.5rem; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.file-info { display: flex; gap: 0.75rem; align-items: center; }

/* Notificaciones */
#notifications { position: fixed; top: 1rem; right: 1rem; z-index: 200; display: flex; flex-direction: column; gap: 0.75rem; max-width: 400px; }
.notification { padding: 1rem 1.5rem; border-radius: 8px; color: white; font-weight: 500; box-shadow: 0 8px 20px rgba(0,0,0,0.15); animation: slideIn 0.3s ease-out; }
.notification.success { background: #16a534; }
.notification.error { background: #dc2626; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 0 1rem; }
    .form-container { margin: 2rem auto; padding: 1.5rem; }
    .grid { grid-template-columns: 1fr; }
    .toolbar-actions { width: 100%; flex-direction: column; }
    .pagination { flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
}
