:root {
    --navy: #001f3f;
    --light-blue: #4da8ff;
    --blue-hover: #0074d9;
    --gray-light: #f4f6f9;
    --white: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--gray-light);
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, var(--navy) 0%, var(--light-blue) 100%);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    text-align: center;
}

.login-box h1 {
    color: var(--navy);
    font-size: 24px;
    margin-bottom: 10px;
}

.login-box h2 {
    color: #666;
    font-size: 16px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--light-blue);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--navy);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: var(--blue-hover);
}

.alert {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* Dashboard Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--navy);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 22px;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 12px;
    opacity: 0.8;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: white;
    text-decoration: none;
    transition: background 0.3s;
    gap: 12px;
}

.nav-item i {
    width: 20px;
}

.nav-item:hover, .nav-item.active {
    background: rgba(77, 168, 255, 0.2);
    border-left: 3px solid var(--light-blue);
}

.main-content {
    flex: 1;
    margin-left: 260px;
}

.top-bar {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    justify-content: flex-end;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--navy);
    font-weight: 500;
}

.content-area {
    padding: 30px;
}

/* Cards y Tablas */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.user-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.user-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.user-card h3 {
    color: var(--navy);
    margin-bottom: 10px;
}

.user-card p {
    color: #666;
    margin: 5px 0;
    font-size: 14px;
}

.user-card .email {
    color: var(--light-blue);
    font-size: 12px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    width: 80%;
    max-width: 800px;
    border-radius: 12px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 15px 20px;
}

.close:hover {
    color: var(--light-blue);
}

#modal-body {
    padding: 20px;
}

/* Cursos table */
.courses-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.courses-table th, .courses-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.courses-table th {
    background: var(--navy);
    color: white;
}

.btn-small {
    padding: 6px 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}

.btn-small.btn-success {
    background: #28a745;
}

.btn-small:hover {
    opacity: 0.8;
}

.loading {
    text-align: center;
    padding: 50px;
    color: #999;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    .sidebar-header h2, .sidebar-header p, .nav-item span {
        display: none;
    }
    .nav-item {
        justify-content: center;
        padding: 15px;
    }
    .main-content {
        margin-left: 70px;
    }
    .users-grid {
        grid-template-columns: 1fr;
    }
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

/* Botones de acciÃ³n */
.action-buttons {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}


/* Header de usuarios con buscador */
.users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.users-header h1 {
    color: var(--navy);
    margin: 0;
}

.search-box {
    display: flex;
    gap: 10px;
    align-items: center;
    background: white;
    padding: 5px 15px;
    border-radius: 25px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.search-box i {
    color: var(--light-blue);
}

.search-box input {
    border: none;
    padding: 8px;
    width: 250px;
    outline: none;
    font-size: 14px;
}

.btn-search, .btn-clear {
    padding: 6px 15px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.btn-search {
    background: var(--navy);
    color: white;
}

.btn-search:hover {
    background: var(--blue-hover);
}

.btn-clear {
    background: #dc3545;
    color: white;
}

.btn-clear:hover {
    background: #c82333;
}

.users-stats {
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #666;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Paginaci¨®n */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 15px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--navy);
}

.page-btn:hover {
    background: var(--light-blue);
    color: white;
    border-color: var(--light-blue);
}

.page-btn.active {
    background: var(--navy);
    color: white;
    border-color: var(--navy);
}

.page-dots {
    padding: 8px 5px;
    color: #999;
}

/* No users */
.no-users {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
}

.no-users i {
    font-size: 64px;
    color: #ccc;
    margin-bottom: 20px;
}

.no-users p {
    font-size: 18px;
    color: #999;
}

/* User card mejorado */
.user-card {
    display: flex;
    gap: 15px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.user-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.user-avatar i {
    font-size: 48px;
    color: var(--light-blue);
}

.user-info-card {
    flex: 1;
}

.user-info-card h3 {
    color: var(--navy);
    margin-bottom: 10px;
}

.user-info-card p {
    margin: 5px 0;
    font-size: 13px;
    color: #666;
}

.institution-badge {
    display: inline-block;
    background: var(--navy);
    color: white;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 11px;
    margin-top: 8px;
}

/* Modal mejorado */
.modal-user-header {
    text-align: center;
    margin-bottom: 20px;
}

.modal-user-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.modal-user-details p {
    margin: 5px 0;
    padding: 5px;
    background: #f8f9fa;
    border-radius: 5px;
}

.courses-list {
    max-height: 300px;
    overflow-y: auto;
    margin: 15px 0;
}

.enrol-form {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.course-id-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.btn-success {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}

.btn-danger:hover {
    background: #c82333;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.no-courses {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

/* Responsive para m¨®viles */
@media (max-width: 768px) {
    .users-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        width: 100%;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .modal-user-details {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .pagination {
        gap: 5px;
    }
    
    .page-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}