/* ===========================
   RESET & BASE
=========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
}

body {
    font-family: 'DM Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #F0F4F8;
    min-height: 100vh;
    color: #1A2E45;
}

/* ===========================
   LOGIN - centrado vertical
=========================== */
body:has(.container) {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===========================
   LOGIN & REGISTRO
=========================== */
.container {
    width: 100%;
    padding: 20px;
}

.auth-container {
    max-width: 420px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 50px rgba(0, 51, 102, 0.10);
    padding: 50px;
    border-top: 5px solid #0055B3;
}

.auth-container h1 {
    text-align: center;
    color: #1A2E45;
    margin-bottom: 10px;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.5px;
    font-family: 'DM Serif Display', serif;
}

.form-section {
    display: none;
}

.form-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

.form-section h2 {
    color: #0055B3;
    margin-bottom: 25px;
    font-size: 17px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    color: #1A2E45;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.2px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #E2EAF3;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.25s ease;
    background: #F8FAFC;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: #0055B3;
    background: #EEF4FF;
    box-shadow: 0 0 0 4px rgba(0, 85, 179, 0.08);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #8A9BB0;
    font-size: 11.5px;
}

.btn-primary {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #0055B3 0%, #003D8A 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 16px rgba(0, 85, 179, 0.22);
    font-family: inherit;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #003D8A 0%, #002B6B 100%);
    box-shadow: 0 6px 22px rgba(0, 85, 179, 0.32);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.form-switch {
    text-align: center;
    margin-top: 20px;
    color: #5A7291;
    font-size: 13.5px;
}

.form-switch a {
    color: #0055B3;
    text-decoration: none;
    font-weight: 600;
}

.form-switch a:hover {
    text-decoration: underline;
}

.message {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    display: none;
    font-size: 13.5px;
    border-left: 4px solid transparent;
}

.message.error {
    display: block;
    background-color: #FFF3F0;
    color: #C62828;
    border-left-color: #C62828;
}

.message.success {
    display: block;
    background-color: #F0F9F4;
    color: #1B5E20;
    border-left-color: #2E7D32;
}

.info-text {
    color: #5A7291;
    margin-bottom: 18px;
    font-size: 13.5px;
    line-height: 1.6;
}

/* ===========================
   APP LAYOUT (Dashboard)
=========================== */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ===========================
   SIDEBAR
=========================== */
.sidebar {
    width: 268px;
    min-width: 268px;
    background: #0F1E33;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 15px;
    color: white;
    letter-spacing: -0.2px;
}

.sidebar-close {
    display: none;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s;
}

.sidebar-close:hover {
    color: white;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: linear-gradient(135deg, #1A7FE8, #0055B3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
    letter-spacing: 0.5px;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #EDF2F7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-empresa {
    font-size: 12px;
    color: #7A93B0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 14px;
}

.sidebar-section-label {
    font-size: 10.5px;
    font-weight: 700;
    color: #4A6580;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0 10px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 11px 14px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: #8AAAC5;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
    position: relative;
    margin-bottom: 3px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: #DEEBF7;
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(26, 127, 232, 0.18), rgba(0, 85, 179, 0.12));
    color: #60AEFF;
    font-weight: 600;
    box-shadow: inset 2px 0 0 #1A7FE8;
}

.nav-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.nav-badge {
    display: none;
    margin-left: auto;
    background: #1A7FE8;
    color: white;
    font-size: 10.5px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
}

.sidebar-footer {
    padding: 16px 14px 24px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.btn-logout-sidebar {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 11px 14px;
    background: transparent;
    border: 1px solid rgba(220, 53, 69, 0.25);
    border-radius: 10px;
    color: #F08080;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-logout-sidebar:hover {
    background: rgba(220, 53, 69, 0.12);
    color: #FF6B6B;
    border-color: rgba(220, 53, 69, 0.45);
}

/* ===========================
   MAIN CONTENT
=========================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #F0F4F8;
}

/* ===========================
   TOPBAR
=========================== */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 36px;
    height: 66px;
    background: white;
    border-bottom: 1px solid #E2EAF3;
    position: sticky;
    top: 0;
    z-index: 50;
    flex-shrink: 0;
}

.topbar-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: #5A7291;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.topbar-menu-btn:hover {
    background: #F0F4F8;
    color: #1A2E45;
}

.topbar-title {
    font-size: 17px;
    font-weight: 700;
    color: #1A2E45;
    letter-spacing: -0.3px;
    flex: 1;
    font-family: 'DM Serif Display', serif;
}

.topbar-user {
    font-size: 13px;
    color: #7A93B0;
    font-weight: 500;
}

/* ===========================
   SECCIONES
=========================== */
.seccion {
    display: none;
    padding: 36px;
    flex: 1;
    animation: fadeIn 0.25s ease;
}

.seccion.active {
    display: block;
}

.seccion-header {
    margin-bottom: 28px;
}

.seccion-titulo {
    font-size: 24px;
    font-weight: 700;
    color: #1A2E45;
    letter-spacing: -0.5px;
    font-family: 'DM Serif Display', serif;
    margin-bottom: 4px;
}

.seccion-subtitulo {
    font-size: 14px;
    color: #7A93B0;
    font-weight: 400;
}

/* ===========================
   GRID DE PROCESOS
=========================== */
.procesos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 22px;
}

/* ===========================
   TARJETA DE PROCESO
=========================== */
.proceso-card {
    background: white;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 51, 102, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border-top: 3px solid transparent;
}

.proceso-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(0, 51, 102, 0.10);
}

.card-en-curso {
    border-top-color: #1A7FE8;
}

.card-terminado {
    border-top-color: #22A566;
}

.proceso-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.proceso-estado-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-en-curso {
    background: #1A7FE8;
    box-shadow: 0 0 0 3px rgba(26, 127, 232, 0.18);
    animation: pulse-blue 2s infinite;
}

.dot-terminado {
    background: #22A566;
}

@keyframes pulse-blue {
    0%, 100% { box-shadow: 0 0 0 3px rgba(26, 127, 232, 0.18); }
    50%       { box-shadow: 0 0 0 5px rgba(26, 127, 232, 0.08); }
}

.proceso-estado-label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #7A93B0;
}

.card-en-curso .proceso-estado-label { color: #1A7FE8; }
.card-terminado .proceso-estado-label { color: #22A566; }

.proceso-nombre {
    font-size: 16px;
    font-weight: 700;
    color: #1A2E45;
    margin-bottom: 8px;
    line-height: 1.35;
}

.proceso-descripcion {
    font-size: 13px;
    color: #7A93B0;
    line-height: 1.6;
    margin-bottom: 18px;
}

.proceso-fechas {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid #EFF2F7;
    border-bottom: 1px solid #EFF2F7;
    margin-bottom: 18px;
}

.fecha-bloque {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.fecha-etiqueta {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #A0B3C6;
    margin-bottom: 3px;
}

.fecha-dato {
    font-size: 12.5px;
    font-weight: 600;
    color: #2D4460;
}

.fecha-separador {
    width: 1px;
    height: 36px;
    background: #E2EAF3;
    flex-shrink: 0;
}

.proceso-progreso {
    /* contenedor progreso */
}

.progreso-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #8A9BB0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.progreso-num {
    font-weight: 800;
    font-size: 13px;
}

.card-en-curso .progreso-num { color: #1A7FE8; }
.card-terminado .progreso-num { color: #22A566; }

.progreso-track {
    width: 100%;
    height: 5px;
    background: #EFF2F7;
    border-radius: 3px;
    overflow: hidden;
}

.progreso-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(.22,.68,0,1.2);
}

.fill-en-curso {
    background: linear-gradient(90deg, #1A7FE8, #4FA8FF);
}

.fill-terminado {
    background: linear-gradient(90deg, #22A566, #3DD680);
}

/* ===========================
   ESTADOS VACÍOS
=========================== */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #A0B3C6;
    font-size: 14px;
    text-align: center;
    gap: 14px;
}

.empty-icono {
    opacity: 0.7;
}

.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
    color: #A0B3C6;
    font-size: 14px;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #E2EAF3;
    border-top-color: #1A7FE8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===========================
   PLACEHOLDER SECCIONES
=========================== */
.placeholder-seccion {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 40px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 51, 102, 0.06);
    max-width: 520px;
    margin: 0 auto;
    gap: 16px;
}

.placeholder-icono {
    opacity: 0.55;
    margin-bottom: 4px;
}

.placeholder-seccion h3 {
    font-size: 19px;
    font-weight: 700;
    color: #1A2E45;
    font-family: 'DM Serif Display', serif;
}

.placeholder-seccion p {
    font-size: 14px;
    color: #7A93B0;
    line-height: 1.65;
}

/* ===========================
   BLOQUE ABOGADO + TOOLTIP
=========================== */
.abogado-bloque {
    margin-top: 14px;
    margin-bottom: 4px;
    padding-top: 14px;
    border-top: 1px solid #EFF2F7;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.abogado-bloque.sin-abogado {
    font-size: 12px;
    color: #B0BFCC;
    font-style: italic;
}

.abogado-etiqueta {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #A0B3C6;
}

.abogado-trigger-wrap {
    position: relative;
    display: inline-block;
}

.abogado-nombre {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 600;
    color: #1A7FE8;
    cursor: pointer;
    border-bottom: 1px dashed rgba(26, 127, 232, 0.35);
    padding-bottom: 1px;
    transition: color 0.2s;
    user-select: none;
}

.abogado-nombre:hover {
    color: #0055B3;
}

/* Tooltip */
.abogado-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    background: #0F1E33;
    border-radius: 12px;
    padding: 14px 16px;
    min-width: 230px;
    max-width: 280px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0,0,0,0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 200;
    pointer-events: none;
}

/* Flecha del tooltip */
.abogado-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 18px;
    border: 7px solid transparent;
    border-top-color: #0F1E33;
}

/* Mostrar al hover */
.abogado-trigger-wrap:hover .abogado-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.tooltip-nombre {
    font-size: 13.5px;
    font-weight: 700;
    color: #EDF2F7;
    margin-bottom: 10px;
}

.tooltip-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin-bottom: 10px;
}

.tooltip-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12.5px;
    color: #8AAAC5;
    text-decoration: none;
    padding: 5px 0;
    transition: color 0.15s;
    border-radius: 6px;
}

.tooltip-item:hover {
    color: white;
}

.tooltip-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    flex-shrink: 0;
}

.tooltip-wa   { background: rgba(37, 211, 102, 0.15); color: #25D366; }
.tooltip-mail { background: rgba(26, 127, 232, 0.15); color: #60AEFF; }

/* Tooltip hacia arriba si la tarjeta está en la parte baja — fallback */
@media (max-width: 480px) {
    .abogado-tooltip {
        left: auto;
        right: 0;
    }
    .abogado-tooltip::after {
        left: auto;
        right: 18px;
    }
}

/* ===========================
   OVERLAY MOBILE
=========================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
    display: block;
    opacity: 1;
}

/* ===========================
   ANIMACIONES
=========================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 100;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0,0,0,0.22);
    }

    .sidebar-close {
        display: flex;
    }

    .topbar-menu-btn {
        display: flex;
    }

    .seccion {
        padding: 24px 20px;
    }

    .topbar {
        padding: 0 20px;
    }

    .procesos-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .seccion {
        padding: 20px 16px;
    }

    .topbar {
        padding: 0 16px;
        height: 58px;
    }

    .auth-container {
        padding: 34px 22px;
    }

    .proceso-fechas {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .fecha-separador {
        display: none;
    }
}
