/* Arkadium Copiloto — widget IA compartido */
.ark-copilot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid var(--ark-copilot-accent, #00d2ff);
    background: #1a202c;
    cursor: pointer;
    z-index: 9998;
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.35);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.ark-copilot-fab.live {
    animation: ark-fab-live 2.2s infinite;
}
@keyframes ark-fab-live {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 210, 255, 0.35); }
    50% { box-shadow: 0 0 28px rgba(34, 197, 94, 0.55), 0 0 0 4px rgba(34, 197, 94, 0.25); }
}
.ark-copilot-fab:hover { transform: scale(1.08); }
.ark-copilot-fab img { width: 100%; height: 100%; object-fit: cover; }

.ark-copilot-panel {
    display: none;
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: min(380px, calc(100vw - 32px));
    max-height: min(520px, 70vh);
    background: linear-gradient(160deg, #1a202c, #0b0d13);
    border: 1px solid #3d495c;
    border-radius: 16px;
    z-index: 9999;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.7);
    overflow: hidden;
}
.ark-copilot-panel.open { display: flex; }

.ark-copilot-header {
    padding: 14px 16px;
    border-bottom: 1px solid #2d3748;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.ark-copilot-header-avatar {
    width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
    border: 2px solid var(--ark-copilot-accent, #00d2ff);
}
.ark-copilot-agent-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 14px;
    font-size: 0.72rem;
    line-height: 1.4;
    color: #cbd5e1;
    background: rgba(139, 92, 246, 0.1);
    border-bottom: 1px solid #3d495c;
    cursor: pointer;
}
.ark-copilot-agent-row input {
    width: auto;
    margin-top: 2px;
    flex-shrink: 0;
}
.ark-copilot-header h4 {
    margin: 0;
    flex: 1;
    font-size: 0.85rem;
    letter-spacing: 1px;
    color: var(--ark-copilot-accent, #00d2ff);
    font-family: 'Orbitron', 'Inter', sans-serif;
}
.ark-copilot-close {
    background: none;
    border: none;
    color: #718096;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
}

.ark-copilot-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.88rem;
    line-height: 1.5;
}
.ark-copilot-msg {
    padding: 10px 12px;
    border-radius: 10px;
    max-width: 88%;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.ark-copilot-msg.user {
    align-self: flex-end;
    background: rgba(0, 210, 255, 0.15);
    border: 1px solid rgba(0, 210, 255, 0.3);
    color: #e2e8f0;
}
.ark-copilot-msg.assistant {
    align-self: flex-start;
    background: rgba(255,255,255,0.05);
    border: 1px solid #2d3748;
    color: #cbd5e0;
}
.ark-copilot-msg.system {
    align-self: center;
    font-size: 0.75rem;
    color: #718096;
    font-style: italic;
}

.ark-copilot-input-row {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #2d3748;
}
.ark-copilot-input-row input {
    flex: 1;
    background: #0d1117;
    border: 1px solid #3d495c;
    border-radius: 8px;
    color: #e2e8f0;
    padding: 10px 12px;
    font-size: 0.88rem;
}
.ark-copilot-input-row input:focus {
    outline: none;
    border-color: var(--ark-copilot-accent, #00d2ff);
}
.ark-copilot-input-row button {
    border: none;
    border-radius: 8px;
    padding: 0 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    background: var(--ark-copilot-accent, #00d2ff);
    color: #0b0d13;
}
.ark-copilot-mic {
    background: transparent !important;
    border: 1px solid #3d495c !important;
    color: #a0aec0 !important;
}
.ark-copilot-mic.listening {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
    animation: ark-pulse 1.2s infinite;
}
@keyframes ark-pulse { 0%,100%{box-shadow:0 0 0 0 rgba(239,68,68,.4)} 50%{box-shadow:0 0 0 8px rgba(239,68,68,0)} }

.ark-copilot-status {
    padding: 8px 16px;
    font-size: 0.75rem;
    color: #94a3b8;
    background: rgba(0,0,0,0.25);
    border-bottom: 1px solid #2d3748;
    min-height: 32px;
}
.ark-copilot-panel.drive-mode {
    bottom: auto; top: 12px; right: 12px; left: 12px;
    width: auto; max-height: min(340px, 45vh);
}
.ark-copilot-handsfree {
    flex: 1;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-weight: 700;
    font-size: 0.95rem;
    background: linear-gradient(135deg, #059669, #047857);
    color: #fff;
    cursor: pointer;
}
.ark-copilot-mic.drive-mic {
    width: 56px; height: 56px; font-size: 1.4rem;
    border-radius: 50% !important;
}
/* Pasajero — Elena al pie, ligeramente a la derecha del centro; banner Arkadium a la izq */
.ark-copilot-fab-wrap.passenger {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 58%;
    right: auto;
    transform: translateX(-50%);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}
.ark-copilot-fab-wrap.passenger .ark-copilot-fab,
.ark-copilot-fab-wrap.passenger .ark-copilot-fab-name {
    pointer-events: auto;
}
.ark-copilot-fab.passenger {
    position: relative;
    bottom: auto;
    right: auto;
    width: 72px;
    height: 72px;
    border-width: 3px;
    border-color: var(--ark-copilot-accent, #8b5cf6);
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.45);
}
.ark-copilot-fab.passenger img {
    object-position: center 12%;
}
.ark-copilot-fab-name {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #c4b5fd;
    background: rgba(10, 6, 18, 0.92);
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(139, 92, 246, 0.35);
    white-space: nowrap;
}
.ark-copilot-panel.passenger-panel {
    right: auto;
    left: 58%;
    transform: translateX(-50%);
    bottom: calc(118px + env(safe-area-inset-bottom));
    width: min(360px, calc(100vw - 24px));
}

.ark-copilot-fab.drive-active {
    border-color: #22c55e;
    box-shadow: 0 0 24px rgba(34,197,94,0.5);
}
