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

html, body {
    height: 100%;
    width: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
}

/* =========================
   LOGIN
========================= */

.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0066cc 0%, #003d99 100%);
}

.login-box {
    background: #fff;
    padding: 50px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    color: #0066cc;
    text-align: center;
    margin-bottom: 10px;
    font-size: 28px;
}

.login-box > p {
    color: #666;
    text-align: center;
    margin-bottom: 30px;
    font-size: 14px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #0066cc 0%, #003d99 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 102, 204, 0.3);
}

.demo-text {
    margin-top: 20px;
    color: #999;
    font-size: 12px;
    text-align: center;
}
.login-subtitle {
    font-weight: 700;
    color: #333;
    text-align: center;
    margin-bottom: 25px;
}

.login-links {
    text-align: center;
    margin-top: 12px;
}

.link-recuperar {
    display: inline-block;
    font-size: 13px;
    color: #2563eb;
    text-decoration: none;
}

.link-recuperar:hover {
    text-decoration: underline;
}

.login-logo {
    width: 180px;
    margin: 0 auto 20px;
    text-align: center;
}

.login-logo img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.login-help-text {
    font-size: 13px;
    color: #666;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.4;
}

.captcha-wrapper {
    margin: 10px 0 18px;
    display: flex;
    justify-content: center;
}

.captcha-wrapper .g-recaptcha {
    transform-origin: center;
}

@media (max-width: 420px) {
    .captcha-wrapper .g-recaptcha {
        transform: scale(0.92);
    }
}

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

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

.form-group label,
.label-clean {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* =========================
   LAYOUT APP
========================= */

.app-wrapper {
    display: flex;
    height: 100vh;
    background-color: #f5f7fa;
    flex-direction: column;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #0066cc 0%, #003d99 100%);
    color: #fff;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 5px;
}

.sidebar-subtitle {
    font-size: 11px;
    opacity: 0.8;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0 80px 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    border-left: 4px solid transparent;
    font-size: 14px;
    transition: all 0.3s;
}

.sidebar-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: #00d4ff;
}

.sidebar-menu a.active {
    background-color: rgba(255, 255, 255, 0.15);
    border-left-color: #00d4ff;
}

.logout-btn {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    text-align: center;
    text-decoration: none;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.header {
    background: #fff;
    padding: 18px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e8e8e8;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.header h2 {
    color: #0066cc;
    font-size: 22px;
    margin: 0;
    font-weight: 600;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0088ff 0%, #00d4ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
}

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

.user-info p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.user-info strong {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #111;
    line-height: 1.2;
}

.user-links {
    margin-top: 6px;
}

.user-links a {
    font-size: 13px;
    color: #2563eb;
    text-decoration: none;
    margin-left: 12px;
}

.user-links a:first-child {
    margin-left: 0;
}

.user-links a:hover {
    text-decoration: underline;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 25px 30px;
}

.section.active {
    display: block;
}

.page-title h1 {
    margin: 0 0 24px 0;
    font-size: 22px;
    font-weight: 700;
    color: #1f3c88;
}

/* =========================
   DASHBOARD
========================= */

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

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-left: 5px solid #0066cc;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.12);
}

.stat-card h3 {
    color: #666;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.stat-card .value {
    color: #0066cc;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
}

.stat-card p {
    color: #999;
    font-size: 12px;
    margin: 0;
}

.stat-card.warning {
    border-left-color: #ff9800;
}

.stat-card.warning .value {
    color: #ff9800;
}

.stat-card.success {
    border-left-color: #4caf50;
}

.stat-card.success .value {
    color: #4caf50;
}

/* =========================
   TABLAS GENERALES
========================= */

.table-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 20px;
}

.table-header {
    padding: 18px 25px;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.table-header h3 {
    color: #333;
    margin: 0;
    font-size: 16px;
}

.search-box {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    width: 250px;
    font-size: 14px;
}

.search-box:focus {
    outline: none;
    border-color: #0066cc;
}

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

table thead {
    background-color: #f5f6f7;
    border-bottom: 1px solid #e8e8e8;
}

table th {
    padding: 12px 25px;
    text-align: left;
    font-weight: 600;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table td {
    padding: 14px 25px;
    border-bottom: 1px solid #e8e8e8;
    font-size: 13px;
    vertical-align: middle;
}

table tbody tr:hover {
    background-color: #f9f9f9;
}

/* =========================
   BADGES Y BOTONES BASE
========================= */

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

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

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary {
    background-color: #0066cc;
    color: #fff;
}

.btn-primary:hover {
    background-color: #003d99;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.btn-secondary {
    background-color: #6c757d;
    color: #fff;
}

/* =========================
   ALERTAS
========================= */

.alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.alert-info {
    background-color: #d1ecf1;
    border-left: 5px solid #0c5460;
    color: #0c5460;
}

.alert-danger {
    background-color: #f8d7da;
    border-left: 5px solid #dc3545;
    color: #721c24;
}

/* =========================
   FOOTER
========================= */

.footer {
    background: #fff;
    padding: 15px 30px;
    text-align: center;
    color: #999;
    font-size: 11px;
    border-top: 1px solid #e0e0e0;
}

/* =========================
   SELECTS
========================= */

.select-wrapper,
.custom-select-wrapper {
    position: relative;
}

.select-modern,
.custom-select {
    width: 100%;
    height: 44px;
    padding: 0 40px 0 14px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    background: linear-gradient(180deg, #fff 0%, #f9fafb 100%);
    font-size: 14px;
    color: #333;
    appearance: none;
    cursor: pointer;
    transition: all 0.25s ease;
}

.select-modern:hover,
.custom-select:hover {
    border-color: #0066cc;
}

.select-modern:focus,
.custom-select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.select-icon,
.custom-select-wrapper::after {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: #666;
    pointer-events: none;
}

.select-icon {
    content: "";
}

.custom-select-wrapper::after {
    content: "▼";
}

/* =========================
   CURSOS INDEX
========================= */

.cursos-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 20px;
}

.cursos-header {
    padding: 18px 25px;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.cursos-header h3 {
    color: #333;
    margin: 0;
    font-size: 16px;
}

.cursos-search-form {
    margin: 0;
}

.cursos-search-box {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    width: 250px;
    font-size: 14px;
    height: auto;
    max-width: 100%;
    box-shadow: none;
    outline: none;
}

.cursos-search-box:focus {
    border-color: #0066cc;
}

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

.cursos-table thead th {
    background-color: #f5f6f7;
    border-bottom: 1px solid #e8e8e8;
    padding: 12px 25px;
    text-align: left;
    font-weight: 600;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cursos-table tbody td {
    padding: 14px 25px;
    border-bottom: 1px solid #e8e8e8;
    font-size: 13px;
    vertical-align: middle;
    color: #333;
}

.cursos-table tbody tr:hover {
    background-color: #f9f9f9;
}

.curso-nombre {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.estado-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    min-width: auto;
}

.estado-vigente,
.estado-encurso {
    background-color: #d4edda;
    color: #155724;
}

.estado-finalizado {
    background-color: #dbe7ff;
    color: #315bb5;
}

.estado-proximo {
    background-color: #fff3cd;
    color: #856404;
}

.btn-ver-trabajadores {
    display: inline-block;
    padding: 8px 16px;
    background-color: #0066cc;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    min-width: auto;
    box-shadow: none;
    transition: all 0.3s;
}

.btn-ver-trabajadores:hover {
    background-color: #003d99;
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.empty-row {
    text-align: center;
    color: #6b7280;
    padding: 28px !important;
}

/* =========================
   CURSOS DETALLE
========================= */

.cursos-detalle-container {
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.cursos-detalle-header {
    padding: 22px 30px 10px 30px;
}

.cursos-detalle-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #29467a;
}

.avance-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avance-barra-fondo {
    width: 105px;
    height: 10px;
    background: #dde2ea;
    border-radius: 999px;
    overflow: hidden;
}

.avance-barra {
    height: 100%;
    border-radius: 999px;
}

.barra-verde {
    background: #2dbb63;
}

.barra-azul {
    background: #3367e8;
}

.barra-gris {
    background: #b8c0cc;
}

.avance-texto {
    font-weight: 500;
    color: #2d3748;
}

.btn-certificado {
    display: inline-block;
    min-width: 110px;
    text-align: center;
    padding: 11px 18px;
    border-radius: 10px;
    background: #1565d8;
    color: #fff !important;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 700;
    border: none;
    box-sizing: border-box;
}

.btn-certificado:hover {
    background: #0f57bd;
    color: #fff !important;
    text-decoration: none !important;
}

.btn-certificado-disabled {
    background: #d9dde3;
    color: #7b8494 !important;
    cursor: default;
    pointer-events: none;
}

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

@media (max-width: 992px) {
    .cursos-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .cursos-search-box {
        width: 100%;
    }
}

@media (max-width: 768px) {

    /* Sidebar tipo app */
    .sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        width: 260px;
        height: 100%;
        z-index: 1000;
        transition: all 0.3s ease;
    }

    .sidebar.active {
        left: 0;
    }

    /* Overlay */
    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.4);
        z-index: 999;
        display: none;
    }

    .overlay.active {
        display: block;
    }

    /* Layout */
    .main-content {
        flex-direction: column;
    }

    .content-area {
        padding: 15px;
    }

    /* Header */
    .header {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 10px;
    }

    .header h2 {
        font-size: 20px;
        line-height: 1.2;
        margin: 0;
    }

    /* Dashboard */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Tablas */
    .table-container {
        overflow-x: auto;
    }

    table {
        min-width: 600px;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        width: 100%;
    }

    .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
}

.menu-toggle {
    display: none;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 11px;
    font-size: 20px;
    cursor: pointer;
}

.link-recuperar {
    display: inline-block;
    font-size: 13px;
    color: #2563eb;
    text-decoration: none;
    margin-top: 5px;
}

.link-recuperar:hover {
    text-decoration: underline;
}

.sidebar-logo-box {
    background: #ffffff;
    border-radius: 12px;
    padding: 8px 6px;
    margin-bottom: 10px;

    width: 170px;
    max-width: 170px;

    margin-left: 0;  
}

.sidebar-logo-box img {
    max-width: 120px;
    width: 100%;
    height: auto;
    display: block;
}