/* =========================================================
   DESIGN TOKENS Y VARIABLES GLOBALES (CORPORATE PALETTE)
   ========================================================= */
:root {
    /* Paleta Institucional Propuesta */
    --azul-institucional: #0F4571; /* Principal / Confianza */
    --azul-vivo: #1769A8;          /* Interacciones / Activo */
    --azul-claro: #5FA9D6;         /* Secundario / Apoyo */
    --dorado-institucional: #D9B15A; /* Acento / Importante */
    --amarillo-vivo: #F2C94C;      /* Éxito / Destacado */
    --carbon: #3A3132;             /* Texto / Énfasis */
    --fondo-claro: #F8F9FA;        /* Fondo principal */
    --superficie: #EEF3F7;         /* Superficies / Tarjetas */

    /* Escala de Azules */
    --azul-100: #0F4571;
    --azul-80: #14619B;
    --azul-60: #367FBF;
    --azul-40: #5FA9D6;
    --azul-20: #BBD8EB;
    --azul-10: #E6F0F7;
    --azul-5: #F2F7FA;

    /* Mapeo de Variables Funcionales */
    --primary: var(--azul-institucional);
    --primary-hover: var(--azul-vivo);
    --primary-light: var(--azul-10);
    --secondary: var(--azul-vivo);
    --accent: var(--dorado-institucional);
    --accent-hover: #C29B45;
    --highlight: var(--amarillo-vivo);

    /* Superficies y Fondos */
    --surface-bg: #EFF3F8;
    --surface-card: #FFFFFF;
    --surface-card-subtle: #F1F5F9;
    --surface-sidebar: #0F2A42;
    --surface-sidebar-hover: #143A5B;

    /* Tipografía */
    --text-main: var(--carbon);
    --text-secondary: #4A4041;
    --text-muted: #736B6C;
    --text-light: #FFFFFF;
    --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Bordes y Sombras Modernas (2026 Enterprise) */
    --border-color: #D6E2EB;
    --border-focus: var(--azul-40);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-pill: 9999px;
    
    --shadow-sm: 0 1px 2px 0 rgba(15, 69, 113, 0.05);
    --shadow-md: 0 4px 12px -1px rgba(15, 69, 113, 0.08), 0 2px 4px -2px rgba(15, 69, 113, 0.04);
    --shadow-lg: 0 12px 24px -4px rgba(15, 69, 113, 0.12), 0 4px 8px -2px rgba(15, 69, 113, 0.06);
    --shadow-card: 0 4px 20px -2px rgba(15, 69, 113, 0.06), 0 2px 6px -1px rgba(15, 69, 113, 0.03);
    --shadow-card-hover: 0 16px 32px -4px rgba(15, 69, 113, 0.13), 0 6px 12px -2px rgba(15, 69, 113, 0.05);
    --shadow-gold: 0 4px 14px rgba(217, 177, 90, 0.35);
    --shadow-blue: 0 4px 14px rgba(23, 105, 168, 0.3);

    /* Curvas de Animación Fluidas */
    --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

    /* Estados de Proyecto y Tareas */
    --status-done: #10B981;
    --status-progress: var(--azul-vivo);
    --status-review: var(--dorado-institucional);
    --status-todo: var(--text-muted);
    --status-danger: #EF4444;
}

/* Reset Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--surface-bg);
    background-image: radial-gradient(rgba(15, 69, 113, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =========================================================
   ESTRUCTURA DE LAYOUT (TOPBAR + SIDEBAR + CONTENIDO)
   ========================================================= */
.app-layout-wrapper {
    display: flex;
    min-height: calc(100vh - 70px);
    width: 100%;
    position: relative;
}

.app-content-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--surface-bg);
}

main.app-container {
    flex: 1;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 2rem 2rem;
}

main.app-container-auth {
    max-width: 500px;
    margin: auto;
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    main.app-container {
        padding: 1.25rem 1rem;
    }
}

/* Tipografía de Encabezados */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-main);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Componentes Compartidos: Botones */
.btn-primary-gp {
    background: linear-gradient(135deg, var(--azul-institucional) 0%, var(--azul-vivo) 100%);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.65rem 1.35rem;
    font-size: 0.925rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: transform 0.22s var(--ease-spring), box-shadow 0.22s var(--ease-spring), filter 0.22s ease;
}

.btn-primary-gp:hover {
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: var(--shadow-blue);
    filter: brightness(1.06);
}

.btn-primary-gp:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-gold-gp {
    background: linear-gradient(135deg, var(--dorado-institucional) 0%, #E8C36A 100%);
    color: #1E1B18;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.65rem 1.35rem;
    font-size: 0.925rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    box-shadow: var(--shadow-gold);
    transition: transform 0.22s var(--ease-spring), box-shadow 0.22s var(--ease-spring), filter 0.22s ease;
}

.btn-gold-gp:hover {
    color: #1E1B18;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(217, 177, 90, 0.45);
    filter: brightness(1.05);
}

.btn-gold-gp:active {
    transform: translateY(0);
}

.btn-secondary-gp {
    background-color: #FFFFFF;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.65rem 1.25rem;
    font-size: 0.925rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: transform 0.22s var(--ease-spring), background-color 0.2s ease, border-color 0.2s ease;
}

.btn-secondary-gp:hover {
    background-color: var(--superficie);
    border-color: var(--azul-40);
    color: var(--primary);
    transform: translateY(-1px);
}

/* Badges Compartidos Modernos */
.badge-gp {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}

/* Pulso de Estado en Vivo (Radar Live Pulse) */
.badge-pulse {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-pulse::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--amarillo-vivo);
    box-shadow: 0 0 0 0 rgba(242, 201, 76, 0.7);
    animation: pulse-ring 1.8s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(242, 201, 76, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(242, 201, 76, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(242, 201, 76, 0);
    }
}

/* Barra de Progreso con Gradiente y Shimmer Animado */
.progress-bar-animated-gp {
    background: linear-gradient(90deg, var(--azul-vivo) 0%, var(--azul-claro) 65%, var(--dorado-institucional) 100%);
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-pill);
    height: 8px;
}

.progress-bar-animated-gp::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: shimmer 2.4s infinite;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}

/* Tarjetas Base (Cards con Profundidad Multicapa & Rim Light) */
.card-gp {
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFD 100%);
    border: 1px solid rgba(15, 69, 113, 0.12);
    border-radius: 18px;
    box-shadow: 
        0 1px 0 rgba(255, 255, 255, 0.95) inset,
        0 4px 18px -2px rgba(15, 69, 113, 0.07),
        0 12px 28px -6px rgba(15, 69, 113, 0.05);
    padding: 1.8rem;
    position: relative;
    transition: transform 0.28s var(--ease-spring), box-shadow 0.28s var(--ease-spring), border-color 0.28s ease;
}

.card-gp:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 1px 0 rgba(255, 255, 255, 0.95) inset,
        0 14px 34px -4px rgba(15, 69, 113, 0.14),
        0 24px 48px -10px rgba(15, 69, 113, 0.08);
    border-color: rgba(23, 105, 168, 0.32);
}

/* Contenedor de Formularios de Alta Gama (Luxury Form Card) */
.form-card-gp {
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFD 100%);
    border: 1px solid rgba(15, 69, 113, 0.13);
    border-radius: 20px;
    box-shadow: 
        0 1px 0 rgba(255, 255, 255, 0.95) inset,
        0 8px 24px -4px rgba(15, 69, 113, 0.08),
        0 24px 48px -12px rgba(15, 69, 113, 0.06);
    padding: 2.25rem 2.5rem;
    position: relative;
    overflow: hidden;
}

.form-card-gp::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--azul-institucional) 0%, var(--azul-vivo) 50%, var(--dorado-institucional) 100%);
}

/* =========================================================
   FORMULARIOS Y CONTROLES PROFESIONALES (NON-FLAT)
   ========================================================= */
.form-group-gp {
    margin-bottom: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.form-label-gp {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--carbon);
    margin-bottom: 0.2rem;
    letter-spacing: -0.01em;
}

.form-label-gp .required {
    color: #DC2626;
    font-weight: 800;
    margin-left: 0.2rem;
}

.form-control-gp {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.935rem;
    font-family: inherit;
    font-weight: 500;
    border: 1.5px solid #D1DFEB;
    border-radius: 12px;
    background-color: #FFFFFF;
    color: var(--carbon);
    box-shadow: inset 0 2px 4px rgba(15, 69, 113, 0.03);
    transition: all 0.22s var(--ease-spring);
}

.form-control-gp::placeholder {
    color: #94A3B8;
    font-weight: 400;
}

.form-control-gp:hover {
    border-color: var(--azul-claro);
    background-color: #FCFEFF;
}

.form-control-gp:focus {
    outline: none;
    border-color: var(--azul-vivo);
    background-color: #FFFFFF;
    box-shadow: 
        0 0 0 4px rgba(23, 105, 168, 0.15),
        inset 0 1px 2px rgba(15, 69, 113, 0.05);
    transform: translateY(-1px);
}

/* Inputs con Icono Interactivos */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-with-icon i {
    position: absolute;
    left: 1.15rem;
    top: 50%;
    transform: translateY(-50%);
    color: #8FA0B5;
    font-size: 1.25rem;
    transition: all 0.22s var(--ease-spring);
    pointer-events: none;
    z-index: 3;
}

.input-with-icon input,
.input-with-icon select,
.input-with-icon textarea {
    padding-left: 3.15rem !important;
}

.input-with-icon:focus-within i {
    color: var(--azul-vivo);
    transform: translateY(-50%) scale(1.18);
}

.label-hint {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 0.35rem;
}

/* Select Personalizado con Flecha SVG Institucional */
select.form-control-gp {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231769A8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.15rem center;
    background-size: 16px;
    padding-right: 2.75rem;
    cursor: pointer;
}

/* Barra de Acciones de Formulario Grounded (Footer Elegante) */
.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    background: rgba(238, 243, 247, 0.65);
    border-top: 1px solid rgba(15, 69, 113, 0.1);
    padding: 1.25rem 2rem;
    margin: 2rem -2.5rem -2.25rem -2.5rem;
    border-radius: 0 0 20px 20px;
}

/* Previsualización Universal de Archivos e Imágenes */
.file-preview-card {
    display: none;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--superficie);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    align-items: center;
    gap: 1rem;
    animation: fadeIn 0.25s ease-in-out;
}

.file-preview-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-color);
    background: #FFFFFF;
    flex-shrink: 0;
}

.file-preview-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    background: var(--azul-10);
    color: var(--azul-institucional);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

.file-preview-info {
    flex: 1;
    overflow: hidden;
}

.file-preview-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-meta {
    font-size: 0.775rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-preview-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--dorado-institucional);
    color: #FFFFFF;
    border-radius: 4px;
}

.file-preview-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.file-preview-remove:hover {
    color: var(--status-danger);
    background: rgba(239, 68, 68, 0.1);
}

/* =========================================================
   SISTEMA RESPONSIVE GLOBAL ADAPTATIVO (100% MOBILE-READY)
   ========================================================= */
@media (max-width: 992px) {
    main.app-container {
        padding: 1.75rem 1.25rem;
    }
}

@media (max-width: 768px) {
    main.app-container {
        padding: 1.25rem 0.85rem;
    }

    .form-card-gp {
        padding: 1.5rem 1.15rem;
        border-radius: 16px;
    }

    .form-actions {
        margin: 1.5rem -1.15rem -1.15rem -1.15rem;
        padding: 1rem 1.15rem;
        border-radius: 0 0 16px 16px;
        flex-direction: column-reverse;
        width: calc(100% + 2.3rem);
    }

    .form-actions .btn-primary-gp,
    .form-actions .btn-gold-gp,
    .form-actions .btn-secondary-gp {
        width: 100%;
        justify-content: center;
    }

    .card-gp {
        padding: 1.25rem;
        border-radius: 14px;
    }

    h2 {
        font-size: 1.45rem;
    }
}

@media (max-width: 480px) {
    main.app-container {
        padding: 1rem 0.65rem;
    }

    .form-card-gp {
        padding: 1.25rem 0.85rem;
        border-radius: 12px;
    }

    .form-actions {
        margin: 1.25rem -0.85rem -0.85rem -0.85rem;
        padding: 0.85rem;
        border-radius: 0 0 12px 12px;
        width: calc(100% + 1.7rem);
    }

    .input-with-icon input,
    .input-with-icon select,
    .input-with-icon textarea {
        padding-left: 2.85rem !important;
        font-size: 0.88rem;
    }

    .input-with-icon i {
        left: 0.95rem;
        font-size: 1.15rem;
    }
}
