/* ==========================================================
   NEXGEWEB — PANEL DE ADMINISTRACIÓN
   Login + Dashboard
   ========================================================== */

:root {
    color-scheme: dark;

    --admin-bg: #080d19;
    --admin-card: #111a2c;
    --admin-input: #0c1424;

    --admin-primary: #3985ff;
    --admin-primary-hover: #66a2ff;

    --admin-text: #f4f7ff;
    --admin-muted: #9caac3;

    --admin-border: rgba(255, 255, 255, 0.10);
    --admin-radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont,
                 "Segoe UI", sans-serif;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--admin-bg);
    color: var(--admin-text);
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

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

.admin-login-page {
    min-height: 100vh;
    min-height: 100dvh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 28px 18px;

    background:
        radial-gradient(
            circle at 20% 20%,
            rgba(57, 133, 255, 0.17),
            transparent 38%
        ),
        radial-gradient(
            circle at 85% 85%,
            rgba(57, 133, 255, 0.10),
            transparent 35%
        ),
        var(--admin-bg);
}

.login-container {
    width: 100%;
    max-width: 460px;
}

.login-card {
    padding: 42px 38px;

    background: rgba(17, 26, 44, 0.96);

    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius);

    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.35),
        0 0 45px rgba(57, 133, 255, 0.04);
}

/* Marca */

.login-brand {
    text-align: center;
    margin-bottom: 34px;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 64px;
    height: 64px;

    margin: 0 auto 16px;

    border-radius: 18px;

    background: linear-gradient(135deg, #3985ff, #1455cb);

    color: #fff;
    font-size: 34px;
    font-weight: 800;

    box-shadow: 0 10px 30px rgba(57, 133, 255, 0.25);
}

.login-brand h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
}

.login-brand p {
    margin: 7px 0 0;
    color: var(--admin-muted);
    font-size: 14px;
}

/* Encabezado */

.login-heading {
    margin-bottom: 26px;
}

.login-heading h2 {
    margin: 0 0 10px;
    font-size: 23px;
    font-weight: 700;
}

.login-heading p {
    margin: 0;
    color: var(--admin-muted);
    font-size: 14px;
    line-height: 1.65;
}

/* Formulario */

.login-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    min-height: 49px;

    padding: 13px 15px;

    background: var(--admin-input);

    border: 1px solid var(--admin-border);
    border-radius: 10px;

    color: var(--admin-text);
    font-size: 15px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.form-group input::placeholder {
    color: #73819b;
}

.form-group input:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(57, 133, 255, 0.15);
}

/* Contraseña */

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 100px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;

    transform: translateY(-50%);

    padding: 7px 9px;

    background: transparent;
    border: none;

    color: var(--admin-primary-hover);
    font-size: 13px;
    font-weight: 600;
}

.toggle-password:hover {
    color: #fff;
}

.toggle-password:focus-visible {
    outline: 2px solid var(--admin-primary);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Botón login */

.login-submit {
    width: 100%;
    min-height: 50px;

    margin-top: 4px;
    padding: 14px 18px;

    background: var(--admin-primary);

    border: none;
    border-radius: 10px;

    color: #fff;
    font-size: 15px;
    font-weight: 700;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.login-submit:hover {
    background: var(--admin-primary-hover);
    transform: translateY(-1px);
}

.login-submit:active {
    transform: translateY(0);
}

.login-submit:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

/* Error */

.login-error {
    margin-bottom: 22px;
    padding: 13px 15px;

    background: rgba(255, 75, 95, 0.10);

    border: 1px solid rgba(255, 75, 95, 0.35);
    border-radius: 10px;

    color: #ff9ba7;
    font-size: 14px;
    line-height: 1.5;
}

/* Pie login */

.login-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;

    margin-top: 30px;
    text-align: center;
}

.login-footer span {
    color: var(--admin-muted);
    font-size: 12px;
}

.login-footer a {
    color: var(--admin-primary-hover);
    font-size: 14px;
    font-weight: 600;
}

.login-footer a:hover {
    color: #fff;
}

.login-copyright {
    margin: 24px 0 0;
    color: var(--admin-muted);
    font-size: 12px;
    text-align: center;
}

/* ==========================================================
   DASHBOARD — ESTRUCTURA GENERAL
   ========================================================== */

.admin-layout {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ==========================================================
   MENÚ LATERAL
   ========================================================== */

.admin-sidebar {
    width: 255px;
    flex-shrink: 0;

    display: flex;
    flex-direction: column;

    padding: 28px 18px;

    background: #0d1525;
    border-right: 1px solid var(--admin-border);
}

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

    padding: 0 12px 35px;

    font-size: 23px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 39px;
    height: 39px;

    border-radius: 11px;

    background: linear-gradient(135deg, #3985ff, #1455cb);

    color: #fff;
    font-size: 22px;
    font-weight: 800;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;

    min-height: 46px;

    padding: 12px 14px;

    border-radius: 10px;

    color: var(--admin-muted);

    font-size: 14px;
    font-weight: 600;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.sidebar-link:hover {
    background: rgba(57, 133, 255, 0.10);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(57, 133, 255, 0.16);
    color: #8bb7ff;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 30px;
}

.logout-button {
    width: 100%;
    min-height: 45px;

    padding: 12px 14px;

    background: rgba(255, 75, 95, 0.08);

    border: 1px solid rgba(255, 75, 95, 0.18);
    border-radius: 10px;

    color: #ff9ba7;

    font-size: 14px;
    font-weight: 600;

    text-align: left;

    transition: background 0.2s ease;
}

.logout-button:hover {
    background: rgba(255, 75, 95, 0.17);
}

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

.admin-main {
    flex: 1;
    min-width: 0;

    padding: 38px 42px;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 35px;
}

.admin-header h1 {
    margin: 0 0 8px;

    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.7px;
}

.admin-header p {
    margin: 0;

    color: var(--admin-muted);
    font-size: 14px;
}

.admin-user-badge {
    padding: 11px 16px;

    background: var(--admin-card);

    border: 1px solid var(--admin-border);
    border-radius: 10px;

    font-size: 14px;
    font-weight: 600;
}

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

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;

    margin-bottom: 35px;
}

.stat-card {
    min-width: 0;
    padding: 25px;

    background: var(--admin-card);

    border: 1px solid var(--admin-border);
    border-radius: 15px;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(57, 133, 255, 0.35);
}

.stat-icon {
    display: inline-block;
    margin-bottom: 18px;
    font-size: 27px;
}

.stat-card h2 {
    margin: 0 0 15px;

    color: var(--admin-muted);

    font-size: 14px;
    font-weight: 600;
}

.stat-value {
    margin: 0 0 12px;

    font-size: 36px;
    font-weight: 800;
}

.stat-description {
    color: var(--admin-muted);

    font-size: 12px;
    line-height: 1.5;
}

/* ==========================================================
   ACTIVIDAD RECIENTE
   ========================================================== */

.dashboard-section {
    padding: 28px;

    background: var(--admin-card);

    border: 1px solid var(--admin-border);
    border-radius: 15px;
}

.section-heading {
    margin-bottom: 28px;
}

.section-heading h2 {
    margin: 0 0 8px;

    font-size: 20px;
    font-weight: 700;
}

.section-heading p {
    margin: 0;

    color: var(--admin-muted);

    font-size: 14px;
    line-height: 1.6;
}

.dashboard-empty {
    padding: 48px 20px;

    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 12px;

    text-align: center;
}

.dashboard-empty > span {
    display: block;
    margin-bottom: 15px;
    font-size: 35px;
}

.dashboard-empty h3 {
    margin: 0 0 10px;
    font-size: 17px;
}

.dashboard-empty p {
    max-width: 480px;
    margin: 0 auto;

    color: var(--admin-muted);

    font-size: 14px;
    line-height: 1.7;
}

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

@media (max-width: 1100px) {

    .admin-main {
        padding: 32px 28px;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {

    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;

        padding: 18px;

        border-right: none;
        border-bottom: 1px solid var(--admin-border);
    }

    .sidebar-brand {
        padding: 0 4px 18px;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-link {
        flex: 1 1 auto;
        justify-content: center;
        text-align: center;
    }

    .sidebar-footer {
        margin-top: 14px;
        padding-top: 0;
    }

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

    .admin-main {
        padding: 28px 20px;
    }

    .admin-header {
        align-items: flex-start;
    }

    .admin-header h1 {
        font-size: 24px;
    }
}

@media (max-width: 600px) {

    /* Login */

    .admin-login-page {
        padding: 20px 14px;
    }

    .login-card {
        padding: 32px 23px;
        border-radius: 15px;
    }

    .login-brand {
        margin-bottom: 28px;
    }

    .login-logo {
        width: 58px;
        height: 58px;
        font-size: 30px;
    }

    .login-brand h1 {
        font-size: 28px;
    }

    .login-heading h2 {
        font-size: 21px;
    }

    .login-form {
        gap: 19px;
    }

    /* Dashboard */

    .admin-main {
        padding: 24px 15px;
    }

    .admin-header {
        flex-direction: column;
        gap: 15px;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card {
        padding: 22px;
    }

    .dashboard-section {
        padding: 20px;
    }

    .dashboard-empty {
        padding: 35px 15px;
    }
}

@media (max-width: 360px) {

    .login-card {
        padding: 27px 17px;
    }

    .login-heading h2 {
        font-size: 19px;
    }

    .form-group input {
        font-size: 14px;
    }

    .sidebar-link {
        font-size: 12px;
        padding: 10px;
    }
}

/* ==========================================================
   ACCESIBILIDAD
   ========================================================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--admin-primary);
    outline-offset: 3px;
}
/* ==========================================================
   WEBS GENERADAS
   ========================================================== */

.generated-webs-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.generated-web-card {
    min-width: 0;
    padding: 24px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 16px;
    transition: border-color 0.2s ease;
}

.generated-web-card:hover {
    border-color: rgba(57, 133, 255, 0.45);
}

.generated-web-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.generated-web-reference {
    color: var(--admin-muted);
    font-size: 13px;
    font-weight: 600;
}

.generated-web-card h3 {
    margin: 0 0 6px;
    font-size: 21px;
    overflow-wrap: anywhere;
}

.generated-web-category {
    margin: 0 0 20px;
    color: #8bb7ff;
    font-size: 14px;
}

.generated-web-details {
    display: grid;
    gap: 12px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.generated-web-details p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--admin-muted);
    overflow-wrap: anywhere;
}

.generated-web-details strong {
    color: #e2e8f0;
    font-weight: 600;
}

/* ESTADOS DE GENERACIÓN */

.generated-web-status {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
}

.generated-web-status[data-estado="Pendiente"] {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
}

.generated-web-status[data-estado="Generando"] {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

.generated-web-status[data-estado="Lista para revisar"] {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
}

.generated-web-status[data-estado="Requiere cambios"] {
    background: rgba(249, 115, 22, 0.15);
    color: #fdba74;
}

.generated-web-status[data-estado="Aprobada"],
.generated-web-status[data-estado="Publicada"] {
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
}

.generated-web-status[data-estado="Error"] {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
}

.generated-web-status[data-estado="Cancelada"] {
    background: rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
}

.generated-web-error {
    margin: 18px 0 0;
    padding: 12px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.08);
    color: #fca5a5;
    font-size: 13px;
    overflow-wrap: anywhere;
}

/* DISEÑO RESPONSIVE */

@media (max-width: 1100px) {
    .generated-webs-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .generated-webs-grid {
        gap: 14px;
    }

    .generated-web-card {
        padding: 18px;
    }

    .generated-web-card h3 {
        font-size: 18px;
    }

    .generated-web-details {
        gap: 10px;
    }
}
/* ==========================================================
   ACCIONES DE WEBS GENERADAS
   ========================================================== */

.generated-web-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.generated-web-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 12px 18px;
    border: 1px solid rgba(59, 130, 246, 0.30);
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease;
}

.generated-web-preview:hover {
    background: rgba(59, 130, 246, 0.28);
    color: #ffffff;
}

.generated-web-preview:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 3px;
}

@media (max-width: 600px) {
    .generated-web-preview {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }
}


/* ==========================================================
   BOTÓN EDITAR PÁGINA GENERADA
   ========================================================== */

.generated-web-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 12px 18px;
    border: 1px solid rgba(245, 158, 11, 0.30);
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.generated-web-edit:hover {
    background: rgba(245, 158, 11, 0.25);
    color: #ffffff;
}

.generated-web-edit:focus-visible {
    outline: 2px solid #fbbf24;
    outline-offset: 3px;
}

@media (max-width: 600px) {
    .generated-web-edit {
        width: 100%;
    }
}


/* ==========================================================
   BOTÓN EDITAR PÁGINA GENERADA
   ========================================================== */

.generated-web-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 12px 18px;
    border: 1px solid rgba(245, 158, 11, 0.30);
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.generated-web-edit:hover {
    background: rgba(245, 158, 11, 0.25);
    color: #ffffff;
}

.generated-web-edit:focus-visible {
    outline: 2px solid #fbbf24;
    outline-offset: 3px;
}

@media (max-width: 600px) {
    .generated-web-edit {
        width: 100%;
    }
}


/* BOTON HISTORIAL DE VERSIONES */

.generated-web-history {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 12px 18px;
    border: 1px solid rgba(167, 139, 250, .30);
    border-radius: 10px;
    background: rgba(167, 139, 250, .12);
    color: #c4b5fd;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: background .2s;
}

.generated-web-history:hover {
    background: rgba(167, 139, 250, .22);
}

.generated-web-history:focus-visible {
    outline: 2px solid #c4b5fd;
    outline-offset: 3px;
}

@media (max-width: 600px) {
    .generated-web-history {
        width: 100%;
        box-sizing: border-box;
    }
}


/* BOTON DESCARGAR ZIP */

.generated-web-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 12px 18px;
    border: 1px solid rgba(74, 222, 128, .30);
    border-radius: 10px;
    background: rgba(74, 222, 128, .12);
    color: #4ade80;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: background .2s;
}

.generated-web-download:hover {
    background: rgba(74, 222, 128, .22);
}

.generated-web-download:focus-visible {
    outline: 2px solid #4ade80;
    outline-offset: 3px;
}

@media (max-width: 600px) {
    .generated-web-download {
        width: 100%;
        box-sizing: border-box;
    }
}


/* FORMULARIOS DE DESCARGA ZIP */

.generated-web-download-form {
    margin: 0;
}

.generated-web-download {
    cursor: pointer;
    font-family: inherit;
}

.generated-web-actions {
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .generated-web-download-form {
        width: 100%;
    }
}


/* ==================================================
   GESTION DE PUBLICACION
================================================== */

.publication-actions {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.publication-actions h4 {
    margin: 0 0 14px;
    font-size: 14px;
    font-weight: 600;
    color: #cbd5e1;
}

.publication-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.publication-form {
    margin: 0;
}

.publication-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 12px 18px;
    border: 0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.publication-approve {
    background-color: #15803d;
}

.publication-approve:hover {
    background-color: #166534;
}

.publication-changes {
    background-color: #b45309;
}

.publication-changes:hover {
    background-color: #92400e;
}

.publication-publish {
    background-color: #2563eb;
}

.publication-publish:hover {
    background-color: #1d4ed8;
}

.publication-withdraw {
    background-color: #b91c1c;
}

.publication-withdraw:hover {
    background-color: #991b1b;
}

.publication-button:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

.publication-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 600px) {

    .publication-buttons {
        flex-direction: column;
    }

    .publication-form,
    .publication-button {
        width: 100%;
        box-sizing: border-box;
    }
}


/* ==================================================
   ACCESO A LA WEB PUBLICADA
================================================== */

.generated-web-public {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 12px 18px;
    border-radius: 10px;
    background-color: #0f766e;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

.generated-web-public:hover {
    background-color: #115e59;
    color: #ffffff;
}

.generated-web-public:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

@media (max-width: 600px) {

    .generated-web-public {
        width: 100%;
    }

}
