/* ============================================================
   EDUCAKIDS — Estilos globales
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --purple-50:  #f3f0ff;
    --purple-100: #e9e3ff;
    --purple-200: #d4c9ff;
    --purple-400: #a991f7;
    --purple-500: #8b6ef5;
    --purple-600: #7c5ce8;
    --purple-700: #6a4dd0;
    --purple-900: #3d2a8a;

    --gray-50:  #f8f7fc;
    --gray-100: #f0eef9;
    --gray-200: #e2dff2;
    --gray-300: #cdc9e8;
    --gray-400: #9d97c0;
    --gray-600: #5c5680;
    --gray-700: #4a4468;
    --gray-900: #2a2550;

    --green-bg:     #edfbf3;
    --green-text:   #1a7a45;
    --green-border: #a3dbbe;

    --red-bg:     #fdedf0;
    --red-text:   #b0283a;
    --red-border: #f4a7b0;

    --sidebar-width: 240px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
    background-color: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

a {
    color: var(--purple-600);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--purple-700) 0%, var(--purple-900) 100%);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    box-shadow: 3px 0 12px rgba(60, 40, 130, 0.15);
}

.sidebar-logo {
    padding: 28px 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    text-align: center;
}

.logo-educa {
    font-size: 26px;
    font-weight: 700;
    color: #d4c9ff;
    letter-spacing: 0.5px;
}

.logo-kids {
    font-size: 26px;
    font-weight: 700;
    color: #a991f7;
    letter-spacing: 0.5px;
}

.sidebar-logo small {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    margin-top: 4px;
    letter-spacing: 0.3px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 8px;
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    text-decoration: none;
}

.nav-item.activo {
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-weight: 600;
}

.nav-item.deshabilitado {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.pronto {
    margin-left: auto;
    font-size: 10px;
    background: rgba(255,255,255,0.15);
    padding: 2px 7px;
    border-radius: 10px;
    color: rgba(255,255,255,0.6);
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,0.12);
}

.usuario-sidebar {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.usuario-nombre {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.usuario-rol {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    text-transform: capitalize;
}

.btn-logout {
    display: block;
    text-align: center;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.8);
    padding: 8px;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.22);
    color: #fff;
    text-decoration: none;
}

/* ============================================================
   CONTENIDO PRINCIPAL
   ============================================================ */

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px 36px;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 28px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.page-header p {
    font-size: 14px;
    color: var(--gray-400);
}

/* ============================================================
   DASHBOARD — ESTADÍSTICAS
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 1px 6px rgba(100,80,200,0.08);
    border: 1px solid var(--purple-100);
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 16px rgba(100,80,200,0.14);
}

.stat-icon {
    font-size: 28px;
}

.stat-numero {
    font-size: 32px;
    font-weight: 700;
    color: var(--purple-600);
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--gray-400);
    font-weight: 500;
}

.accesos-rapidos {
    margin-top: 8px;
}

.accesos-rapidos h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 16px;
}

.accesos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.acceso-card {
    background: #fff;
    border: 1px solid var(--purple-100);
    border-radius: 10px;
    padding: 18px 14px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--gray-900);
    text-decoration: none;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.acceso-card:hover {
    box-shadow: 0 4px 14px rgba(100,80,200,0.14);
    transform: translateY(-2px);
    border-color: var(--purple-400);
    text-decoration: none;
    color: var(--purple-700);
}

.acceso-icon {
    font-size: 28px;
}

/* ============================================================
   TABLAS
   ============================================================ */

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.table-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
}

.btn-nuevo {
    background: var(--purple-600);
    color: #fff;
    padding: 9px 18px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-nuevo:hover {
    background: var(--purple-700);
    color: #fff;
    text-decoration: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(100,80,200,0.08);
    border: 1px solid var(--purple-100);
    margin-bottom: 24px;
}

thead {
    background: var(--purple-500);
    color: #fff;
}

thead th {
    padding: 13px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.3px;
}

tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background-color: var(--purple-50);
}

tbody td {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--gray-900);
}

tbody td a {
    color: var(--purple-600);
    font-weight: 500;
}

table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-600);
    width: 200px;
    background-color: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
}

/* ============================================================
   FORMULARIOS
   ============================================================ */

.form-container {
    background: #fff;
    padding: 32px 36px;
    border-radius: 12px;
    box-shadow: 0 1px 6px rgba(100,80,200,0.08);
    border: 1px solid var(--purple-100);
    max-width: 620px;
}

form {
    background: #fff;
    padding: 28px 32px;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(100,80,200,0.08);
    border: 1px solid var(--purple-100);
    max-width: 620px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 5px;
    margin-top: 16px;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: 7px;
    font-size: 14px;
    color: var(--gray-900);
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--purple-500);
    box-shadow: 0 0 0 3px rgba(139,110,245,0.12);
    background: #fff;
}

input[type="file"] {
    padding: 6px;
    cursor: pointer;
}

textarea {
    resize: vertical;
}

small {
    display: block;
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

button[type="submit"] {
    margin-top: 0;
    background-color: var(--purple-600);
    color: #fff;
    border: none;
    padding: 10px 26px;
    border-radius: 7px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    height: 42px;
}

.btn-cancelar {
    display: inline-block;
    padding: 10px 18px;
    background: var(--gray-100);
    color: var(--gray-600);
    border-radius: 7px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-cancelar:hover {
    background: var(--gray-200);
    color: var(--gray-900);
    text-decoration: none;
}

button[type="submit"]:hover {
    background-color: var(--purple-700);
}

button[type="submit"]:disabled {
    background-color: var(--gray-200);
    color: var(--gray-400);
    cursor: not-allowed;
}

form > a {
    display: inline-block;
    margin: 0;
    color: var(--gray-600);
    font-size: 14px;
}

.btn-cancelar {
    display: inline-flex !important;
    align-items: center;
    padding: 10px 18px !important;
    background: var(--gray-200) !important;
    color: var(--gray-700) !important;
    border-radius: 7px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    transition: background 0.2s;
    margin: 0 !important;
    height: 42px;
}

.btn-cancelar:hover {
    background: var(--gray-300) !important;
    color: var(--gray-900) !important;
    text-decoration: none !important;
}

/* ============================================================
   LOGIN
   ============================================================ */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--purple-50) 0%, var(--purple-100) 100%);
}

.login-container {
    max-width: 420px;
    width: 100%;
    background: #fff;
    padding: 44px 40px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(100,80,200,0.14);
    border: 1px solid var(--purple-100);
}

.login-logo {
    text-align: center;
    margin-bottom: 8px;
}

.login-logo .logo-educa {
    font-size: 32px;
    font-weight: 700;
    color: var(--purple-600);
}

.login-logo .logo-kids {
    font-size: 32px;
    font-weight: 700;
    color: var(--purple-400);
}

.login-logo small {
    display: block;
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 2px;
}

.login-container h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 24px;
    text-align: center;
}

.login-container form {
    box-shadow: none;
    padding: 0;
    max-width: 100%;
    border: none;
}

/* ============================================================
   MENSAJES
   ============================================================ */

.mensaje-exito {
    background-color: var(--green-bg);
    color: var(--green-text);
    border: 1px solid var(--green-border);
    padding: 11px 16px;
    border-radius: 7px;
    margin-bottom: 20px;
    font-size: 14px;
}

.mensaje-error {
    background-color: var(--red-bg);
    color: var(--red-text);
    border: 1px solid var(--red-border);
    padding: 11px 16px;
    border-radius: 7px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        margin-left: 0;
        padding: 20px 16px;
    }

    .app-wrapper {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    table {
        font-size: 13px;
    }

    form {
        padding: 20px 16px;
    }
}

/* ============================================================
   BOTONES DE ACCIÓN EN TABLAS
   ============================================================ */

.acciones-td {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-accion {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

.btn-accion:hover {
    opacity: 0.82;
    text-decoration: none;
}

.btn-ver {
    background: var(--purple-100);
    color: var(--purple-700);
}

.btn-editar {
    background: #e8f4fd;
    color: #1a6fa8;
}

.btn-eliminar {
    background: var(--red-bg);
    color: var(--red-text);
}

/* ============================================================
   FORMULARIOS EN GRID HORIZONTAL
   ============================================================ */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 28px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .acciones-td {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================================
   FORMULARIO CENTRADO
   ============================================================ */

form {
    margin: 0 auto;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 28px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    max-width: 960px;
    margin: 0 auto;
}

/* ============================================================
   PERFIL EN GRID
   ============================================================ */

.perfil-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.perfil-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--purple-100);
    padding: 24px;
    box-shadow: 0 1px 6px rgba(100,80,200,0.08);
}

.perfil-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--purple-700);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--purple-100);
}

.perfil-card table {
    box-shadow: none;
    border: none;
    margin-bottom: 0;
}

.perfil-card table th {
    width: 160px;
    background: transparent;
    font-size: 13px;
}

.perfil-card table td {
    font-size: 14px;
}

@media (max-width: 768px) {
    .perfil-grid {
        grid-template-columns: 1fr;
    }
}