/* ============================================================
   Despacho360 Access — Estilos frontend público  v1.1
   ============================================================ */

/* ── Variables ───────────────────────────────────────────── */
:root {
    --d360-blue:       #1a365d;
    --d360-blue-mid:   #2d4a7c;
    --d360-blue-lt:    #3d5a8c;
    --d360-brown:      #A0522D;
    --d360-brown-lt:   #B8703D;
    --d360-brown-xlt:  #d4a574;
    --d360-cream:      #FDF8F3;
    --d360-cream-dk:   #f5ede1;
    --d360-muted:      #5a6b7d;
    --d360-border:     rgba(26,54,93,.1);
    --d360-sh-sm:      0 2px 8px  rgba(26,54,93,.08);
    --d360-sh-md:      0 8px 32px rgba(26,54,93,.12);
    --d360-sh-lg:      0 20px 60px rgba(26,54,93,.18);
    --d360-r:          16px;
    --d360-r-sm:       10px;
    --d360-font:       'Outfit', 'Space Grotesk', -apple-system, sans-serif;
}

/* ── Reset scoped ────────────────────────────────────────── */
.d360-login-wrap *,
.d360-dash-wrap * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

.d360-login-wrap {
    font-family: var(--d360-font);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--d360-blue) 0%, var(--d360-blue-mid) 55%, #3d4e6b 100%);
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}
.d360-login-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.d360-bg-shape { position: absolute; border-radius: 50%; opacity: .06; }
.d360-bg-shape--1 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, var(--d360-brown-xlt), transparent 70%);
    top: -200px; right: -100px;
    animation: d360-float 8s ease-in-out infinite;
}
.d360-bg-shape--2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #fff, transparent 70%);
    bottom: -100px; left: -100px;
    animation: d360-float 12s ease-in-out infinite reverse;
}
.d360-bg-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
    background-size: 48px 48px;
}
@keyframes d360-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%       { transform: translateY(-20px) rotate(5deg); }
}
.d360-login-container {
    position: relative; z-index: 2;
    width: 100%; max-width: 440px;
    display: flex; flex-direction: column;
    align-items: center; gap: 32px;
}
.d360-login-brand {
    display: flex; align-items: center; gap: 14px; color: #fff;
    animation: d360-fade-up .6s ease both;
}
.d360-login-logo {
    width: 52px; height: 52px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 14px; display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(8px);
}
.d360-login-brand-text { display: flex; flex-direction: column; }
.d360-login-brand-name { font-family: 'Space Grotesk',sans-serif; font-size: 1.4rem; color: #fff; letter-spacing: -.5px; }
.d360-login-brand-name strong { color: var(--d360-brown-xlt); }
.d360-login-brand-tagline { font-size: .8rem; color: rgba(255,255,255,.6); letter-spacing: .5px; text-transform: uppercase; }
.d360-login-card {
    width: 100%; background: #fff; border-radius: 24px; padding: 44px 40px;
    box-shadow: var(--d360-sh-lg); animation: d360-fade-up .6s ease .1s both;
}
.d360-login-card-header { margin-bottom: 32px; text-align: center; }
.d360-login-title { font-family: 'Space Grotesk',sans-serif; font-size: 1.8rem; font-weight: 700; color: var(--d360-blue); margin-bottom: 6px; }
.d360-login-subtitle { font-size: .9rem; color: var(--d360-muted); }
.d360-login-error {
    display: flex; align-items: center; gap: 8px;
    background: #fff5f5; border: 1px solid #fed7d7; color: #c53030;
    padding: 12px 16px; border-radius: var(--d360-r-sm);
    font-size: .875rem; margin-bottom: 24px;
    animation: d360-shake .4s ease;
}
@keyframes d360-shake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-6px); }
    40%     { transform: translateX(6px); }
    60%     { transform: translateX(-4px); }
    80%     { transform: translateX(4px); }
}
.d360-login-form { display: flex; flex-direction: column; gap: 20px; }
.d360-field-label { display: block; font-size: .875rem; font-weight: 600; color: var(--d360-blue); margin-bottom: 8px; }
.d360-field-label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.d360-field-label-row .d360-field-label { margin-bottom: 0; }
.d360-field-input-wrap { position: relative; display: flex; align-items: center; }
.d360-field-icon { position: absolute; left: 16px; color: var(--d360-muted); display: flex; align-items: center; pointer-events: none; transition: color .2s; }
.d360-field-input {
    width: 100%; padding: 14px 16px 14px 48px;
    border: 1.5px solid #e2e8f0; border-radius: var(--d360-r-sm);
    font-family: var(--d360-font); font-size: .95rem; color: var(--d360-blue);
    background: #f8fafc; transition: all .2s; -webkit-appearance: none;
}
.d360-field-input:focus { outline: none; border-color: var(--d360-brown); background: #fff; box-shadow: 0 0 0 3px rgba(160,82,45,.08); }
.d360-field-input-wrap:focus-within .d360-field-icon { color: var(--d360-brown); }
.d360-field-input::placeholder { color: #a0aab4; }
.d360-field-toggle-pwd {
    position: absolute; right: 14px; background: none; border: none; cursor: pointer;
    color: var(--d360-muted); padding: 4px; display: flex; align-items: center; transition: color .2s;
}
.d360-login-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px;

    background: linear-gradient(135deg, var(--d360-brown) 0%, var(--d360-brown-lt) 100%);
    color: #fff;

    border: none;
    border-radius: var(--d360-radius-sm);

    font-family: var(--d360-font);
    font-size: 1rem;
    font-weight: 700;

    cursor: pointer;
    letter-spacing: .3px;
    margin-top: 8px;

    transition: all .25s ease;
}

/* HOVER directo */
.d360-login-submit:hover {
    background: linear-gradient(135deg, var(--d360-blue) 0%, var(--d360-blue-mid) 100%);
    transform: translateY(-1px);
}

/* opcional: click */
.d360-login-submit:active {
    transform: translateY(0);
}
.d360-login-submit span, .d360-login-submit svg { position: relative; z-index: 1; }
.d360-login-submit:hover::before { opacity: 1; }
.d360-login-submit:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(26,54,93,.3); }
.d360-login-submit:active { transform: translateY(0); }
.d360-login-footer { font-size: .8rem; color: rgba(255,255,255,.55); text-align: center; animation: d360-fade-up .6s ease .2s both; }
.d360-login-footer a { color: rgba(255,255,255,.75); text-decoration: none; }
.d360-login-footer a:hover { color: #fff; }
@keyframes d360-fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   DASHBOARD — RESET Y BASE
   ============================================================ */

.d360-dash-wrap {
    font-family: var(--d360-font);
    background: #eef1f6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Contenedor ancho — casi toda la pantalla */
.d360-container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 32px;
}

/* ── Partículas flotantes de fondo ───────────────────────── */
.d360-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.d360-particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(160, 82, 45, .08);
    animation: d360-drift linear infinite;
}
.d360-particle:nth-child(1)  { width:  80px; height:  80px; left:  5%; animation-duration: 18s; animation-delay:  0s; }
.d360-particle:nth-child(2)  { width: 120px; height: 120px; left: 15%; animation-duration: 22s; animation-delay: -5s; }
.d360-particle:nth-child(3)  { width:  60px; height:  60px; left: 30%; animation-duration: 16s; animation-delay: -2s; }
.d360-particle:nth-child(4)  { width: 200px; height: 200px; left: 50%; animation-duration: 28s; animation-delay: -8s; background: rgba(26,54,93,.04); }
.d360-particle:nth-child(5)  { width:  40px; height:  40px; left: 65%; animation-duration: 14s; animation-delay: -3s; }
.d360-particle:nth-child(6)  { width:  90px; height:  90px; left: 75%; animation-duration: 20s; animation-delay: -7s; }
.d360-particle:nth-child(7)  { width: 150px; height: 150px; left: 85%; animation-duration: 24s; animation-delay: -1s; background: rgba(26,54,93,.04); }
.d360-particle:nth-child(8)  { width:  50px; height:  50px; left: 92%; animation-duration: 17s; animation-delay: -9s; }
.d360-particle:nth-child(9)  { width: 100px; height: 100px; left: 20%; animation-duration: 21s; animation-delay: -4s; background: rgba(26,54,93,.03); }
.d360-particle:nth-child(10) { width:  70px; height:  70px; left: 42%; animation-duration: 19s; animation-delay: -6s; }
.d360-particle:nth-child(11) { width: 180px; height: 180px; left: 60%; animation-duration: 26s; animation-delay:-11s; background: rgba(160,82,45,.04); }
.d360-particle:nth-child(12) { width:  35px; height:  35px; left: 10%; animation-duration: 13s; animation-delay:-13s; }

@keyframes d360-drift {
    from { transform: translateY(110vh) scale(.5); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: .6; }
    to   { transform: translateY(-20vh) scale(1.2); opacity: 0; }
}

/* ============================================================
   HEADER
   ============================================================ */

.d360-header {
    position: relative; z-index: 10;
    background: linear-gradient(135deg, #122544 0%, #1A365D 100%);
    box-shadow: 0 4px 24px rgba(26,54,93,.25);
}
.d360-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    height: 72px;
    max-width: 1440px;
    margin: 0 auto;
    gap: 20px;
}

/* Logo */
.d360-logo-link {
    display: flex; align-items: center; gap: 14px;
    text-decoration: none; flex-shrink: 0;
}
.d360-logo-img {
    height: 45px;
    width: auto;
    object-fit: contain;
 
}
.d360-logo-fallback {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3rem; color: #fff; letter-spacing: -.5px;
}
.d360-logo-fallback strong { color: var(--d360-brown-xlt); }
.d360-header-pill {
    display: inline-block;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    color: rgba(255,255,255,.8);
    font-size: .7rem; font-weight: 600;
    letter-spacing: .8px; text-transform: uppercase;
    padding: 4px 12px; border-radius: 50px;
}

/* Chip de usuario */
.d360-header-right { display: flex; align-items: center; gap: 12px; }
.d360-user-chip {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 50px; padding: 6px 16px 6px 6px;
}
.d360-user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--d360-brown) 0%, var(--d360-brown-lt) 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: .9rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.d360-user-info { display: flex; flex-direction: column; }
.d360-user-name  { font-size: .85rem; font-weight: 600; color: #fff; line-height: 1.2; }
.d360-user-email { font-size: .7rem; color: rgba(255,255,255,.5); }
.d360-logout-btn {
    display: flex; align-items: center; gap: 7px;
    background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18);
    color: rgba(255,255,255,.8); padding: 9px 16px; border-radius: 50px;
    font-family: var(--d360-font); font-size: .82rem; font-weight: 600;
    text-decoration: none; cursor: pointer; transition: all .2s;
}
.d360-logout-btn:hover { background: rgba(255,255,255,.2); color: #fff; transform: translateY(-1px); }

/* ============================================================
   HERO
   ============================================================ */

.d360-hero {
    position: relative; z-index: 5;
    background: linear-gradient(135deg, #132746 0%, #1A365D 55%, #2a3f60 100%);
    padding: 52px 0 60px;
    overflow: hidden;
}

/* Grid decorativo del hero */
.d360-hero::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

.d360-hero-inner {
    display: flex; align-items: center; justify-content: space-between; gap: 40px;
    position: relative; z-index: 2;
}
.d360-hero-text { flex: 1; }
.d360-hero-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: .8rem; font-weight: 600; letter-spacing: 1px;
    text-transform: uppercase; color: rgba(255,255,255,.6);
    margin-bottom: 14px;
}
.d360-eyebrow-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 3px rgba(74,222,128,.25);
    animation: d360-pulse 2s ease-in-out infinite;
}
@keyframes d360-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(74,222,128,.25); }
    50%       { box-shadow: 0 0 0 6px rgba(74,222,128,.1); }
}
.d360-hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 3.5vw, 3rem);
    font-weight: 700; color: #fff; line-height: 1.15;
    margin-bottom: 16px; letter-spacing: -.5px;
}
.d360-hero-title em { font-style: normal; color: var(--d360-brown); }
.d360-hero-sub {
    font-size: 1.05rem; color: rgba(255,255,255,.65);
    line-height: 1.7; max-width: 560px;
}
.d360-hero-sub strong { color: rgba(255,255,255,.9); font-weight: 600; }

/* Donut de progreso */
.d360-hero-donut {
    position: relative; flex-shrink: 0;
    width: 120px; height: 120px;
}
.d360-hero-donut svg {
    width: 100%; height: 100%;
    transform: rotate(0deg);
}
.d360-donut-label {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.d360-donut-label strong { font-size: 1.5rem; font-weight: 800; color: #fff; line-height: 1; }
.d360-donut-label span   { font-size: .65rem; color: rgba(255,255,255,.5); text-transform: uppercase; letter-spacing: .5px; }

/* ============================================================
   GRID DE APPS
   ============================================================ */

.d360-main {
    position: relative; z-index: 5;
    padding: 44px 0 60px;
}

.d360-apps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

/* ── Tarjeta ─────────────────────────────────────────────── */
.d360-app-card {
    --c: #1a365d;          /* Color de acento por tarjeta */
    position: relative;
    background: #fff;
    border-radius: 20px;
    padding: 32px 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 0;
    box-shadow: 0 2px 12px rgba(26,54,93,.07), 0 0 0 1px rgba(26,54,93,.04);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: transform .35s cubic-bezier(.4,0,.2,1),
                box-shadow .35s cubic-bezier(.4,0,.2,1),
                border-color .25s;
    overflow: hidden;
    animation: d360-card-up .5s ease both;
}
@keyframes d360-card-up {
    from { opacity: 0; transform: translateY(28px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Brillo hover en la esquina superior derecha */
.d360-card-shine {
    position: absolute;
    top: -60px; right: -60px;
    width: 160px; height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--c), transparent 70%);
    opacity: 0;
    transition: opacity .4s, transform .4s;
    transform: scale(.6);
    pointer-events: none;
}

.d360-app-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 48px rgba(26,54,93,.14), 0 0 0 2px rgba(var(--c), .15);
    border-color: color-mix(in srgb, var(--c) 20%, transparent);
}
.d360-app-card:hover .d360-card-shine {
    opacity: .08;
    transform: scale(1);
}

/* Estado deshabilitado */
.d360-app-card--off {
    cursor: default;
    background: #f8f9fb;
    opacity: .7;
}
.d360-app-card--off:hover {
    transform: none;
    box-shadow: 0 2px 12px rgba(26,54,93,.07), 0 0 0 1px rgba(26,54,93,.04);
    border-color: transparent;
}
.d360-app-card--off:hover .d360-card-shine { opacity: 0; }

/* ── Zona icono ──────────────────────────────────────────── */
.d360-card-icon-zone {
    margin-bottom: 22px;
}
.d360-card-icon-bg {
    width: 64px; height: 64px; border-radius: 18px;
    background: color-mix(in srgb, var(--c) 10%, #fff);
    border: 1.5px solid color-mix(in srgb, var(--c) 18%, transparent);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: var(--c);
    transition: all .35s cubic-bezier(.4,0,.2,1);
}
.d360-app-card:hover .d360-card-icon-bg {
    background: var(--c);
    color: #fff;
    border-color: var(--c);
    transform: scale(1.1) rotate(-4deg);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--c) 35%, transparent);
}
.d360-app-card--off:hover .d360-card-icon-bg {
    background: color-mix(in srgb, var(--c) 10%, #fff);
    color: var(--c);
    border-color: color-mix(in srgb, var(--c) 18%, transparent);
    transform: none;
    box-shadow: none;
}

/* ── Badge ───────────────────────────────────────────────── */
.d360-card-badge {
    position: absolute; top: 18px; right: 18px;
    background: var(--c); color: #fff;
    font-size: .65rem; font-weight: 700;
    letter-spacing: .6px; text-transform: uppercase;
    padding: 5px 11px; border-radius: 50px;
    line-height: 1;
}
.d360-card-badge--off {
    background: #e2e8f0;
    color: var(--d360-muted);
}

/* ── Contenido ───────────────────────────────────────────── */
.d360-card-content { flex: 1; margin-bottom: 20px; }
.d360-card-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem; font-weight: 700;
    color: var(--d360-blue); line-height: 1.25;
    margin-bottom: 10px;
    transition: color .2s;
}
.d360-app-card:hover .d360-card-title { color: var(--c); }
.d360-app-card--off:hover .d360-card-title { color: var(--d360-blue); }

.d360-card-desc {
    font-size: .875rem; color: var(--d360-muted); line-height: 1.65;
}

/* ── Acción ──────────────────────────────────────────────── */
.d360-card-action {
    padding-top: 16px;
    border-top: 1px solid rgba(26,54,93,.06);
}
.d360-card-open-btn {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: .82rem; font-weight: 700;
    color: var(--c); letter-spacing: .3px;
    transition: gap .2s;
}
.d360-card-open-btn svg { transition: transform .2s; }
.d360-app-card:hover .d360-card-open-btn { gap: 11px; }
.d360-app-card:hover .d360-card-open-btn svg { transform: translateX(3px); }

.d360-card-locked-btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .82rem; font-weight: 500; color: #94a3b8;
}

/* ── Focus visible (accesibilidad) ──────────────────────── */
.d360-app-card:focus-visible {
    outline: 3px solid var(--c);
    outline-offset: 3px;
}

/* ============================================================
   FOOTER
   ============================================================ */

.d360-footer {
    position: relative; z-index: 5;
    border-top: 1px solid rgba(26,54,93,.1);
    padding: 24px 0;
    background: #eef1f6;
}
.d360-footer p {
    font-size: .8rem; color: var(--d360-muted); text-align: center;
}
.d360-footer a { color: var(--d360-brown); text-decoration: none; }
.d360-footer a:hover { text-decoration: underline; }

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

@media (max-width: 1024px) {
    .d360-apps-grid { grid-template-columns: repeat(2, 1fr); }
    .d360-hero-donut { width: 100px; height: 100px; }
}

@media (max-width: 768px) {
    .d360-container { padding: 0 20px; }
    .d360-header-inner { padding: 0 20px; }
    .d360-hero { padding: 36px 0 50px; }
    .d360-hero-inner { flex-direction: column; align-items: flex-start; gap: 24px; }
    .d360-hero-donut { display: none; }
    .d360-apps-grid { grid-template-columns: 1fr; gap: 16px; }
    .d360-user-info { display: none; }
    .d360-main { padding: 32px 0 48px; }
    .d360-login-card { padding: 32px 24px; }
}

@media (max-width: 480px) {
    .d360-logout-btn span { display: none; }
    .d360-header-pill { display: none; }
    .d360-hero-title { font-size: 1.7rem; }
}
