/*
 * Panel: estilo moderno sobre el tema Porto.
 *
 * Se carga DESPUÉS de porto-light/css/theme.css (layouts/app.blade.php) y lo
 * sobrescribe solo en lo visual: menú lateral, barra superior, fondo,
 * tipografía y el color principal de Element Plus. No toca las vistas de
 * cliente ni la lógica. Todo lo nuevo usa el prefijo pm-.
 */

:root {
    --pm-bg: #f6f7f9;
    --pm-surface: #ffffff;
    --pm-border: #e5e7eb;
    --pm-text: #111827;
    --pm-text-2: #4b5563;
    --pm-muted: #6b7280;
    --pm-primary: #2563eb;
    --pm-primary-soft: #eff4ff;
    --pm-primary-strong: #1d4ed8;
    --pm-sidebar-w: 252px;
    --pm-radius: 10px;

    /* Element Plus con el mismo azul */
    --el-color-primary: #2563eb;
    --el-color-primary-light-3: #6690f1;
    --el-color-primary-light-5: #92b0f5;
    --el-color-primary-light-7: #bed0f9;
    --el-color-primary-light-8: #d3dffb;
    --el-color-primary-light-9: #e9effd;
    --el-color-primary-dark-2: #1e4fbc;
    --el-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --el-border-radius-base: 8px;
}

html.fixed body,
html.fixed .content-body {
    background: var(--pm-bg);
    color: var(--pm-text);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

html.fixed .content-body h3 {
    color: var(--pm-text);
    font-weight: 650;
    letter-spacing: -0.01em;
}

/* ------------------------------------------------------------------ */
/* Iconos                                                             */
/* ------------------------------------------------------------------ */

.pm-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/* Menú lateral                                                       */
/* ------------------------------------------------------------------ */

html.fixed .sidebar-left.pm-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--pm-sidebar-w);
    padding: 0;
    display: flex;
    flex-direction: column;
    background: var(--pm-surface);
    border-right: 1px solid var(--pm-border);
    color: var(--pm-text-2);
    z-index: 1030;
}

.pm-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 14px;
}

.pm-brand-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--pm-primary);
    color: #fff;
}

.pm-brand-mark .pm-icon { width: 20px; height: 20px; }

.pm-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.pm-brand-text strong { font-size: 15px; font-weight: 650; color: var(--pm-text); }
.pm-brand-text small { font-size: 12px; color: var(--pm-muted); }

.pm-nav {
    flex: 1;
    overflow-y: auto;
    padding: 6px 12px 16px;
}

.pm-section {
    margin: 18px 10px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9ca3af;
}

.pm-nav form { margin: 0; }

.pm-sidebar .pm-item,
.pm-sidebar a.pm-item:link,
.pm-sidebar a.pm-item:visited {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 8px 10px;
    margin: 1px 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--pm-text-2);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.12s, color 0.12s;
}

.pm-sidebar .pm-item .pm-icon { color: #9ca3af; transition: color 0.12s; }

.pm-sidebar .pm-item:hover,
.pm-sidebar a.pm-item:hover {
    background: #f3f4f6;
    color: var(--pm-text);
}

.pm-sidebar .pm-item:hover .pm-icon { color: var(--pm-text-2); }

.pm-sidebar .pm-item.is-active,
.pm-sidebar a.pm-item.is-active:link,
.pm-sidebar a.pm-item.is-active:visited {
    background: var(--pm-primary-soft);
    color: var(--pm-primary-strong);
    font-weight: 600;
}

.pm-sidebar .pm-item.is-active .pm-icon { color: var(--pm-primary); }

.pm-sidebar .pm-item:focus-visible {
    outline: 2px solid var(--pm-primary);
    outline-offset: 1px;
}

/* Usuario al pie */
.pm-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid var(--pm-border);
}

.pm-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 13px;
    font-weight: 650;
    flex-shrink: 0;
}

.pm-user-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; flex: 1; }
.pm-user-info strong { font-size: 13.5px; font-weight: 600; color: var(--pm-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-user-info small { font-size: 12px; color: var(--pm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pm-logout-form { margin: 0; }

.pm-logout {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--pm-muted);
    cursor: pointer;
}

.pm-logout:hover { background: #fef2f2; color: #b91c1c; }

/* ------------------------------------------------------------------ */
/* Barra superior y contenido                                         */
/* ------------------------------------------------------------------ */

html.fixed .header.pm-header {
    display: none;
}

html.fixed .inner-wrapper {
    padding-top: 0;
    min-height: 100vh;
}

html.fixed .content-body {
    margin-left: var(--pm-sidebar-w);
    padding: 28px 36px 40px;
}

html.fixed .content-body > .p-3 {
    padding: 0 !important;
    max-width: 1360px;
}

/* Tarjetas y tablas de Element Plus un poco más limpias */
html.fixed .content-body .el-table {
    border-radius: var(--pm-radius);
    overflow: hidden;
    border: 1px solid var(--pm-border);
    --el-table-header-bg-color: #f9fafb;
}

html.fixed .content-body .el-table th.el-table__cell {
    font-weight: 600;
    color: var(--pm-text-2);
    font-size: 13px;
}

html.fixed .content-body .el-card {
    border-radius: var(--pm-radius);
    border-color: var(--pm-border);
}

/* ------------------------------------------------------------------ */
/* Pantallas pequeñas: menú fuera de pantalla que se abre con el botón */
/* ------------------------------------------------------------------ */

@media (max-width: 767px) {
    html.fixed .header.pm-header {
        display: flex;
        align-items: center;
        gap: 10px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        margin: 0;
        padding: 0 12px;
        background: var(--pm-surface);
        border-bottom: 1px solid var(--pm-border);
        z-index: 1020;
    }

    /* El tema pinta .toggle-sidebar-left como un círculo gris: se anula. */
    html.fixed .header .pm-menu-toggle {
        display: grid;
        place-items: center;
        width: 40px !important;
        height: 40px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 8px !important;
        background: transparent !important;
        color: var(--pm-text) !important;
        line-height: 1 !important;
    }

    html.fixed .header .pm-menu-toggle:hover { background: #f3f4f6 !important; }

    .pm-menu-toggle .pm-icon { width: 22px; height: 22px; }
    .pm-header-brand { font-weight: 600; font-size: 15px; color: var(--pm-text); }

    html.fixed .inner-wrapper {
        padding-top: 56px;
        margin-left: 0;
        padding-right: 0;
    }

    /* En móvil el tema pone el menú a todo el ancho y controla su posición con
       reglas más específicas; aquí se manda con !important. */
    html.fixed .sidebar-left.pm-sidebar {
        top: 0 !important;
        left: 0 !important;
        right: auto !important;
        width: 280px !important;
        min-width: 0 !important;
        max-width: 85vw !important;
        margin-left: 0 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.2s ease;
        box-shadow: none;
        z-index: 1040;
    }

    html.fixed.sidebar-left-opened .sidebar-left.pm-sidebar {
        transform: translateX(0) !important;
        box-shadow: 0 10px 40px rgba(17, 24, 39, 0.18);
    }

    /* El contenido no se mueve al abrir el menú (el tema lo desplaza). */
    html.fixed.sidebar-left-opened .inner-wrapper,
    html.fixed.sidebar-left-opened .content-body,
    html.fixed.sidebar-left-opened .header.pm-header {
        transform: none !important;
        margin-left: 0 !important;
        left: 0 !important;
    }

    html.fixed .content-body {
        margin-left: 0;
        padding: 20px 16px 32px;
    }
}

/* ------------------------------------------------------------------ */
/* Acceso (login): layouts/auth.blade.php                              */
/* ------------------------------------------------------------------ */

.pa-body {
    margin: 0;
    min-height: 100vh;
    background: var(--pm-bg);
    color: var(--pm-text);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.pa-shell {
    display: grid;
    grid-template-columns: minmax(380px, 46%) 1fr;
    min-height: 100vh;
}

/* Panel de marca */
.pa-brand-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 48px;
    background:
        radial-gradient(circle at 85% 10%, rgba(255, 255, 255, 0.14), transparent 45%),
        linear-gradient(160deg, #1e3a8a 0%, #1d4ed8 55%, #2563eb 100%);
    color: #fff;
}

.pa-brand { display: flex; align-items: center; gap: 10px; }
.pa-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.pa-brand-text strong { font-size: 16px; font-weight: 650; }
.pa-brand-text small { font-size: 12.5px; opacity: 0.8; }

.pa-brand-panel .pm-brand-mark { background: rgba(255, 255, 255, 0.16); }
.pa-brand-panel .pm-icon { width: 20px; height: 20px; }

.pa-pitch h2 {
    max-width: 440px;
    margin: 0 0 24px;
    color: #fff;
    font-size: 28px;
    font-weight: 650;
    line-height: 1.25;
    letter-spacing: -0.015em;
}

.pa-pitch ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; max-width: 440px; }
.pa-pitch li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.45; color: rgba(255, 255, 255, 0.9); }
.pa-pitch li .pm-icon { margin-top: 2px; opacity: 0.85; }

.pa-foot { margin: 0; font-size: 13px; color: rgba(255, 255, 255, 0.65); }

/* Formulario */
.pa-form-panel { display: grid; place-items: center; padding: 40px 24px; }

.pa-card { width: 100%; max-width: 400px; }

.pa-brand-mobile { display: none; margin-bottom: 28px; }
.pa-brand-mobile .pa-brand-text small { color: var(--pm-muted); opacity: 1; }

.pa-title { margin: 0 0 6px; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--pm-text); }
.pa-subtitle { margin: 0 0 24px; font-size: 15px; color: var(--pm-text-2); }

.pa-alert {
    margin-bottom: 18px;
    padding: 11px 14px;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 14px;
}
.pa-alert.is-ok { border-color: #bbf7d0; background: #f0fdf4; color: #15803d; }

.pa-form { display: grid; gap: 16px; }

.pa-field { display: grid; gap: 6px; }
.pa-field label { font-size: 14px; font-weight: 600; color: var(--pm-text); }
.pa-field-row { display: flex; align-items: baseline; justify-content: space-between; }

.pa-field input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    color: var(--pm-text);
    font: inherit;
    font-size: 15px;
    box-sizing: border-box;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.pa-field input::placeholder { color: #9ca3af; }
.pa-field input:focus { outline: none; border-color: var(--pm-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
.pa-field input.is-invalid { border-color: #f87171; }

.pa-password { position: relative; }
.pa-password input { padding-right: 84px; }
.pa-reveal {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    height: 32px;
    padding: 0 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--pm-text-2);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.pa-reveal:hover { background: #f3f4f6; color: var(--pm-text); }

.pa-link, .pa-link:link, .pa-link:visited { font-size: 13.5px; font-weight: 500; color: var(--pm-primary); text-decoration: none; }
.pa-link:hover { text-decoration: underline; color: var(--pm-primary-strong); }

.pa-check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--pm-text-2); cursor: pointer; user-select: none; }
.pa-check input { width: 17px; height: 17px; accent-color: var(--pm-primary); margin: 0; }

.pa-submit {
    height: 46px;
    margin-top: 4px;
    border: 0;
    border-radius: 10px;
    background: var(--pm-primary);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.12s, box-shadow 0.12s;
}
.pa-submit:hover { background: var(--pm-primary-strong); }
.pa-submit:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35); }

.pa-note { margin: 22px 0 0; font-size: 13.5px; color: var(--pm-muted); text-align: center; }

@media (max-width: 899px) {
    .pa-shell { grid-template-columns: 1fr; }
    .pa-brand-panel { display: none; }
    .pa-brand-mobile { display: flex; }
    .pa-form-panel { place-items: start center; padding: 48px 20px; }
}

/* Alta de usuarios del panel (auth/register.blade.php). Aquí y no en la vista:
   Vue monta sobre el contenido y descarta las etiquetas <style>. */
.pr-intro { color: var(--pm-text-2); font-size: 14px; margin: 6px 0 18px; }
.pa-card.pr-card { max-width: 460px; padding: 24px; background: var(--pm-surface); border: 1px solid var(--pm-border); border-radius: 12px; }
.pr-hint { font-size: 12.5px; color: var(--pm-muted); }
