v1.31.0
conocimientowebapp-layouttemplates/26.023 B

site.css

Fichero que /hv:webapp-layout usa o materializa en el proyecto. Se muestra tal cual está en el plugin.

webapp-layoutskill
templatescarpeta
26.023 Btamaño
2026-10-03último cambio del pack
/* =============================================
   Site CSS - Layout estándar

   ÍNDICE:
   1. Variables CSS (Colores Corporativos)
   2. Reset y Base
   3. Layout Principal
   4. Header
   5. Sidebar
   6. Contenido Principal
   7. Footer
   8. Componentes UI
   9. Utilidades de Accesibilidad
   10. Responsive Design
   11. Animaciones y Transiciones
   12. Modo Oscuro (opcional)
   ============================================= */

/* ═══════════════════════════════════════════════════════════════
   1. VARIABLES CSS - TOKENS DE TEMA (theme.* del ecosystem.config)
   ═══════════════════════════════════════════════════════════════ */

:root {
    /* Colores Principales */
    --brand-primary: #33475B;
    --brand-primary-light: #0066CC;
    --brand-primary-hover: #004D99;
    --brand-primary-light: #E6F0FF;

    /* Colores Neutros */
    --brand-neutral-dark: #333333;
    --brand-neutral-medio: #666666;
    --brand-neutral-light: #F5F5F5;
    --brand-white: #FFFFFF;
    --brand-borde: #DDDDDD;

    /* Colores de Estado
       Dos tokens por estado, y no es decoracion: el color de MARCA vale para fondos, bordes,
       iconos y texto grande (umbral 3:1), y el token -texto es el que cumple 4.5:1 sobre blanco.
       Medido: #28A745 da 3.13 y #17A2B8 da 3.04 -- validos como interfaz, NO como texto --, y
       #FFC107 da 1.63, que no llega ni a 3:1: el amarillo es un fondo, nunca un color de letra.
       El producto los declaraba los tres como 4.5:1. Los ratios no se anotan: los calcula
       scripts/check-a11y.js desde criteria/a11y.json (ADR-083). */
    --brand-error: #CC0000;          /* cumple 4.5:1, sirve tambien como texto */
    --brand-error-texto: #CC0000;
    --brand-error-bg: #FFE6E6;
    --brand-exito: #28A745;          /* interfaz */
    --brand-exito-texto: #1E7E34;    /* texto */
    --brand-exito-bg: #E6F4EA;
    --brand-warning: #FFC107;        /* SOLO fondo: sobre blanco no llega ni a 3:1 */
    --brand-warning-texto: #664D03;  /* texto */
    --brand-warning-bg: #FFF8E1;
    --brand-info: #17A2B8;           /* interfaz */
    --brand-info-texto: #117A8B;     /* texto */
    --brand-info-bg: #E1F5FE;

    /* Contraste reforzado (WCAG 1.4.6, 7:1). Se usan EN LUGAR de los `-texto` de arriba cuando
       accessibility.contrastLevel vale 'aaa'. Solo existen para los seis colores de texto que no
       llegaban: los demas (#33475B, #333333, #664D03 y el blanco sobre azul) ya pasan de 7:1 sin
       tocarlos. Los valores salen de criteria/a11y.json; el ratio no se anota, se calcula. */
    --brand-texto-atenuado-aaa: #595959;
    --brand-enlace-aaa: #3C5A86;
    --brand-enlace-alterno-aaa: #0057AE;
    --brand-error-aaa: #B60000;
    --brand-exito-texto-aaa: #18662A;
    --brand-info-texto-aaa: #0E6270;

    /* Sombras */
    --brand-sombra-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --brand-sombra-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --brand-sombra-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    /* Layout */
    --header-height: 60px;
    --footer-height: 40px;
    --sidebar-width: 250px;
    --sidebar-collapsed: 60px;
    --content-padding: 24px;

    /* Tipografía */
    --font-family-base: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-size-base: 16px;
    --font-size-h1: 2rem;
    --font-size-h2: 1.75rem;
    --font-size-h3: 1.5rem;
    --line-height-base: 1.5;

    /* Z-Index */
    --z-sidebar: 900;
    --z-header: 1000;
    --z-modal: 1100;
    --z-tooltip: 1200;
    --z-notification: 1300;

    /* Transiciones */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;

    /* Breakpoints (para referencia en media queries) */
    --breakpoint-mobile: 768px;
    --breakpoint-tablet: 1200px;
}

/* ═══════════════════════════════════════════════════════════════
   2. RESET Y BASE
   ═══════════════════════════════════════════════════════════════ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family-base);
    font-size: 1rem;
    line-height: var(--line-height-base);
    color: var(--brand-neutral-dark);
    background-color: var(--brand-white);
    min-height: 100vh;
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar main"
        "footer footer";
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr var(--footer-height);
}

body.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed) 1fr;
}

/* Tipografía */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--brand-primary);
}

h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); }

p {
    margin-top: 0;
    margin-bottom: 1rem;
}

a {
    color: var(--brand-primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--brand-primary);
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--brand-primary-light);
    outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   3. LAYOUT PRINCIPAL
   ═══════════════════════════════════════════════════════════════ */

/* Skip Link - Accesibilidad */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--brand-primary);
    color: var(--brand-white);
    padding: 8px 16px;
    z-index: calc(var(--z-header) + 1);
    transition: top var(--transition-normal);
    text-decoration: none;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid var(--brand-primary-light);
    outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   4. HEADER
   ═══════════════════════════════════════════════════════════════ */

.header {
    grid-area: header;
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 20px;
    background-color: var(--brand-primary);
    color: var(--brand-white);
    z-index: var(--z-header);
    box-shadow: var(--brand-sombra-md);
}

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

.header-logo img {
    display: block;
    height: 40px;
    width: auto;
}

.header-app-name {
    font-size: 1.2rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Hamburger Menu */
.hamburger {
    display: none;
    background: none;
    border: none;
    padding: 12px;
    cursor: pointer;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--brand-white);
    margin: 5px 0;
    transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.hamburger.open .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.open .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger.open .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* User Menu */
.header-nav {
    display: flex;
    align-items: center;
}

.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 20px;
    color: var(--brand-white);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.user-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--brand-primary-light);
    border-radius: 50%;
    font-weight: 600;
}

.user-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-arrow {
    font-size: 10px;
    transition: transform var(--transition-fast);
}

.user-menu-toggle[aria-expanded="true"] .user-menu-arrow {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    min-width: 200px;
    background: var(--brand-white);
    border-radius: 8px;
    box-shadow: var(--brand-sombra-lg);
    list-style: none;
    padding: 8px 0;
    z-index: var(--z-header);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    color: var(--brand-neutral-dark);
    text-align: left;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.user-menu-item:hover {
    background-color: var(--brand-neutral-light);
    text-decoration: none;
}

.user-menu-logout {
    color: var(--brand-error);
}

.menu-separator {
    height: 1px;
    margin: 8px 0;
    background: var(--brand-borde);
}

.header-login-btn {
    padding: 8px 20px;
    background: var(--brand-white);
    color: var(--brand-primary);
    border-radius: 4px;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.header-login-btn:hover {
    background: var(--brand-primary-light);
    text-decoration: none;
}

/* ═══════════════════════════════════════════════════════════════
   5. SIDEBAR
   ═══════════════════════════════════════════════════════════════ */

.sidebar {
    grid-area: sidebar;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    width: var(--sidebar-width);
    background: var(--brand-neutral-light);
    border-right: 1px solid var(--brand-borde);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: var(--z-sidebar);
    transition: width var(--transition-normal);
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
}

.nav-menu {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}

.nav-item {
    margin: 2px 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--brand-neutral-dark);
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.nav-link:hover {
    background: var(--brand-white);
    color: var(--brand-primary);
    text-decoration: none;
}

.nav-link:focus {
    outline: 2px solid var(--brand-primary-light);
    outline-offset: -2px;
}

.nav-link.active {
    background: var(--brand-primary);
    color: var(--brand-white);
}

.nav-icon {
    flex-shrink: 0;
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--transition-fast);
}

.sidebar-collapsed .nav-text {
    opacity: 0;
    width: 0;
}

.nav-arrow {
    font-size: 10px;
    transition: transform var(--transition-fast);
}

.nav-item.expanded .nav-arrow {
    transform: rotate(180deg);
}

/* Submenú */
.nav-submenu {
    list-style: none;
    padding: 0;
    margin: 4px 0 0 36px;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
}

.nav-item.expanded .nav-submenu {
    max-height: 500px;
}

.nav-sublink {
    display: block;
    padding: 8px 12px;
    color: var(--brand-neutral-medio);
    font-size: 0.9rem;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.nav-sublink:hover {
    background: var(--brand-white);
    color: var(--brand-primary);
    text-decoration: none;
}

.nav-separator {
    height: 1px;
    margin: 12px 16px;
    background: var(--brand-borde);
}

/* Sidebar Toggle */
.sidebar-toggle {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--brand-white);
    color: var(--brand-neutral-dark);
    cursor: pointer;
    box-shadow: var(--brand-sombra-sm);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--brand-primary);
    color: var(--brand-white);
}

.sidebar-collapsed .sidebar-toggle .toggle-icon {
    transform: rotate(180deg);
}

/* Overlay para móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-sidebar) - 1);
}

/* ═══════════════════════════════════════════════════════════════
   6. CONTENIDO PRINCIPAL
   ═══════════════════════════════════════════════════════════════ */

.content-wrapper {
    grid-area: main;
    padding: var(--content-padding);
    background: var(--brand-white);
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
}

/* Breadcrumb */
.breadcrumb-nav {
    margin-bottom: 20px;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    padding: 0 8px;
    color: var(--brand-neutral-medio);
}

.breadcrumb-item a {
    color: var(--brand-primary-light);
}

.breadcrumb-item.active {
    color: var(--brand-neutral-medio);
}

/* Main content focus */
#main-content:focus {
    outline: none;
}

/* ═══════════════════════════════════════════════════════════════
   7. FOOTER
   ═══════════════════════════════════════════════════════════════ */

.footer {
    grid-area: footer;
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--footer-height);
    padding: 0 20px;
    background: var(--brand-neutral-light);
    border-top: 1px solid var(--brand-borde);
    font-size: 0.85rem;
    color: var(--brand-neutral-medio);
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.footer-separator {
    margin: 0 8px;
    color: var(--brand-borde);
}

.footer-link {
    color: var(--brand-neutral-medio);
}

.footer-link:hover {
    color: var(--brand-primary);
}

/* ═══════════════════════════════════════════════════════════════
   8. COMPONENTES UI
   ═══════════════════════════════════════════════════════════════ */

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn:focus {
    outline: 2px solid var(--brand-primary-light);
    outline-offset: 2px;
}

.btn-brand-primary {
    background: var(--brand-primary);
    color: var(--brand-white);
}

.btn-brand-primary:hover {
    background: var(--brand-primary-hover);
    transform: translateY(-1px);
    text-decoration: none;
    color: var(--brand-white);
}

.btn-brand-secondary {
    background: var(--brand-white);
    color: var(--brand-primary);
    border: 2px solid var(--brand-primary);
}

.btn-brand-secondary:hover {
    background: var(--brand-primary-light);
    text-decoration: none;
}

/* Alertas */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    border-left: 4px solid;
    margin-bottom: 16px;
}

.alert-error {
    background: var(--brand-error-bg);
    border-color: var(--brand-error);
    color: var(--brand-neutral-dark);
}

.alert-success {
    background: var(--brand-exito-bg);
    border-color: var(--brand-exito);
}

.alert-warning {
    background: var(--brand-warning-bg);
    border-color: var(--brand-warning);
}

.alert-info {
    background: var(--brand-info-bg);
    border-color: var(--brand-info);
}

/* Cards */
.card {
    background: var(--brand-white);
    border: 1px solid var(--brand-borde);
    border-radius: 8px;
    box-shadow: var(--brand-sombra-sm);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--brand-borde);
    background: var(--brand-neutral-light);
    border-radius: 8px 8px 0 0;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--brand-borde);
    background: var(--brand-neutral-light);
    border-radius: 0 0 8px 8px;
}

/* Formularios */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--brand-neutral-dark);
}

.form-control {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid var(--brand-borde);
    border-radius: 4px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    border-color: var(--brand-primary-light);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2);
}

.form-control.is-invalid {
    border-color: var(--brand-error);
}

.invalid-feedback {
    display: none;
    margin-top: 4px;
    font-size: 0.875rem;
    color: var(--brand-error);
}

.form-control.is-invalid ~ .invalid-feedback {
    display: block;
}

.form-text {
    display: block;
    margin-top: 4px;
    font-size: 0.875rem;
    color: var(--brand-neutral-medio);
}

/* Tablas */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--brand-borde);
}

.table th {
    background: var(--brand-neutral-light);
    font-weight: 600;
    color: var(--brand-primary);
}

.table tbody tr:hover {
    background: var(--brand-primary-light);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ═══════════════════════════════════════════════════════════════
   9. UTILIDADES DE ACCESIBILIDAD
   ═══════════════════════════════════════════════════════════════ */

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Focus visible */
:focus-visible {
    outline: 2px solid var(--brand-primary-light);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   10. RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════════ */

/* Tablet (768px - 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
    :root {
        --font-size-h1: 1.75rem;
        --font-size-h2: 1.5rem;
        --font-size-h3: 1.25rem;
    }

    body {
        grid-template-columns: var(--sidebar-collapsed) 1fr;
    }

    .sidebar {
        width: var(--sidebar-collapsed);
    }

    .sidebar:hover {
        width: var(--sidebar-width);
    }

    .sidebar:hover .nav-text {
        opacity: 1;
        width: auto;
    }

    .nav-submenu {
        display: none;
    }

    .sidebar:hover .nav-submenu {
        display: block;
    }
}

/* Mobile (< 768px) */
@media (max-width: 767px) {
    :root {
        --content-padding: 16px;
        --font-size-h1: 1.5rem;
        --font-size-h2: 1.25rem;
        --font-size-h3: 1.125rem;
    }

    body {
        grid-template-areas:
            "header"
            "main"
            "footer";
        grid-template-columns: 1fr;
        grid-template-rows: var(--header-height) 1fr auto;
    }

    .hamburger {
        display: block;
    }

    .header-app-name {
        font-size: 1rem;
    }

    .user-name {
        display: none;
    }

    .sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        width: 280px;
        height: calc(100vh - var(--header-height));
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.open ~ .sidebar-overlay {
        display: block;
    }

    .sidebar-toggle {
        display: none;
    }

    .content-wrapper {
        margin-left: 0;
    }

    .footer {
        position: static;
        height: auto;
        padding: 16px;
    }

    .footer-content {
        flex-direction: column;
        gap: 8px;
    }

    .footer-separator {
        display: none;
    }

    /* Tablas responsive */
    .table-cards thead {
        display: none;
    }

    .table-cards tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid var(--brand-borde);
        border-radius: 8px;
        padding: 12px;
    }

    .table-cards td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: 1px solid var(--brand-borde);
    }

    .table-cards td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--brand-neutral-dark);
    }

    .table-cards td:last-child {
        border-bottom: none;
    }
}

/* Desktop grande (>= 1200px) */
@media (min-width: 1200px) {
    .content-wrapper {
        max-width: 1400px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   11. ANIMACIONES Y TRANSICIONES
   ═══════════════════════════════════════════════════════════════ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInLeft {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.animate-fadeIn {
    animation: fadeIn var(--transition-normal);
}

.animate-slideInLeft {
    animation: slideInLeft var(--transition-normal);
}

.animate-slideInUp {
    animation: slideInUp var(--transition-normal);
}

/* ═══════════════════════════════════════════════════════════════
   12. MODO OSCURO (OPCIONAL)
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
    /* Descomentar para habilitar modo oscuro automático */
    /*
    :root {
        --brand-white: #1a1a2e;
        --brand-neutral-light: #16213e;
        --brand-neutral-dark: #e6e6e6;
        --brand-neutral-medio: #a0a0a0;
        --brand-borde: #3a3a5a;
    }
    */
}

← Volver a la ficha de webapp-layout