/* LERROKA-MAT v2.0 - Sistema de Gestión de Materiales Milakilo */
/* Diseño moderno con paleta de colores Milakilo */

:root {
    /* Colores Milakilo del logo */
    --azul-oscuro: #1E3A5F;
    --azul-principal: #2E6DB5;
    --azul-claro: #4A9EE0;
    --azul-muy-claro: #E8F4FC;
    
    /* Colores funcionales */
    --verde-exito: #28a745;
    --amarillo-pendiente: #ffc107;
    --rojo-urgente: #dc3545;
    
    /* Grises y neutros */
    --gris-texto: #5f6368;
    --gris-borde: #dadce0;
    --gris-fondo: #f8f9fa;
    --blanco: #ffffff;
    --negro: #202124;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background-color: var(--gris-fondo);
    color: var(--negro);
    line-height: 1.6;
}

/* ============================================
   PANTALLA DE LOGIN
   ============================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #E8F4FC 0%, #ffffff 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    margin-bottom: 24px;
}

.login-logo img {
    max-width: 180px;
    height: auto;
}

.login-title {
    color: var(--azul-oscuro);
    font-size: 28px;
    font-weight: 500;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--gris-texto);
    font-size: 14px;
    margin-bottom: 32px;
}

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

.form-group label {
    display: block;
    color: var(--negro);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gris-borde);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--azul-principal);
    box-shadow: 0 0 0 3px rgba(46, 109, 181, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--azul-principal);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--azul-oscuro);
    box-shadow: 0 4px 8px rgba(46, 109, 181, 0.2);
}

.error-message {
    background-color: #fee;
    color: var(--rojo-urgente);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    border-left: 3px solid var(--rojo-urgente);
    text-align: left;
}

.login-footer {
    margin-top: 32px;
}

.login-footer p {
    color: var(--gris-texto);
    font-size: 13px;
}

/* ============================================
   BARRA DE NAVEGACIÓN SUPERIOR
   ============================================ */

.navbar {
    background: white;
    border-bottom: 1px solid var(--gris-borde);
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-logo {
    width: 40px;
    height: 40px;
    background: var(--azul-muy-claro);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--azul-principal);
    font-size: 18px;
}

.navbar-brand h1 {
    font-size: 20px;
    font-weight: 500;
    color: var(--negro);
    margin: 0;
}

.navbar-brand p {
    font-size: 13px;
    color: var(--gris-texto);
    margin: 0;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--azul-principal);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 14px;
}

.user-info {
    text-align: right;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--negro);
    display: block;
}

.user-role {
    font-size: 12px;
    color: var(--gris-texto);
}

.btn-logout {
    background: transparent;
    border: none;
    color: var(--gris-texto);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: var(--gris-fondo);
    color: var(--rojo-urgente);
}

/* ============================================
   MENÚ DE NAVEGACIÓN HORIZONTAL
   ============================================ */

.nav-menu {
    background: white;
    border-bottom: 1px solid var(--gris-borde);
    padding: 0 24px;
}

.nav-menu ul {
    list-style: none;
    display: flex;
    gap: 4px;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    color: var(--gris-texto);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.nav-menu a:hover {
    color: var(--azul-principal);
    background: var(--azul-muy-claro);
}

.nav-menu a.active {
    color: var(--azul-principal);
    background: var(--azul-muy-claro);
    border-bottom-color: var(--azul-principal);
}

/* ============================================
   CONTENIDO PRINCIPAL
   ============================================ */

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--negro);
    margin-bottom: 4px;
}

.page-header p {
    color: var(--gris-texto);
    font-size: 14px;
    margin-bottom: 32px;
}

/* ============================================
   TARJETAS DE ESTADÍSTICAS
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border: 1px solid var(--gris-borde);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.stat-content h3 {
    font-size: 13px;
    font-weight: 500;
    color: var(--gris-texto);
    margin-bottom: 8px;
}

.stat-content .stat-value {
    font-size: 36px;
    font-weight: 300;
    color: var(--negro);
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: var(--gris-fondo);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* ============================================
   SECCIÓN DE ACCIONES RÁPIDAS
   ============================================ */

.actions-section {
    margin-bottom: 32px;
}

.actions-section h2 {
    font-size: 20px;
    font-weight: 500;
    color: var(--negro);
    margin-bottom: 20px;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.action-card {
    background: white;
    border: 1px solid var(--gris-borde);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.action-card:hover {
    border-color: var(--azul-principal);
    box-shadow: 0 4px 12px rgba(46, 109, 181, 0.15);
    transform: translateY(-2px);
}

.action-card.primary {
    background: var(--azul-principal);
    color: white;
    border-color: var(--azul-principal);
}

.action-card.primary:hover {
    background: var(--azul-oscuro);
}

.action-card.primary h3,
.action-card.primary p {
    color: white;
}

.action-card.secondary {
    border: 2px solid var(--azul-principal);
    background: white;
}

.action-card.secondary h3 {
    color: var(--azul-principal);
}

.action-card.disabled {
    background: var(--gris-fondo);
    border-color: var(--gris-borde);
    cursor: not-allowed;
    opacity: 0.6;
}

.action-card h3 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--negro);
}

.action-card p {
    font-size: 13px;
    color: var(--gris-texto);
}

/* ============================================
   TABLA DE SOLICITUDES
   ============================================ */

.table-section {
    background: white;
    border: 1px solid var(--gris-borde);
    border-radius: 12px;
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gris-borde);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h2 {
    font-size: 18px;
    font-weight: 500;
    color: var(--negro);
}

.table-header a {
    color: var(--azul-principal);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--gris-fondo);
}

th {
    text-align: left;
    padding: 12px 24px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gris-texto);
    border-bottom: 1px solid var(--gris-borde);
}

td {
    padding: 16px 24px;
    font-size: 14px;
    color: var(--negro);
    border-bottom: 1px solid var(--gris-borde);
}

tbody tr:hover {
    background: var(--azul-muy-claro);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   BADGES Y ESTADOS
   ============================================ */

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-urgente {
    background: #fee;
    color: var(--rojo-urgente);
}

.badge-pendiente {
    background: #fff3cd;
    color: #856404;
}

.badge-en-proceso {
    background: var(--azul-muy-claro);
    color: var(--azul-principal);
}

.badge-completado {
    background: #d4edda;
    color: var(--verde-exito);
}

/* ============================================
   BOTONES
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-azul {
    background: var(--azul-principal);
    color: white;
}

.btn-azul:hover {
    background: var(--azul-oscuro);
    box-shadow: 0 4px 8px rgba(46, 109, 181, 0.2);
}

.btn-outline {
    background: white;
    border: 2px solid var(--azul-principal);
    color: var(--azul-principal);
}

.btn-outline:hover {
    background: var(--azul-principal);
    color: white;
}

.btn-success {
    background: var(--verde-exito);
    color: white;
}

.btn-danger {
    background: var(--rojo-urgente);
    color: white;
}

/* ============================================
   ESTADO VACÍO
   ============================================ */

.empty-state {
    text-align: center;
    padding: 64px 24px;
}

.empty-state-icon {
    font-size: 64px;
    color: var(--gris-borde);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gris-texto);
    margin-bottom: 24px;
}

/* ============================================
   FORMULARIOS
   ============================================ */

.form-section {
    background: white;
    border: 1px solid var(--gris-borde);
    border-radius: 12px;
    padding: 32px;
}

.form-section h2 {
    font-size: 20px;
    font-weight: 500;
    color: var(--negro);
    margin-bottom: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--negro);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gris-borde);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--azul-principal);
    box-shadow: 0 0 0 3px rgba(46, 109, 181, 0.1);
}

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

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

.checkbox-group label {
    margin: 0;
    font-weight: 600;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        height: auto;
        padding: 16px;
        gap: 16px;
    }

    .nav-menu ul {
        flex-direction: column;
        width: 100%;
    }

    .nav-menu a {
        width: 100%;
        justify-content: center;
    }

    .stats-grid,
    .actions-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   UTILIDADES
   ============================================ */

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.text-muted {
    color: var(--gris-texto);
}

/* Footer */
.footer {
    background: var(--gris-fondo);
    border-top: 1px solid var(--gris-borde);
    padding: 24px 0;
    text-align: center;
    margin-top: 60px;
}

.footer p {
    margin: 0;
    color: var(--gris-texto);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* ==================== NOTIFICACIONES TOAST ==================== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    pointer-events: auto;
    animation: slideInRight 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast.hiding {
    animation: slideOutRight 0.3s ease-in forwards;
}

.toast-exito {
    border-left: 4px solid var(--verde-exito);
}

.toast-error {
    border-left: 4px solid #dc3545;
}

.toast-info {
    border-left: 4px solid var(--azul-principal);
}

.toast-warning {
    border-left: 4px solid #ffc107;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-exito .toast-icon {
    color: var(--verde-exito);
}

.toast-error .toast-icon {
    color: #dc3545;
}

.toast-info .toast-icon {
    color: var(--azul-principal);
}

.toast-warning .toast-icon {
    color: #ffc107;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    color: var(--negro);
}

.toast-message {
    font-size: 13px;
    color: var(--gris-texto);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--gris-texto);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    animation: progressBar 3s linear forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes progressBar {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .toast-container {
        top: 70px;
        right: 12px;
        left: 12px;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
    }
}


/* ==================== NOTIFICACIONES TOAST ==================== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    pointer-events: auto;
    animation: slideInRight 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast.hiding {
    animation: slideOutRight 0.3s ease-in forwards;
}

.toast-exito {
    border-left: 4px solid var(--verde-exito);
}

.toast-error {
    border-left: 4px solid #dc3545;
}

.toast-info {
    border-left: 4px solid var(--azul-principal);
}

.toast-warning {
    border-left: 4px solid #ffc107;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-exito .toast-icon {
    color: var(--verde-exito);
}

.toast-error .toast-icon {
    color: #dc3545;
}

.toast-info .toast-icon {
    color: var(--azul-principal);
}

.toast-warning .toast-icon {
    color: #ffc107;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    color: var(--negro);
}

.toast-message {
    font-size: 13px;
    color: var(--gris-texto);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--gris-texto);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    animation: progressBar 3s linear forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes progressBar {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

@media (max-width: 768px) {
    .toast-container {
        top: 70px;
        right: 12px;
        left: 12px;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
    }
}

/* ==================== ICONOS SVG ==================== */
.nav-icon, [data-icon] {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-right: 6px;
}

.nav-icon svg, [data-icon] svg {
    display: block;
}

/* Asegurar que todos los SVG usen el color corporativo */
svg {
    stroke: #093561 !important;
}

/* Iconos en navegación */
nav svg, .nav-menu svg {
    stroke: #093561;
}

nav a:hover svg, .nav-menu a:hover svg {
    stroke: #2E6DB5;
}

nav a.active svg, .nav-menu a.active svg {
    stroke: #fff;
}

/* ==================== GRID TIPO SOLICITUD ==================== */
@media (min-width: 768px) {
    .tipo-solicitud-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
}

/* Input de archivo mejorado */
input[type="file"].form-control {
    padding: 12px;
    border: 2px dashed var(--gris-borde);
    background: var(--gris-fondo);
    cursor: pointer;
    transition: all 0.2s;
}

input[type="file"].form-control:hover {
    border-color: var(--azul-principal);
    background: var(--azul-muy-claro);
}

/* ==================== BOTÓN CLIP IMAGEN ==================== */
.btn-clip {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    transition: transform 0.2s;
}

.btn-clip:hover {
    transform: scale(1.2);
}

.btn-clip:hover svg {
    stroke: #2E6DB5;
}

/* Preview de imagen */
.imagen-preview {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    max-width: 90vw;
    max-height: 90vh;
    animation: fadeIn 0.2s;
}

.imagen-preview img {
    max-width: 100%;
    max-height: 80vh;
    display: block;
    border-radius: 8px;
}

/* Overlay oscuro */
.imagen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: none;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
