/* ====== Reset general ====== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: #f4f6f9;
    color: #333;
    min-height: 100vh;
}

/* ====== Login ====== */
.login-container {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    max-width: 350px;
    width: 100%;
    margin: auto;
    text-align: center;
    margin-top: 10%;
}
.login-container h2 { margin-bottom: 20px; color: #6c5ce7; }
.login-container input {
    width: 100%; padding: 10px; margin: 10px 0;
    border: 1px solid #ccc; border-radius: 6px;
}
.login-container button {
    width: 100%; padding: 12px;
    background: #6c5ce7; color: #fff;
    border: none; border-radius: 6px;
    cursor: pointer; font-weight: bold;
    transition: background 0.3s;
}
.login-container button:hover { background: #5a4bcf; }
.error { color: red; margin-bottom: 10px; }

/* ====== Layout general ====== */
.container { display: flex; min-height: 100vh; }

/* ====== Sidebar normal (PC) ====== */
.sidebar {
    width: 250px; background: #6c5ce7; color: #fff;
    padding: 20px; display: flex; flex-direction: column;
}
.sidebar .profile { text-align: center; margin-bottom: 30px; }
.sidebar .profile h3 { margin-bottom: 5px; font-size: 18px; }
.sidebar .profile p { font-size: 14px; opacity: 0.9; }
.sidebar ul { list-style: none; padding: 0; }
.sidebar ul li { margin: 15px 0; }
.sidebar ul li a {
    color: #fff; text-decoration: none; font-weight: bold;
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-radius: 6px; transition: background 0.3s;
}
.sidebar ul li a:hover { background: #5a4bcf; }

/* ====== Header móvil con menú hamburguesa ====== */
.mobile-header {
    display: none;
    justify-content: flex-start;
    align-items: center;
    gap: 15px;
    background: #6c5ce7;
    color: #fff;
    padding: 10px 15px;
}
.mobile-header h2 { margin: 0; }
.menu-toggle {
    background: none; border: none;
    color: #fff; font-size: 24px; cursor: pointer;
}

/* ====== Menú móvil lateral ====== */
.mobile-menu {
    position: fixed;
    top: 0;
    left: -250px;
    width: 250px;
    height: 100%;
    background: #5a4bcf;
    display: flex;
    flex-direction: column;
    padding-top: 60px;
    transition: left 0.3s ease;
    z-index: 1001;
}
.mobile-menu.show { left: 0; }
.mobile-menu a {
    padding: 15px; color: #fff; text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}
.mobile-menu a:hover { background: #4a3bb0; }

/* ====== Overlay para cerrar menú ====== */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}
.menu-overlay.show { display: block; }

/* ====== Contenido principal ====== */
.content { flex: 1; padding: 30px; background: #f4f6f9; }
.content h1 { margin-bottom: 10px; }
.content p { margin-bottom: 20px; }

/* ====== Botón general ====== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: #00b894;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
    min-width: 130px;
    text-align: center;
}
.btn:hover { background: #019875; }
.btn.download { text-decoration: none; display: inline-block; }

/* ====== Tabla de usuarios ====== */
.user-table {
    width: 100%; border-collapse: collapse; background: #fff;
    border-radius: 8px; overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.user-table thead { background: #6c5ce7; color: #fff; }
.user-table th, .user-table td {
    padding: 12px; text-align: left; border-bottom: 1px solid #ddd;
}
.user-table tr:hover { background: #f0f0f0; }

/* ====== Filtros ====== */
.filters input, .filters select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-right: 10px;
    font-size: 14px;
}
.filters { margin-bottom: 20px; }

/* ====== Modal ====== */
.modal {
    display: none; 
    position: fixed; 
    z-index: 999;
    left: 0; top: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex; 
    justify-content: center; 
    align-items: center;
    overflow: auto;
}

.modal-content {
    background: #fff; 
    padding: 20px;
    border-radius: 8px; 
    width: 95%;          
    max-width: 900px;    
    max-height: 90vh;    
    overflow-y: auto;    
    position: relative;
    margin: auto;
}

.modal-content h2 { margin-bottom: 15px; font-size: 20px; font-weight: bold; }

.modal-content form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Campos que deben ocupar toda la fila */
.modal-content form .full,
.modal-content form textarea,
.modal-content form button {
    grid-column: span 2;
}

/* Inputs y selects uniformes */
.modal-content input, 
.modal-content select, 
.modal-content textarea {
    width: 100%; 
    padding: 10px; 
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
}

/* Botón dentro del modal */
.modal-content button {
    width: 100%; 
    padding: 12px; 
    background: #00b894; 
    color: #fff;
    border: none; 
    border-radius: 6px; 
    cursor: pointer;
    font-weight: bold; 
    transition: background 0.3s;
}
.modal-content button:hover { background: #019875; }

/* Botón cerrar */
.close { 
    position: absolute; 
    top: 10px; 
    right: 15px; 
    font-size: 22px; 
    cursor: pointer; 
}

/* ====== Botones de acción ====== */
.btn-icon {
    display: inline-block; padding: 6px 10px;
    border-radius: 4px; color: #fff; margin-right: 5px;
    text-decoration: none;
    font-size: 14px;
}
.btn-icon.edit { background: #3498db; }
.btn-icon.delete { background: #e74c3c; }
.btn-icon:hover { opacity: 0.8; }

/* ====== Tarjetas de usuarios (solo móvil) ====== */
.user-cards { display: none; }

/* ====== Toast de confirmación ====== */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #00b894;
    color: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
    transform: translateY(20px);
    z-index: 2000;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast.error {
    background: #e74c3c;
}

/* ====== Validaciones Prospección ====== */
.error-msg {
    color: #e74c3c; /* rojo */
    font-size: 13px;
    margin-top: 4px;
}

.is-invalid {
    border: 1px solid #e74c3c !important;
    background-color: #fcebea;
}
.is-invalid:focus {
    outline: none;
    box-shadow: 0 0 5px rgba(231,76,60,0.5);
}

/* ====== Inputs y selects mejorados ====== */
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    background-color: #fff;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

/* Hover y focus */
input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: #6c5ce7;
    outline: none;
    box-shadow: 0 0 5px rgba(108,92,231,0.4);
}

/* Placeholder más suave */
::placeholder {
    color: #999;
    font-style: italic;
}

/* Labels */
label {
    font-weight: 600;
    color: #444;
    margin-bottom: 4px;
    display: block;
}

/* Filtros en línea */
.filters input,
.filters select {
    margin-right: 10px;
    min-width: 180px;
}

/* Textarea */
textarea {
    resize: vertical;
    min-height: 80px;
}

/* ====== Ajustes de vistas para filtros y búsqueda ====== */
.search-filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;              /* espacio entre elementos */
    margin-bottom: 15px;    /* espacio debajo de la barra */
}

.search-bar input {
    width: 320px;           /* más grande y proporcionado */
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.filters-panel {
    display: none;
    margin-bottom: 25px;    /* separación respecto a la tabla */
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 5px;
    background: #f9f9f9;
}

/* ====== División del input con label ====== */
.form-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group label {
    width: 150px;   /* ancho fijo para la etiqueta en escritorio */
    margin: 0;
}

.form-group input,
.form-group select,
.form-group textarea {
    flex: 1;        /* el campo ocupa el resto */
}

/* ====== Responsivo para pantallas pequeñas ====== */
@media (max-width: 768px) {
    /* Sidebar y header */
    .sidebar { display: none; }
    .mobile-header { display: flex; }
    .search-bar input {
    width: 100%;       /* ocupa todo el ancho disponible */
    max-width: 100%;   /* sin límite fijo */
    }
    .search-filters-bar {
    flex-direction: column; /* apila botones y búsqueda */
    align-items: stretch;
    gap: 10px;
    }
    
    /* Botones */
    .btn { 
    width: 100%; 
    min-width: unset;  /* elimina el límite fijo */     
    }

    /* Modal */
    .modal-content {
        width: 95%;
        max-width: 400px;
        max-height: 90vh;
        overflow-y: auto;
        margin: 0 auto; /* centrado */
    }
    .modal-content form {
        display: block;    /* cambia de grid a bloque */
    }

    /* Form groups */
    .form-group {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 12px;
    }
    .form-group label {
        width: 100%;
        margin-bottom: 5px;
    }
    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100%;
    }

    /* Tarjetas de usuarios */
    .user-table { display: none; }
    .user-cards {
        display: flex;
        flex-direction: column;
        gap: 20px;
        margin-top: 20px;
        align-items: center;
    }
    .user-card {
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        padding: 15px;
        width: 95%;
        max-width: 400px;   /* límite para que no sea gigante */
        margin: 0 auto;
    }
    .user-card h3 {
        margin-bottom: 8px;
        color: #6c5ce7;
    }
    .user-card p {
        margin: 4px 0;
    }
    .user-card .actions {
        margin-top: 10px;
    }
    .user-card .btn-icon {
        display: inline-block;
        padding: 6px 10px;
        border-radius: 4px;
        color: #fff;
        margin-right: 5px;
        text-decoration: none;
    }
    .user-card .btn-icon.edit { background: #3498db; }
    .user-card .btn-icon.delete { background: #e74c3c; }
    .user-card .btn-icon:hover { opacity: 0.8; }
}
