/* Estilos frontend para ai360agent - Dashboard-WP Design System */

/* Design Tokens */
:root {
    --g360d-primary: #e91e63;
    --g360d-primary-hover: #c2185b;
    --g360d-primary-active: #ad1457;
    --g360d-border-radius: 12px;
    --g360d-border-radius-sm: 6px;
    --g360d-spacing: 24px;
    --g360d-spacing-sm: 16px;
    --g360d-spacing-xs: 8px;
}

/* Notificaciones */
.ai360agent-notice {
    padding: 15px;
    margin: 20px 0;
    border-radius: var(--g360d-border-radius-sm);
    border-left: 4px solid;
}

.ai360agent-notice-error {
    background-color: #fef2f2;
    border-color: #dc2626;
    color: #991b1b;
}

.ai360agent-notice-info {
    background-color: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}

/* Dashboard */
.ai360agent-dashboard {
    margin: var(--g360d-spacing) 0;
}

.ai360agent-dashboard-header {
    margin-bottom: var(--g360d-spacing);
}

.ai360agent-dashboard-header h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 600;
    color: #111827;
}

/* Tabla de proyectos */
.ai360agent-table-container {
    background: #ffffff;
    border-radius: var(--g360d-border-radius);
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.ai360agent-table {
    width: 100%;
    border-collapse: collapse;
}

.ai360agent-table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.ai360agent-table th {
    padding: 16px var(--g360d-spacing-sm);
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai360agent-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s ease;
}

.ai360agent-table tbody tr:last-child {
    border-bottom: none;
}

.ai360agent-table tbody tr:hover {
    background-color: #f9fafb;
}

.ai360agent-table td {
    padding: var(--g360d-spacing-sm);
    font-size: 14px;
    color: #111827;
}

.ai360agent-table-project strong {
    font-weight: 600;
    color: #111827;
}

.ai360agent-table-host {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #6b7280;
}

.ai360agent-table-status {
    text-align: center;
}

.ai360agent-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai360agent-status-unknown {
    background: #e5e7eb;
    color: #6b7280;
}

.ai360agent-status-online {
    background: #d1fae5;
    color: #065f46;
}

.ai360agent-status-offline {
    background: #fee2e2;
    color: #991b1b;
}

.ai360agent-table-action {
    text-align: right;
}

/* Botones */
.ai360agent-btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--g360d-border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.ai360agent-btn-primary {
    background: var(--g360d-primary);
    color: #ffffff;
}

.ai360agent-btn-primary:hover {
    background: var(--g360d-primary-hover);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(233, 30, 99, 0.3), 0 2px 4px -1px rgba(233, 30, 99, 0.2);
}

.ai360agent-btn-primary:active {
    background: var(--g360d-primary-active);
    transform: translateY(0);
}

.ai360agent-btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* Responsive table — card layout on mobile */
@media (max-width: 600px) {
    .ai360agent-table-container {
        overflow-x: visible;
    }

    .ai360agent-table thead {
        display: none;
    }

    .ai360agent-table,
    .ai360agent-table tbody,
    .ai360agent-table tr,
    .ai360agent-table td {
        display: block;
        width: 100%;
    }

    .ai360agent-table tr {
        background: #ffffff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        margin-bottom: 16px;
        padding: 16px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    }

    .ai360agent-table td {
        padding: 6px 0;
        border: none;
        text-align: left;
    }

    .ai360agent-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 700;
        color: #6b7280;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 4px;
    }

    .ai360agent-table td:first-child {
        padding-top: 0;
    }

    .ai360agent-table td strong {
        font-size: 16px;
    }

    .ai360agent-table-action {
        text-align: left;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        padding-top: 12px;
        border-top: 1px solid #f3f4f6;
        margin-top: 4px;
    }

    .ai360agent-table-action::before {
        display: none;
    }

    .ai360agent-btn-sm {
        padding: 10px 16px;
        font-size: 14px;
        flex: 1;
        min-width: 0;
    }

    .ai360agent-status-badge {
        display: inline-block;
    }
}

/* Tablet: keep table but scrollable */
@media (min-width: 601px) and (max-width: 900px) {
    .ai360agent-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .ai360agent-table {
        min-width: 580px;
        font-size: 13px;
    }

    .ai360agent-table th,
    .ai360agent-table td {
        padding: 10px 12px;
    }

    .ai360agent-table th {
        font-size: 12px;
    }

    .ai360agent-btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* Lista de proyectos (legacy - mantener para compatibilidad) */
.ai360agent-projects-list {
    margin: 20px 0;
}

.ai360agent-projects-list h3 {
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: 600;
}

.ai360agent-projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.ai360agent-project-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: var(--g360d-border-radius);
    padding: 20px;
    transition: box-shadow 0.3s ease;
}

.ai360agent-project-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.ai360agent-project-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.ai360agent-project-description {
    margin: 10px 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

.ai360agent-project-description p:last-child {
    margin-bottom: 0;
}

.ai360agent-project-meta {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
    font-size: 12px;
    color: #9ca3af;
}

/* Layout de consola con dos paneles */
.ai360agent-console-layout {
    display: flex;
    gap: var(--g360d-spacing);
    align-items: stretch;
    margin: 20px 0;
}

@media (max-width: 800px) {
    .ai360agent-console-layout {
        flex-direction: column;
    }
}

.ai360agent-console-left {
    flex: 1;
    min-width: 0;
}

.ai360agent-console-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Consola de chat */
.ai360agent-console {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: var(--g360d-border-radius);
    overflow: hidden;
    max-width: 100%;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.ai360agent-console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.ai360agent-console-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.ai360agent-console-status {
    font-size: 12px;
    color: #10b981;
    font-weight: 500;
}

.ai360agent-console-messages {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
}

.ai360agent-message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: var(--g360d-border-radius-sm);
    max-width: 80%;
    word-wrap: break-word;
}

.ai360agent-message-system {
    background: #dbeafe;
    color: #1e40af;
    max-width: 100%;
    text-align: center;
    font-size: 14px;
}

.ai360agent-message-user {
    background: var(--g360d-primary);
    color: #ffffff;
    margin-left: auto;
    text-align: right;
}

.ai360agent-message-agent {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #111827;
}

.ai360agent-message-error {
    background: #fee2e2;
    color: #991b1b;
    max-width: 100%;
    border: 1px solid #fca5a5;
}

.ai360agent-message-image {
    padding: 4px;
    background: transparent;
    border: none;
}

.ai360agent-message-img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--g360d-border-radius-sm);
    display: block;
}

/* ── Fase 13.2: Security badge in chat ── */
.ai360agent-message-wrapper {
    margin-bottom: 8px;
}
.ai360agent-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: .02em;
}
.ai360agent-badge-guard {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.ai360agent-console-input {
    padding: 15px 20px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}

/* Vista previa de adjuntos */
.ai360agent-attachments-preview {
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px;
    background: #f9fafb;
    border-radius: var(--g360d-border-radius-sm);
}

.ai360agent-attachments-preview.has-attachments {
    display: flex;
}

.ai360agent-attachment-item {
    position: relative;
    width: 80px;
    height: 80px;
    border: 2px solid #e5e7eb;
    border-radius: var(--g360d-border-radius-sm);
    overflow: hidden;
}

.ai360agent-attachment-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai360agent-attachment-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    padding: 0;
    background: var(--g360d-primary);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai360agent-attachment-remove:hover {
    background: var(--g360d-primary-hover);
}

.ai360agent-console-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai360agent-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai360agent-console-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: var(--g360d-border-radius-sm);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    box-sizing: border-box;
}

.ai360agent-console-textarea:focus {
    outline: 2px solid #8A4DFF;
    outline-offset: 2px;
    border-color: var(--g360d-primary);
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

.ai360agent-input-controls {
    display: flex;
    gap: var(--g360d-spacing-xs);
    align-items: center;
    justify-content: flex-end;
}

.ai360agent-control-btn {
    padding: 8px 12px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: var(--g360d-border-radius-sm);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
}

.ai360agent-control-btn:hover:not(:disabled) {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.ai360agent-control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai360agent-voice-btn.ai360agent-recording {
    background: var(--g360d-primary);
    color: #ffffff;
    border-color: var(--g360d-primary-hover);
    animation: ai360agent-pulse 1.5s ease-in-out infinite;
}

@keyframes ai360agent-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.ai360agent-console-submit {
    padding: 10px 24px;
    background: var(--g360d-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--g360d-border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 40px;
}

.ai360agent-console-submit:hover {
    background: var(--g360d-primary-hover);
    box-shadow: 0 4px 6px -1px rgba(233, 30, 99, 0.3), 0 2px 4px -1px rgba(233, 30, 99, 0.2);
}

.ai360agent-console-submit:active {
    background: var(--g360d-primary-active);
}

.ai360agent-console-submit:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Panel VNC */
.ai360agent-vnc-panel {
    display: flex;
    flex-direction: column;
    gap: var(--g360d-spacing-xs);
    height: 100%;
}

.ai360agent-vnc-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--g360d-spacing-xs);
    margin-bottom: 4px;
}

.ai360agent-vnc-button {
    padding: 10px 16px;
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: var(--g360d-border-radius-sm);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.ai360agent-vnc-button:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.ai360agent-vnc-button-primary {
    background: var(--g360d-primary);
    color: #ffffff;
    border-color: var(--g360d-primary);
}

.ai360agent-vnc-button-primary:hover {
    background: var(--g360d-primary-hover);
    border-color: var(--g360d-primary-hover);
    color: #ffffff;
}

.ai360agent-vnc-iframe-wrapper {
    position: relative;
    width: 100%;
    /* Aspect ratio 16:9 (9/16 = 0.5625 = 56.25%) */
    padding-top: 56.25%;
    border: 1px solid #ddd;
    border-radius: var(--g360d-border-radius);
    overflow: hidden;
    background: #000;
    flex: 1;
}

.ai360agent-vnc-iframe-wrapper iframe.ai360agent-vnc-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Console breadcrumb */
.ai360agent-console-breadcrumb {
    margin: 0 0 20px 0;
}

.ai360agent-back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--g360d-spacing-xs);
    padding: 8px 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: var(--g360d-border-radius-sm);
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.ai360agent-back-link:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #111827;
}

/* ===== Panel Container (for Config + Chat side panels) ===== */
#ai360agent-panel-container {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: 500px;
  max-width: calc(100vw - 28px);
  height: auto;
  z-index: 99999;
  background: #fff;
  box-shadow: -8px 0 32px rgba(0,0,0,0.15);
  overflow: hidden;
  border-radius: 20px;
  transform: translateX(calc(100% + 28px));
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Backdrop overlay */
.ai360agent-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99998;
  animation: ai360agent-fade-in 0.2s ease-out;
}

@keyframes ai360agent-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ai360agent-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
}

.ai360agent-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #00BFFF 0%, #4B4BFF 35%, #8A4DFF 70%, #FF2FB3 100%);
  color: #fff;
  flex-shrink: 0;
}

.ai360agent-panel-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.ai360agent-panel-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.ai360agent-panel-close:hover {
  background: rgba(255,255,255,0.2);
}

.ai360agent-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 5px;
  display: flex;
  flex-direction: column;
}

/* Override chat max-width for panel embedding */
.ai360agent-panel-body .ai360-chat-container {
  max-width: 100%;
  max-height: 100%;
  height: 100%;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
}

.ai360agent-panel-body .ai360-chat-header {
  display: none; /* panel has own header */
}

.ai360agent-panel-body .ai360-chat-messages {
  flex: 1;
}

.ai360agent-panel-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #6b7280;
  font-size: 15px;
  gap: 10px;
}

.ai360agent-panel-loading::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: #4B4BFF;
  border-radius: 50%;
  animation: ai360agent-spin 0.6s linear infinite;
}

@keyframes ai360agent-spin {
  to { transform: rotate(360deg); }
}

/* Remove WooCommerce panel styling conflicts */
.woocommerce-account .ai360agent-panel-header h3,
.woocommerce-account .ai360agent-panel {
  all: revert-layer;
}
.woocommerce-account .ai360agent-panel-header {
  all: revert-layer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #00BFFF 0%, #4B4BFF 35%, #8A4DFF 70%, #FF2FB3 100%);
  color: #fff;
  flex-shrink: 0;
}
.woocommerce-account .ai360agent-panel-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}
.woocommerce-account .ai360agent-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .ai360agent-projects-grid {
        grid-template-columns: 1fr;
    }
    
    .ai360agent-console {
        max-width: 100%;
    }
    
    .ai360agent-console-messages {
        height: 300px;
    }
    
    .ai360agent-message {
        max-width: 90%;
    }
}


.ai360agent-attachment-name {
    display: block;
    font-size: 10px;
    color: #6b7280;
    text-align: center;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai360agent-attachment-thumb-placeholder {
    width: 100%;
    height: 60px;
    background: #f3f4f6;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai360agent-attachment-thumb-placeholder::after {
    content: '🖼️';
    font-size: 20px;
}

/* Fix: evitar que la barra verde de nav-line se desborde del botón */
.woocommerce-MyAccount-navigation .nav-line > li > a {
    position: relative;
    overflow: hidden;
}

/* ===== PR31: Mis Agentes 2.0 — Cards, Slide Panel, Fullscreen ===== */

/* Section Titles */
.ai360agent-section {
    margin-bottom: 28px;
}

.ai360agent-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid #e5e7eb;
    letter-spacing: -0.01em;
}

/* Cards Grid */
.ai360agent-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

/* Agent Card */
.ai360agent-agent-card {
    background: #ffffff;
    border: 1px solid #e8eaed;
    border-radius: 14px;
    padding: 22px 20px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 200px;
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.ai360agent-agent-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    border-color: #d2d5db;
}

/* Card Header — avatar + title clearly at the TOP */
.ai360agent-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    flex-shrink: 0;
}

/* Card Avatar */
.ai360agent-card-avatar {
    flex-shrink: 0;
    position: relative;
}

.ai360agent-card-avatar img {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: cover;
    background: #f3f0ff;
    display: block;
}

.ai360agent-card-avatar-fallback {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6b21a8 0%, #a855f7 100%);
    color: #ffffff;
    font-size: 22px;
    font-weight: 700;
    font-family: Arial, sans-serif;
    display: none;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Card Body — middle content */
.ai360agent-card-body {
    width: 100%;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Card Name — now in header row, clearly at top */
.ai360agent-card-name {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.35;
    word-break: break-word;
    flex: 1;
    min-width: 0;
    letter-spacing: -0.01em;
}

/* Status Badges (PR31: real health check) */
.ai360agent-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.ai360agent-status-online {
    background: #d1fae5;
    color: #065f46;
}

.ai360agent-status-online::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #065f46;
}

.ai360agent-status-degraded {
    background: #fef3c7;
    color: #92400e;
}

.ai360agent-status-degraded::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #92400e;
}

.ai360agent-status-offline {
    background: #fee2e2;
    color: #991b1b;
}

.ai360agent-status-offline::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #991b1b;
}

.ai360agent-status-checking {
    background: #f3f4f6;
    color: #6b7280;
}

.ai360agent-status-unknown {
    background: #e5e7eb;
    color: #6b7280;
}

/* Card Preview (last message) */
.ai360agent-card-preview {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    padding: 8px 10px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    text-align: left;
}

.ai360agent-card-preview-icon {
    flex-shrink: 0;
    font-size: 12px;
    margin-top: 1px;
}

.ai360agent-card-preview-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Card Meta */
.ai360agent-card-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 4px;
}

.ai360agent-card-model {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai360agent-card-time {
    white-space: nowrap;
    font-style: italic;
}

/* Card Actions — pushed to BOTTOM */
.ai360agent-card-actions {
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
    margin-top: auto;
    flex-shrink: 0;
}

.ai360agent-card-actions .ai360agent-btn {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    font-size: 13px;
    border-radius: 8px;
    text-align: center;
    white-space: nowrap;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
}

.ai360agent-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.ai360agent-btn-secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* ===== PR31: Slide Panel (right/left configurable with fullscreen toggle) ===== */

/* Panel Container */
#ai360agent-panel-container {
    position: fixed;
    top: 14px;
    right: 14px;
    bottom: 14px;
    width: 500px;
    max-width: calc(100vw - 28px);
    height: auto;
    z-index: 99999;
    background: #fff;
    box-shadow: -8px 0 32px rgba(0,0,0,0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    transform: translateX(calc(100% + 28px));
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#ai360agent-panel-container.ai360agent-panel-open {
    transform: translateX(0);
}

/* Left position */
#ai360agent-panel-container.ai360agent-panel-left {
    right: auto;
    left: 14px;
    box-shadow: 8px 0 32px rgba(0,0,0,0.15);
    transform: translateX(calc(-100% - 28px));
}

#ai360agent-panel-container.ai360agent-panel-left.ai360agent-panel-open {
    transform: translateX(0);
}

#ai360agent-panel-container.ai360agent-panel-fullscreen {
    top: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    transform: translateX(100%);
}

.ai360agent-slide-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
}

.ai360agent-slide-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #00BFFF 0%, #4B4BFF 35%, #8A4DFF 70%, #FF2FB3 100%);
    color: #fff;
    flex-shrink: 0;
    min-height: 60px;
}

.ai360agent-slide-panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai360agent-slide-panel-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.ai360agent-btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    padding: 0;
    line-height: 1;
}

.ai360agent-btn-icon:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
}

.ai360agent-btn-fullscreen {
    font-size: 20px;
    font-weight: 700;
}

.ai360agent-slide-panel-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 24px 24px;
}

/* Backdrop overlay (PR31: animated) */
.ai360agent-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0);
    z-index: 99998;
    transition: background 0.35s ease;
    pointer-events: none;
}

.ai360agent-panel-backdrop.ai360agent-backdrop-visible {
    background: rgba(0,0,0,0.4);
    pointer-events: auto;
}

/* Slide panel chat overrides */
.ai360agent-slide-panel-body .ai360-chat-container {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
}

.ai360agent-slide-panel-body .ai360-chat-header {
    display: none;
}

.ai360agent-slide-panel-body .ai360-chat-messages {
    flex: 1;
}

/* Config Form Styles */
.ai360agent-form-group {
    margin-bottom: 18px;
}

.ai360agent-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.ai360agent-form-input,
.ai360agent-form-textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e0e3e8;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: #fafbfc;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    box-sizing: border-box;
    color: #1f2937;
}

.ai360agent-form-input:focus,
.ai360agent-form-textarea:focus {
    outline: 2px solid #8A4DFF;
    outline-offset: 2px;
    border-color: #8A4DFF;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(138, 77, 255, 0.12);
}

.ai360agent-form-textarea {
    resize: vertical;
    min-height: 80px;
}

.ai360agent-form-hint {
    display: block;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

.ai360agent-form-row {
    display: flex;
    gap: 12px;
}

.ai360agent-form-half {
    flex: 1;
}

.ai360agent-form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

/* Responsive: Cards */
@media (max-width: 768px) {
    .ai360agent-cards-grid {
        grid-template-columns: 1fr;
    }

    .ai360agent-agent-card {
        min-height: 180px;
    }

    .ai360agent-card-header {
        flex-wrap: wrap;
    }

    .ai360agent-card-actions {
        flex-direction: column;
    }

    .ai360agent-card-name {
        font-size: 17px;
    }

    .ai360agent-card-avatar img {
        width: 64px;
        height: 64px;
    }

    /* Slide panel full width on mobile */
    #ai360agent-panel-container {
        top: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        max-width: 100vw;
        border-radius: 0;
    }

    .ai360agent-slide-panel-body {
        padding: 16px 14px;
    }

    .ai360agent-form-row {
        flex-direction: column;
        gap: 0;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .ai360agent-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* Dark mode: disabled per Berna — white/light backgrounds always */
