/* Child-bot list preview layer. Existing markup and event handlers remain unchanged. */

.mybots-page {
    --bot-preview-surface: rgba(15, 21, 46, 0.74);
    --bot-preview-surface-strong: rgba(23, 31, 66, 0.88);
    --bot-preview-border: rgba(255, 255, 255, 0.12);
    --bot-preview-purple: rgba(139, 124, 255, 0.72);
    --bot-preview-blue: rgba(78, 168, 255, 0.72);
    --bot-preview-green: rgba(74, 222, 154, 0.8);
    --bot-preview-amber: rgba(255, 196, 92, 0.82);
    --bot-preview-red: rgba(255, 125, 145, 0.82);
    --bot-preview-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.mybots-page-header {
    position: relative;
    overflow: hidden;
    min-height: 86px;
    padding: 17px 18px;
    border: 1px solid rgba(139, 124, 255, 0.34);
    border-radius: 25px;
    background:
        radial-gradient(circle at 86% 0%, rgba(53, 213, 232, 0.15), transparent 34%),
        radial-gradient(circle at 10% 0%, rgba(139, 124, 255, 0.24), transparent 42%),
        linear-gradient(145deg, rgba(27, 34, 72, 0.88), rgba(11, 17, 38, 0.72));
    box-shadow: 0 20px 58px rgba(4, 7, 23, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(26px) saturate(150%);
    -webkit-backdrop-filter: blur(26px) saturate(150%);
}

.mybots-page-header::after {
    content: '';
    position: absolute;
    right: -44px;
    bottom: -72px;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: conic-gradient(from 40deg, rgba(78, 168, 255, 0.26), rgba(139, 124, 255, 0.1), rgba(53, 213, 232, 0.24));
    filter: blur(14px);
    pointer-events: none;
}

.mybots-page-title {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: clamp(23px, 6vw, 31px);
    letter-spacing: -0.04em;
}

.mybots-add-bot-button.btn-primary {
    position: relative;
    z-index: 1;
    min-height: 44px;
    padding-inline: 16px;
    border: 1px solid rgba(139, 124, 255, 0.35);
    border-radius: 15px;
    color: #fff;
    background: linear-gradient(135deg, rgba(92, 105, 255, 0.48), rgba(139, 92, 246, 0.34));
    box-shadow: 0 12px 30px rgba(63, 55, 160, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.mybots-controls {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 11px;
    align-items: center;
    margin: 12px 0 8px;
    padding: 9px 11px;
    border: 1px solid var(--bot-preview-border);
    border-radius: 18px;
    background: rgba(10, 15, 35, 0.64);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.mybots-controls__label {
    color: rgba(225, 232, 255, 0.58);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mybots-controls__select {
    min-height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 13px;
    color: rgba(248, 250, 255, 0.94);
    background: rgba(255, 255, 255, 0.06);
    font-weight: 650;
}

.mybots-count {
    margin: 5px 3px 11px;
    color: rgba(224, 232, 255, 0.55);
    font-size: 11px;
    font-weight: 650;
}

.mybots-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 11px;
}

.mybots-page .mybots-bot-card {
    position: relative;
    isolation: isolate;
    min-width: 0;
    margin: 0;
    padding: 14px;
    overflow: hidden;
    border: 1px solid var(--bot-preview-border);
    border-radius: 23px;
    background:
        radial-gradient(circle at 92% 0%, rgba(78, 168, 255, 0.1), transparent 34%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.032)),
        var(--bot-preview-surface);
    box-shadow: 0 15px 44px rgba(3, 6, 20, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.085);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    cursor: pointer;
    transition: transform 220ms var(--bot-preview-ease), border-color 220ms ease, box-shadow 220ms ease, background 220ms ease;
}

.mybots-page .mybots-bot-card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        linear-gradient(115deg, rgba(255, 255, 255, 0.065), transparent 28%),
        radial-gradient(circle at 12% 108%, rgba(139, 124, 255, 0.11), transparent 42%);
}

.mybots-page .mybots-bot-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 18px;
    right: 18px;
    height: 1px;
    z-index: 1;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.34), transparent);
    opacity: 0.65;
}

.mybots-page .mybots-bot-card:hover,
.mybots-page .mybots-bot-card--active:hover {
    transform: translateY(-3px);
    border-color: rgba(139, 124, 255, 0.35);
    background:
        radial-gradient(circle at 92% 0%, rgba(78, 168, 255, 0.14), transparent 34%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.095), rgba(255, 255, 255, 0.04)),
        var(--bot-preview-surface-strong);
    box-shadow: 0 22px 58px rgba(3, 6, 20, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.mybots-page .mybots-bot-card--active,
.mybots-page .mybots-bot-card--expanded {
    border-color: rgba(139, 124, 255, 0.38);
    background:
        radial-gradient(circle at 92% 0%, rgba(53, 213, 232, 0.13), transparent 34%),
        radial-gradient(circle at 6% 100%, rgba(139, 124, 255, 0.13), transparent 42%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.038)),
        var(--bot-preview-surface-strong);
    box-shadow: 0 22px 62px rgba(3, 6, 20, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.11);
}

.mybots-page .mybots-bot-card--active.ambient-glow--battle {
    border-color: rgba(78, 168, 255, 0.42);
}

.mybots-page .mybots-bot-card--active.ambient-glow--manual {
    border-color: rgba(255, 196, 92, 0.34);
}

.mybots-page .mybots-card__header {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 11px;
    align-items: center;
    margin: 0;
}

.mybots-page .mybots-bot-card__avatar,
.mybots-page .bot-avatar.mybots-bot-card__avatar {
    width: 52px;
    height: 52px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(145deg, rgba(92, 105, 255, 0.88), rgba(139, 92, 246, 0.7));
    box-shadow: 0 11px 28px rgba(61, 54, 150, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    object-fit: cover;
}

.mybots-page .mybots-card__title {
    overflow: hidden;
    margin: 0;
    color: rgba(255, 255, 255, 0.97);
    font-size: 16px;
    font-weight: 790;
    letter-spacing: -0.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mybots-page .mybots-card__username {
    overflow: hidden;
    margin: 4px 0 0;
    color: rgba(220, 228, 255, 0.52);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mybots-page .mybots-status-pill {
    min-height: 29px;
    padding: 0 9px;
    border: 1px solid rgba(74, 222, 154, 0.2);
    border-radius: 999px;
    color: rgba(196, 255, 226, 0.94);
    background: rgba(74, 222, 154, 0.075);
    box-shadow: 0 0 20px rgba(74, 222, 154, 0.08);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.mybots-page .mybots-status-pill--danger,
.mybots-page .mybots-status-pill.status-error {
    border-color: rgba(255, 125, 145, 0.2);
    color: rgba(255, 216, 223, 0.94);
    background: rgba(255, 125, 145, 0.08);
}

.mybots-page .mybots-status-pill--warning,
.mybots-page .mybots-status-pill.status-warning {
    border-color: rgba(255, 196, 92, 0.2);
    color: rgba(255, 232, 190, 0.94);
    background: rgba(255, 196, 92, 0.075);
}

.mybots-page .mybots-card__chips {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin: 8px 0 0;
}

/* Header already exposes status; retain only mode and expansion in the secondary row. */
.mybots-page .mybots-card__chips .mybots-chip--online {
    display: none;
}

.mybots-page .mybots-chip--mode {
    min-height: 29px;
    padding: 0 9px;
    border: 1px solid rgba(78, 168, 255, 0.16);
    border-radius: 999px;
    color: rgba(215, 232, 255, 0.88);
    background: rgba(78, 168, 255, 0.065);
    font-size: 9px;
    font-weight: 780;
}

.mybots-page .mybots-chip--manual {
    border-color: rgba(255, 196, 92, 0.17);
    color: rgba(255, 228, 178, 0.9);
    background: rgba(255, 196, 92, 0.065);
}

.mybots-page .mybots-card__collapse-toggle {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: rgba(228, 234, 255, 0.68);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    font-size: 15px;
}

/* Every compact card becomes a real preview with KPI analytics. */
.mybots-page .mybots-bot-card--compact .mybots-card__expanded-body {
    grid-template-rows: 1fr;
    opacity: 1;
    transform: none;
}

.mybots-page .mybots-card__expanded-body-inner {
    position: relative;
    z-index: 2;
    overflow: visible;
}

.mybots-page .mybots-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-top: 10px;
}

.mybots-page .bot-metric-card,
.mybots-page .mybots-kpi-card {
    min-width: 0;
    min-height: 69px;
    padding: 9px;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.038);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.mybots-page .bot-metric-card__icon,
.mybots-page .mybots-kpi-card__icon {
    width: 21px;
    height: 21px;
    margin-bottom: 6px;
    color: rgba(184, 200, 255, 0.75);
}

.mybots-page .bot-metric-card__value,
.mybots-page .mybots-kpi-card__value {
    color: rgba(255, 255, 255, 0.96);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.mybots-page .bot-metric-card__label,
.mybots-page .mybots-kpi-card__label {
    margin-top: 3px;
    color: rgba(220, 228, 255, 0.48);
    font-size: 9px;
    font-weight: 680;
    line-height: 1.2;
}

/* The list stays a preview: compact cards show no secondary panels. */
.mybots-page .mybots-bot-card--compact .mybots-activity-card,
.mybots-page .mybots-bot-card--compact .mybots-action-grid {
    display: none;
}

/* Expanded preview keeps a small trend strip instead of a full dashboard. */
.mybots-page .mybots-bot-card--active .mybots-activity-card,
.mybots-page .mybots-bot-card--expanded .mybots-activity-card {
    display: block;
    min-height: 62px;
    margin-top: 8px;
    padding: 10px 11px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.032);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.mybots-page .mybots-bot-card--active .bot-activity-panel__rows,
.mybots-page .mybots-bot-card--active .bot-activity-panel__empty-state,
.mybots-page .mybots-bot-card--expanded .bot-activity-panel__rows,
.mybots-page .mybots-bot-card--expanded .bot-activity-panel__empty-state {
    display: none;
}

.mybots-page .bot-activity-panel__header {
    margin-bottom: 5px;
}

.mybots-page .bot-activity-panel__title,
.mybots-page .bot-activity-panel__badge {
    color: rgba(220, 228, 255, 0.5);
    font-size: 9px;
    font-weight: 750;
}

.mybots-page .bot-activity-panel__chart {
    min-height: 28px;
}

.mybots-page .bot-activity-panel__empty {
    display: grid;
    place-items: center;
    min-height: 28px;
    color: rgba(220, 228, 255, 0.4);
    font-size: 9px;
}

/* Compact action dock on the selected preview. */
.mybots-page .mybots-action-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
}

.mybots-page .mybots-action-tile {
    min-height: 57px;
    padding: 7px 3px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 14px;
    color: rgba(245, 248, 255, 0.9);
    background: rgba(255, 255, 255, 0.036);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.mybots-page .mybots-action-tile::before {
    opacity: 0.18;
    filter: blur(14px);
}

.mybots-page .mybots-action-tile__icon {
    margin-bottom: 5px;
    filter: none;
}

.mybots-page .mybots-action-tile__svg {
    width: 19px;
    height: 19px;
}

.mybots-page .mybots-action-tile__label {
    overflow: hidden;
    max-width: 100%;
    color: rgba(236, 241, 255, 0.72);
    font-size: 8px;
    font-weight: 720;
    line-height: 1.12;
    text-overflow: ellipsis;
}

.mybots-page .mybots-action-tile:hover {
    transform: translateY(-2px);
    border-color: rgba(139, 124, 255, 0.25);
    background: rgba(139, 124, 255, 0.07);
}

@media (min-width: 760px) {
    .mybots-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

    .mybots-page .mybots-bot-card--active,
    .mybots-page .mybots-bot-card--expanded {
        grid-column: span 2;
    }
}

@media (max-width: 480px) {
    .mybots-page-header {
        min-height: 78px;
        padding: 14px;
        border-radius: 22px;
    }

    .mybots-page-title {
        font-size: 22px;
    }

    .mybots-add-bot-button.btn-primary {
        min-height: 40px;
        padding-inline: 12px;
        font-size: 11px;
    }

    .mybots-controls {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .mybots-page .mybots-bot-card {
        padding: 12px;
        border-radius: 21px;
    }

    .mybots-page .mybots-card__header {
        grid-template-columns: 47px minmax(0, 1fr) auto;
        gap: 9px;
    }

    .mybots-page .mybots-bot-card__avatar,
    .mybots-page .bot-avatar.mybots-bot-card__avatar {
        width: 47px;
        height: 47px;
        border-radius: 16px;
    }

    .mybots-page .mybots-card__title {
        font-size: 15px;
    }

    .mybots-page .mybots-status-pill {
        max-width: 76px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mybots-page .mybots-kpi-grid {
        gap: 6px;
    }

    .mybots-page .bot-metric-card,
    .mybots-page .mybots-kpi-card {
        min-height: 65px;
        padding: 8px 6px;
    }

    .mybots-page .mybots-action-grid {
        gap: 5px;
    }

    .mybots-page .mybots-action-tile {
        min-height: 54px;
    }
}

@media (max-width: 350px) {
    .mybots-page .mybots-card__header {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .mybots-page .mybots-status-pill {
        grid-column: 2;
        justify-self: start;
    }

    .mybots-page .mybots-action-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .mybots-page .mybots-bot-card,
    .mybots-page .mybots-action-tile,
    .mybots-add-bot-button.btn-primary {
        transition-duration: 0.01ms !important;
    }
}
