/* ============================================================
   DIHBU – Área Privada · Public CSS
   ============================================================ */

/* ── Reset / base ── */
.dihbu-ap *,
.dihbu-ap *::before,
.dihbu-ap *::after {
    box-sizing: border-box;
}

/* ── Contenedor principal ── */
.dihbu-ap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    color: #1a1a2e;
    max-width: 860px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,.07);
}

/* ── Acceso denegado / sin login ── */
.dihbu-ap-gate {
    padding: 32px 24px;
    text-align: center;
    color: #555;
}

.dihbu-ap-gate a {
    color: #1f6ed4;
}

/* ── Cabecera ── */
.dihbu-ap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #1a1a2e;
    color: #fff;
    gap: 12px;
}

.dihbu-ap-welcome {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.dihbu-ap-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #1f6ed4;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dihbu-ap-logout {
    font-size: 13px;
    color: rgba(255,255,255,.7);
    text-decoration: none;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 6px;
    padding: 5px 12px;
    transition: all .2s;
    white-space: nowrap;
}

.dihbu-ap-logout:hover {
    color: #fff;
    border-color: rgba(255,255,255,.6);
    background: rgba(255,255,255,.08);
}

/* ── Pestañas ── */
.dihbu-ap-tabs {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    background: #f8fafc;
}

.dihbu-ap-tab {
    position: relative;
    padding: 13px 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .2s, border-color .2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dihbu-ap-tab:hover {
    color: #1f6ed4;
}

.dihbu-ap-tab.active {
    color: #1f6ed4;
    border-bottom-color: #1f6ed4;
    font-weight: 600;
}

/* Badge de no leídos */
.dihbu-ap-badge {
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ── Paneles ── */
.dihbu-ap-panel {
    display: none;
    padding: 24px;
}

.dihbu-ap-panel.active {
    display: block;
}

/* ── Estados genéricos ── */
.dihbu-ap-loading,
.dihbu-ap-empty-folder,
.dihbu-ap-error {
    padding: 32px 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
}

.dihbu-ap-error {
    color: #ef4444;
}

/* ── Breadcrumb ── */
.dihbu-ap-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
    font-size: 13px;
}

.dihbu-ap-crumb {
    background: none;
    border: none;
    cursor: pointer;
    color: #1f6ed4;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    transition: background .15s;
    font-family: inherit;
}

.dihbu-ap-crumb:hover {
    background: #eff6ff;
}

.dihbu-ap-crumb--active {
    color: #1a1a2e;
    font-weight: 600;
    cursor: default;
}

.dihbu-ap-crumb--active:hover {
    background: none;
}

.dihbu-ap-sep {
    color: #94a3b8;
    user-select: none;
}

/* ── Toolbar ── */
.dihbu-ap-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

/* ── Botones ── */
.dihbu-ap-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all .2s;
    font-family: inherit;
    line-height: 1;
}

.dihbu-ap-btn--upload {
    background: #1f6ed4;
    color: #fff;
}

.dihbu-ap-btn--upload:hover {
    background: #1a5bbf;
}

.dihbu-ap-btn--outline {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
}

.dihbu-ap-btn--outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.dihbu-ap-btn--primary {
    background: #1f6ed4;
    color: #fff;
    padding: 10px 22px;
}

.dihbu-ap-btn--primary:hover {
    background: #1a5bbf;
}

.dihbu-ap-btn--primary:disabled {
    opacity: .6;
    cursor: default;
}

/* ── Barra de progreso ── */
.dihbu-ap-upload-progress {
    margin-bottom: 16px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dihbu-ap-progress-track {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.dihbu-ap-progress-bar {
    height: 100%;
    background: #1f6ed4;
    border-radius: 3px;
    transition: width .2s;
}

.dihbu-ap-progress-text {
    font-size: 12px;
    color: #64748b;
}

/* ── Lista de archivos ── */
.dihbu-ap-file-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dihbu-ap-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
    background: #fafafa;
    transition: background .15s, border-color .15s;
    min-width: 0;
}

.dihbu-ap-file-item:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.dihbu-ap-folder {
    cursor: pointer;
}

.dihbu-ap-folder:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.dihbu-ap-file-icon {
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1;
}

.dihbu-ap-file-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dihbu-ap-file-meta {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}

.dihbu-ap-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 11px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    flex-shrink: 0;
    transition: all .2s;
}

.dihbu-ap-dl-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #1a1a2e;
}

/* ── Chat / Mensajes ── */
.dihbu-ap-chat {
    min-height: 320px;
    max-height: 460px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0 16px;
    scroll-behavior: smooth;
}

.dihbu-ap-chat-empty {
    text-align: center;
    color: #94a3b8;
    padding: 40px 16px;
    font-size: 14px;
}

.dihbu-ap-chat-empty p {
    margin: 4px 0;
}

/* Burbujas */
.dihbu-ap-msg {
    display: flex;
}

.dihbu-ap-msg--yo {
    justify-content: flex-end;
}

.dihbu-ap-msg--dihbu {
    justify-content: flex-start;
}

.dihbu-ap-msg-bubble {
    max-width: 72%;
    background: #f1f5f9;
    border-radius: 16px 16px 16px 4px;
    padding: 10px 14px;
}

.dihbu-ap-msg--yo .dihbu-ap-msg-bubble {
    background: #1f6ed4;
    color: #fff;
    border-radius: 16px 16px 4px 16px;
}

.dihbu-ap-msg-text {
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
}

.dihbu-ap-msg-time {
    font-size: 11px;
    margin-top: 6px;
    color: rgba(0,0,0,.4);
    text-align: right;
}

.dihbu-ap-msg--yo .dihbu-ap-msg-time {
    color: rgba(255,255,255,.6);
}

/* Formulario de chat */
.dihbu-ap-chat-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-top: 4px;
    border-top: 1px solid #e2e8f0;
    padding-top: 16px;
}

.dihbu-ap-chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 72px;
    transition: border-color .2s, box-shadow .2s;
    color: #1a1a2e;
}

.dihbu-ap-chat-input:focus {
    outline: none;
    border-color: #1f6ed4;
    box-shadow: 0 0 0 3px rgba(31,110,212,.12);
}

.dihbu-ap-chat-input::placeholder {
    color: #94a3b8;
}

/* ── Cabecera de socio ── */
.dihbu-ap-welcome-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dihbu-ap-welcome-nombre {
    font-size: 14px;
    font-weight: 500;
}

.dihbu-ap-welcome-empresa {
    color: rgba(255,255,255,.65);
    font-weight: 400;
}

.dihbu-ap-socio-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.dihbu-ap-socio-desde {
    color: rgba(255,255,255,.75);
}

.dihbu-ap-pago {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 10px;
}

.dihbu-ap-pago--ok {
    background: rgba(34,197,94,.2);
    color: #86efac;
}

.dihbu-ap-pago--warn {
    background: rgba(245,158,11,.2);
    color: #fcd34d;
}

/* ── Tarjeta de socio (panel membresía) ── */
.dihbu-ap-socio-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #1f6ed4 100%);
    color: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(31,110,212,.25);
}

.dihbu-ap-socio-card-header {
    padding: 14px 22px 0;
}

.dihbu-ap-socio-card-badge {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: rgba(255,255,255,.15);
    padding: 3px 10px;
    border-radius: 10px;
}

.dihbu-ap-socio-card-body {
    padding: 16px 22px 22px;
}

.dihbu-ap-socio-card-nombre {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
}

.dihbu-ap-socio-card-empresa {
    font-size: 14px;
    color: rgba(255,255,255,.7);
    margin-bottom: 18px;
}

.dihbu-ap-socio-card-datos {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0,0,0,.15);
    border-radius: 8px;
    padding: 14px 16px;
}

.dihbu-ap-socio-dato {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    flex-wrap: wrap;
}

.dihbu-ap-socio-dato-label {
    color: rgba(255,255,255,.6);
    font-size: 12px;
}

.dihbu-ap-socio-dato-valor {
    font-weight: 600;
}

/* ── Sección acreditación ── */
.dihbu-ap-acreditacion {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px 22px;
}

.dihbu-ap-acreditacion-titulo {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 14px;
    color: #1a1a2e;
}

.dihbu-ap-acreditacion-ok p,
.dihbu-ap-acreditacion-pendiente p,
.dihbu-ap-acreditacion-solicitar p {
    margin: 0 0 14px;
    font-size: 14px;
    color: #475569;
    line-height: 1.6;
}

.dihbu-ap-acreditacion-pendiente p {
    background: #fefce8;
    border: 1px solid #fde047;
    border-radius: 8px;
    padding: 12px 16px;
    color: #713f12;
    margin-bottom: 0;
}

.dihbu-ap-acred-feedback {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

.dihbu-ap-acred-feedback--ok {
    background: #fefce8;
    border: 1px solid #fde047;
    color: #713f12;
}

.dihbu-ap-acred-feedback--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* ── Responsive ── */
@media (max-width: 560px) {
    .dihbu-ap-panel {
        padding: 16px;
    }

    .dihbu-ap-header {
        padding: 12px 16px;
    }

    .dihbu-ap-tab {
        padding: 11px 14px;
        font-size: 13px;
    }

    .dihbu-ap-file-meta {
        display: none;
    }

    .dihbu-ap-msg-bubble {
        max-width: 88%;
    }

    .dihbu-ap-chat-form {
        flex-direction: column;
        align-items: stretch;
    }

    .dihbu-ap-btn--primary {
        width: 100%;
        justify-content: center;
    }

    .dihbu-ap-socio-dato {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .dihbu-ap-socio-card-nombre {
        font-size: 17px;
    }
}
