/*
 * Mobile-Only Modal & Bottom Sheet System
 * Optimized for touch interactions and mobile UX
 */

/* ===== COIN DETAIL MODAL - MOBILE BOTTOM SHEET STYLE ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(3, 3, 5, 0.6);
    z-index: 2000;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.modal.active {
    display: flex;
}

.scanner-modal .modal-content {
    background: var(--bg-base);
    background-image: radial-gradient(circle at top right, rgba(0, 255, 163, 0.05), transparent);
}

.smart-money-modal .modal-content {
    background: var(--bg-base);
}

.modal-content {
    background: var(--bg-surface);
    background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.02), transparent);
    border-top: 1px solid var(--glass-border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: modalSlideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

/* Swipe handle */
.modal-handle {
    width: 36px;
    height: 4px;
    background: var(--text-muted);
    border-radius: var(--radius-full);
    margin: 12px auto 4px;
    opacity: 0.4;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-body {
    padding: 24px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px;
    border-bottom: 1px solid var(--glass-border);
    background: var(--glass-bg);
    position: sticky;
    top: 0;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.token-large-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-surface-elevated);
    object-fit: cover;
    border: 2px solid var(--glass-border);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-high);
    margin: 0;
}

.modal-header .btn {
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
}

.coin-chain {
    font-size: 11px;
    color: var(--accent-primary);
    font-weight: 600;
    margin-top: 4px;
}

/* Modal Body - Mobile-First Single Column */
.modal-body-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 16px;
}

/* Sidebar comes first on mobile */
.modal-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    order: -1;
}

.main-analysis {
    min-width: 0;
}

.chart-container-large {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-base);
    border: 1px solid var(--glass-border);
    margin-top: 16px;
}

.chart-container-large iframe {
    display: block;
    width: 100%;
    height: 400px;
}

/* Action Buttons Card */
.action-buttons-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-block {
    width: 100%;
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 700;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--touch-target-min);
    -webkit-tap-highlight-color: transparent;
    transition: var(--transition-fast);
}

.btn-block:active {
    transform: scale(var(--touch-scale-active));
}

.btn-accent {
    background: var(--grad-premium);
    color: var(--bg-base);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 255, 163, 0.3);
}

.btn-accent:active {
    box-shadow: 0 2px 8px rgba(0, 255, 163, 0.2);
}

/* Audit Cards */
.audit-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
}

.audit-card h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-high);
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.audit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--glass-border);
    min-height: 40px;
}

.audit-item:last-child {
    border-bottom: none;
}

.audit-label {
    font-size: 13px;
    color: var(--text-mid);
}

.audit-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-high);
    text-align: right;
}

.audit-value.highlight {
    color: var(--accent-primary);
    font-size: 18px;
    font-weight: 800;
}

/* Trust Badges */
.trust-badge {
    padding: 5px 10px;
    border-radius: var(--radius-xs);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.trust-high,
.trust-verified {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.trust-medium,
.trust-new {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.trust-low,
.trust-unknown {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.trust-scammer {
    background: rgba(139, 0, 0, 0.3);
    color: #ff6b6b;
    border: 1px solid rgba(139, 0, 0, 0.5);
}

/* Rug Alert */
.rug-alert {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.rug-alert strong {
    color: var(--danger);
}

/* Social Links */
.social-links {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.social-links a {
    flex: 1;
    text-align: center;
    min-height: var(--touch-target-min);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--bg-surface-elevated);
    color: var(--text-mid);
}

/* Button Secondary */
.btn-secondary {
    background: var(--bg-surface-elevated);
    color: var(--text-high);
    border: 1px solid var(--glass-border);
    min-height: var(--touch-target-min);
    transition: var(--transition-fast);
}

.btn-secondary:active {
    background: var(--bg-surface);
    border-color: var(--accent-primary);
    transform: scale(var(--touch-scale-active));
}

.btn-sm {
    padding: 10px 14px;
    font-size: 13px;
    min-height: 40px;
}

/* ===== PRICE CHANGE INDICATORS ===== */
.positive {
    color: var(--success) !important;
}

.negative {
    color: var(--danger) !important;
}

.price-change {
    font-weight: 600;
    font-size: 12px;
}

/* ===== MOBILE-SPECIFIC OPTIMIZATIONS ===== */

/* Small screens - compact layout */
@media (max-width: 374px) {
    .modal-header h2 {
        font-size: 16px;
    }

    .token-large-logo {
        width: 40px;
        height: 40px;
    }

    .btn-block {
        padding: 14px 16px;
        font-size: 14px;
    }

    .modal-body-grid {
        padding: 12px;
    }

    .chart-container-large iframe {
        height: 300px;
    }
}

/* Landscape mode adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .modal-content {
        max-height: 95vh;
    }

    .chart-container-large iframe {
        height: 250px;
    }
}

/* Safe area support */
@supports (padding: max(0px)) {
    .modal-content {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* ===== AI MESSAGE STYLES (for modal) ===== */
.ai-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.ai-message.assistant {
    background: var(--bg-surface-elevated);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.ai-message.user {
    background: var(--accent-primary);
    color: var(--bg-base);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    font-weight: 600;
}

.ai-message.typing {
    opacity: 0.6;
    animation: typingPulse 1.5s ease-in-out infinite;
}

@keyframes typingPulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Social Pulse Card */
.social-pulse-card {
    background: var(--grad-premium);
    color: var(--bg-base);
}

.social-pulse-card h3 {
    color: var(--bg-base);
}