/* ========================================
   Clone AI Bot Modal
   Glass-morphism styled bottom sheet for bot selection
   ======================================== */

/* Modal Backdrop */
.clone-bot-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.clone-bot-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

/* Modal Container - Bottom Sheet on Mobile */
.clone-bot-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 95%;
    max-width: 600px;
    max-height: 85vh;
    background: linear-gradient(135deg, rgba(10, 30, 50, 0.95) 0%, rgba(15, 40, 70, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 207, 255, 0.3);
    border-radius: 20px;
    box-shadow:
        0 0 60px rgba(0, 150, 255, 0.3),
        inset 0 0 30px rgba(0, 100, 150, 0.1);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.clone-bot-modal.visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Mobile Bottom Sheet */
@media (max-width: 768px) {
    .clone-bot-modal {
        left: 0;
        right: 0;
        top: auto;
        bottom: 0;
        transform: translateY(100%);
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
    }

    .clone-bot-modal.visible {
        transform: translateY(0);
    }
}

/* Modal Header */
.clone-bot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 207, 255, 0.2);
    background: linear-gradient(180deg, rgba(0, 60, 100, 0.3) 0%, transparent 100%);
}

.clone-bot-header h2 {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 18px;
    font-weight: 600;
    color: #00cfff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.clone-bot-header h2 svg {
    width: 24px;
    height: 24px;
}

.clone-bot-close {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 80, 0, 0.15);
    border: 1px solid rgba(255, 80, 0, 0.3);
    border-radius: 12px;
    color: #ff5000;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clone-bot-close:hover {
    background: rgba(255, 80, 0, 0.25);
    border-color: rgba(255, 80, 0, 0.5);
}

/* Filter Tabs */
.clone-bot-filters {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(0, 207, 255, 0.1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.clone-bot-filter {
    flex-shrink: 0;
    padding: 10px 16px;
    min-height: 44px;
    background: rgba(0, 50, 100, 0.3);
    border: 1px solid rgba(0, 207, 255, 0.2);
    border-radius: 10px;
    color: #9DA3A8;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.clone-bot-filter:hover {
    background: rgba(0, 70, 120, 0.4);
    color: #fff;
}

.clone-bot-filter.active {
    background: linear-gradient(135deg, rgba(0, 207, 255, 0.25) 0%, rgba(0, 100, 150, 0.25) 100%);
    border-color: rgba(0, 207, 255, 0.5);
    color: #00cfff;
    box-shadow: 0 0 15px rgba(0, 207, 255, 0.2);
}

/* Bot Grid */
.clone-bot-grid {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

@media (max-width: 480px) {
    .clone-bot-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 12px;
        gap: 10px;
    }
}

/* Bot Card */
.clone-bot-card {
    background: linear-gradient(145deg, rgba(0, 40, 70, 0.6) 0%, rgba(0, 60, 100, 0.4) 100%);
    border: 1px solid rgba(0, 207, 255, 0.2);
    border-radius: 14px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 180px;
}

.clone-bot-card:hover {
    background: linear-gradient(145deg, rgba(0, 55, 90, 0.7) 0%, rgba(0, 80, 130, 0.5) 100%);
    border-color: rgba(0, 207, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 150, 255, 0.25);
}

.clone-bot-card.selected {
    border-color: #00ff9d;
    box-shadow: 0 0 20px rgba(0, 255, 157, 0.3);
}

/* Bot Avatar */
.clone-bot-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 207, 255, 0.2) 0%, rgba(0, 100, 150, 0.3) 100%);
    border: 2px solid rgba(0, 207, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 10px;
    overflow: hidden;
}

.clone-bot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.clone-bot-avatar .avatar-text {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-weight: 700;
    font-size: 18px;
    color: #00cfff;
}

/* Bot Info */
.clone-bot-name {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.clone-bot-symbol {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 11px;
    color: #9DA3A8;
    margin-bottom: 10px;
}

/* Bot Stats */
.clone-bot-stats {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
}

.clone-bot-stat {
    flex: 1;
    text-align: center;
}

.clone-bot-stat-value {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 13px;
    font-weight: 600;
    display: block;
}

.clone-bot-stat-value.positive {
    color: #00ff9d;
}

.clone-bot-stat-value.negative {
    color: #ff5000;
}

.clone-bot-stat-label {
    font-size: 10px;
    color: #6B7280;
    display: block;
    margin-top: 2px;
}

/* Type Badge */
.clone-bot-type {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px; /* iOS min accessibility */
    font-weight: 600;
    text-transform: uppercase;
}

.clone-bot-type.wta {
    background: rgba(170, 85, 255, 0.2);
    color: #aa55ff;
    border: 1px solid rgba(170, 85, 255, 0.3);
}

.clone-bot-type.perp {
    background: rgba(0, 255, 157, 0.15);
    color: #00ff9d;
    border: 1px solid rgba(0, 255, 157, 0.3);
}

/* Make card relative for type badge positioning */
.clone-bot-card {
    position: relative;
}

/* Modal Footer */
.clone-bot-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 207, 255, 0.2);
    background: linear-gradient(0deg, rgba(0, 60, 100, 0.3) 0%, transparent 100%);
}

.clone-bot-btn {
    width: 100%;
    min-height: 52px;
    padding: 14px 24px;
    background: linear-gradient(135deg, rgba(0, 207, 255, 0.3) 0%, rgba(0, 150, 200, 0.3) 100%);
    border: 1px solid rgba(0, 207, 255, 0.5);
    border-radius: 12px;
    color: #fff;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.clone-bot-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(0, 207, 255, 0.45) 0%, rgba(0, 150, 200, 0.45) 100%);
    box-shadow: 0 0 25px rgba(0, 207, 255, 0.3);
    transform: translateY(-1px);
}

.clone-bot-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.clone-bot-btn svg {
    width: 20px;
    height: 20px;
}

.clone-bot-btn .btn-spinner {
    display: none;
    animation: spin 1s linear infinite;
}

.clone-bot-btn.loading .btn-text {
    display: none;
}

.clone-bot-btn.loading .btn-spinner {
    display: inline-block;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Loading State */
.clone-bot-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #9DA3A8;
}

.clone-bot-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(0, 207, 255, 0.2);
    border-top-color: #00cfff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

/* Empty State */
.clone-bot-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6B7280;
    text-align: center;
}

.clone-bot-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Hero Clone Button */
.clone-bot-hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    min-height: 52px;
    background: linear-gradient(135deg, rgba(0, 255, 157, 0.2) 0%, rgba(0, 207, 255, 0.2) 100%);
    border: 1px solid rgba(0, 255, 157, 0.4);
    border-radius: 14px;
    color: #00ff9d;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-top: 20px;
}

.clone-bot-hero-btn:hover {
    background: linear-gradient(135deg, rgba(0, 255, 157, 0.35) 0%, rgba(0, 207, 255, 0.35) 100%);
    border-color: rgba(0, 255, 157, 0.6);
    box-shadow: 0 0 30px rgba(0, 255, 157, 0.25);
    transform: translateY(-2px);
}

.clone-bot-hero-btn svg {
    width: 22px;
    height: 22px;
}

/* Mobile-specific adjustments */
@media (max-width: 480px) {
    .clone-bot-header h2 {
        font-size: 16px;
    }

    .clone-bot-card {
        padding: 12px;
        min-height: 160px;
    }

    .clone-bot-avatar {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .clone-bot-name {
        font-size: 12px;
    }

    .clone-bot-stat-value {
        font-size: 11px;
    }

    .clone-bot-hero-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Handle for swipe dismiss */
.clone-bot-handle {
    display: none;
}

@media (max-width: 768px) {
    .clone-bot-handle {
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
        margin: 8px auto 4px;
    }
}

/* Success Animation */
.clone-success-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.clone-success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(0, 255, 157, 0.2) 0%, rgba(0, 207, 255, 0.2) 100%);
    border: 2px solid #00ff9d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    animation: scaleIn 0.4s ease;
}

.clone-success-icon svg {
    width: 40px;
    height: 40px;
    color: #00ff9d;
}

.clone-success-text {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
    animation: slideUp 0.4s ease 0.1s both;
}

.clone-success-subtext {
    font-size: 14px;
    color: #9DA3A8;
    animation: slideUp 0.4s ease 0.2s both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
