/**
 * AI Model Detail Modal
 * Styling for comprehensive AI model information display
 * Now using full-size modal with header controls (like user profile modal)
 */

/* Modal Container - Match User Profile Modal Size */
#aiModelModal .profile-modal-container {
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

/* Modal Header with Controls */
#aiModelModal .profile-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

#aiModelModal .profile-modal-header .header-left h2 {
    margin: 0;
    color: #fff;
    font-size: 24px;
    font-weight: 600;
}

#aiModelModal .header-actions {
    display: flex;
    gap: 10px;
}

#aiModelModal .modal-control-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#aiModelModal .modal-control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #00d4ff;
    color: #00d4ff;
    transform: scale(1.1);
}

/* Modal Body with Scroll */
#aiModelModal .profile-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

/* Equal left and right panels (50% each) */
#aiModelModal .profile-media-section {
    flex: 0 0 50%;
}
#aiModelModal .profile-info-section {
    flex: 0 0 50%;
}

/* Loading State */
#aiModelModal .modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 30px;
}

#aiModelModal .loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 212, 255, 0.2);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#aiModelModal .modal-loading p {
    color: #a0a0b0;
    font-size: 14px;
    margin: 0;
}

.model-detail-container {
    padding: 0;
}

.model-detail-header {
    margin-bottom: 30px;
}

.model-detail-banner {
    width: 100%;
    height: 300px;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
}

.model-detail-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.model-detail-title-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.model-detail-title-row h2 {
    margin: 0;
    font-size: 28px;
    color: #fff;
    flex: 1;
    min-width: 200px;
}

.model-base-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #a0a0b0;
    font-size: 14px;
    margin-bottom: 15px;
}

.model-base-info strong {
    color: #00d4ff;
}

.model-detail-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.model-detail-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e0e0e0;
    font-size: 14px;
}

.model-detail-stats .stat-item i {
    color: #00d4ff;
    font-size: 16px;
}

.model-detail-section {
    margin-bottom: 30px;
}

.model-detail-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    color: #fff;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(0, 212, 255, 0.2);
}

.model-detail-section h3 i {
    color: #00d4ff;
}

.model-description {
    color: #c0c0c0;
    line-height: 1.8;
    font-size: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border-left: 3px solid #00d4ff;
}

.model-description h1,
.model-description h2,
.model-description h3 {
    color: #fff;
    margin-top: 20px;
    margin-bottom: 10px;
}

.model-description p {
    margin-bottom: 10px;
}

.model-description code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    color: #00d4ff;
}

.model-description pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.model-layers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.layer-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
}

.layer-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #00d4ff;
    transform: translateY(-2px);
}

.layer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.layer-name {
    font-weight: 600;
    color: #fff;
    font-size: 14px;
}

.layer-type {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.layer-triggers {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #00d4ff;
    font-size: 12px;
    margin-bottom: 8px;
    padding: 8px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 6px;
}

.layer-description {
    color: #a0a0b0;
    font-size: 13px;
    line-height: 1.6;
}

.recent-generations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.generation-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.generation-card:hover {
    transform: scale(1.05);
}

.generation-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.generation-user {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 12px;
}

.model-detail-actions {
    display: flex;
    gap: 15px;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 255, 255, 0.05);
}

.model-detail-actions .btn-primary,
.model-detail-actions .btn-secondary {
    flex: 1;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
}

.model-detail-actions .btn-primary {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #000;
}

.model-detail-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 212, 255, 0.4);
}

.model-detail-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.model-detail-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.error-message {
    text-align: center;
    padding: 40px;
    color: #ff6b6b;
}

.error-message i {
    font-size: 48px;
    margin-bottom: 15px;
}

.error-detail {
    color: #a0a0b0;
    font-size: 14px;
    margin-top: 10px;
}

/* ========== Upgraded right panel (Best for, meters, token tier, advanced) ========== */
.user-profile-modal.ai-model-detail-view .ai-model-detail-panel,
#aiModelModal .ai-model-detail-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-profile-modal.ai-model-detail-view .ai-model-badges,
#aiModelModal .ai-model-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.user-profile-modal.ai-model-detail-view .ai-model-badge,
#aiModelModal .ai-model-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.user-profile-modal.ai-model-detail-view .ai-model-badge-category,
#aiModelModal .ai-model-badge-category {
    background: rgba(0, 212, 255, 0.15);
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.user-profile-modal.ai-model-detail-view .ai-model-badge-tier,
#aiModelModal .ai-model-badge-tier {
    background: rgba(255, 255, 255, 0.06);
    color: #c0c0c0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-profile-modal.ai-model-detail-view .ai-model-meta,
#aiModelModal .ai-model-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: #a0a0b0;
}

.user-profile-modal.ai-model-detail-view .ai-model-typical-cost,
#aiModelModal .ai-model-typical-cost {
    color: rgba(0, 212, 255, 0.9);
}

.user-profile-modal.ai-model-detail-view .ai-model-tagline,
#aiModelModal .ai-model-tagline {
    margin: 0 0 0.5rem 0;
    color: #c0c0d0;
    font-size: 14px;
    line-height: 1.45;
}

.user-profile-modal.ai-model-detail-view .ai-model-best-for,
#aiModelModal .ai-model-best-for {
    margin: 0;
}

.user-profile-modal.ai-model-detail-view .ai-model-best-for-list,
#aiModelModal .ai-model-best-for-list {
    margin: 6px 0 0 0;
    padding-left: 1.2rem;
    color: #e0e0e0;
    font-size: 14px;
    line-height: 1.5;
}

.user-profile-modal.ai-model-detail-view .ai-model-best-for-more,
#aiModelModal .ai-model-best-for-more {
    margin-top: 6px;
    padding: 6px 0;
    background: none;
    border: none;
    color: #00d4ff;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
}
.user-profile-modal.ai-model-detail-view .ai-model-best-for-more:hover,
#aiModelModal .ai-model-best-for-more:hover {
    color: #66e0ff;
}

.user-profile-modal.ai-model-detail-view .ai-model-powered-by,
#aiModelModal .ai-model-powered-by {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 0.5rem;
    font-size: 13px;
    color: #a0a0b0;
}
.user-profile-modal.ai-model-detail-view .ai-model-powered-by .detail-label,
#aiModelModal .ai-model-powered-by .detail-label {
    margin-right: 0.25em;
}
.user-profile-modal.ai-model-detail-view .ai-model-powered-by .ai-model-powered-by-name,
#aiModelModal .ai-model-powered-by .ai-model-powered-by-name {
    color: #e0e0e0;
    margin-left: 0.35em;
}

.user-profile-modal.ai-model-detail-view .ai-model-meters,
#aiModelModal .ai-model-meters {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-profile-modal.ai-model-detail-view .ai-model-meter,
#aiModelModal .ai-model-meter {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile-modal.ai-model-detail-view .ai-model-meter-label,
#aiModelModal .ai-model-meter-label {
    width: 72px;
    font-size: 13px;
    color: #a0a0b0;
    flex-shrink: 0;
}

.user-profile-modal.ai-model-detail-view .ai-model-meter-dots,
#aiModelModal .ai-model-meter-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.user-profile-modal.ai-model-detail-view .model-meter-dot,
#aiModelModal .model-meter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.2s ease;
}

.user-profile-modal.ai-model-detail-view .model-meter-dot.filled,
#aiModelModal .model-meter-dot.filled {
    background: rgba(0, 212, 255, 0.8);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

/* Advanced accordion */
.user-profile-modal.ai-model-detail-view .ai-model-advanced,
#aiModelModal .ai-model-advanced {
    margin-top: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.user-profile-modal.ai-model-detail-view .ai-model-advanced-toggle,
#aiModelModal .ai-model-advanced-toggle {
    width: 100%;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    color: #c0c0c0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.user-profile-modal.ai-model-detail-view .ai-model-advanced-toggle:hover,
#aiModelModal .ai-model-advanced-toggle:hover {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.06);
}

.user-profile-modal.ai-model-detail-view .ai-model-advanced-toggle .fa-chevron-down,
#aiModelModal .ai-model-advanced-toggle .fa-chevron-down {
    transition: transform 0.2s ease;
}

.user-profile-modal.ai-model-detail-view .ai-model-advanced.is-open .ai-model-advanced-toggle .fa-chevron-down,
#aiModelModal .ai-model-advanced.is-open .ai-model-advanced-toggle .fa-chevron-down {
    transform: rotate(180deg);
}

.user-profile-modal.ai-model-detail-view .ai-model-advanced-content,
#aiModelModal .ai-model-advanced-content {
    display: none;
    padding: 12px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.user-profile-modal.ai-model-detail-view .ai-model-advanced.is-open .ai-model-advanced-content,
#aiModelModal .ai-model-advanced.is-open .ai-model-advanced-content {
    display: block;
}

/* Technical details accordion (collapsed by default) */
.user-profile-modal.ai-model-detail-view .ai-model-technical,
#aiModelModal .ai-model-technical {
    margin-top: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.user-profile-modal.ai-model-detail-view .ai-model-technical-toggle,
#aiModelModal .ai-model-technical-toggle {
    width: 100%;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    color: #c0c0c0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.user-profile-modal.ai-model-detail-view .ai-model-technical-toggle:hover,
#aiModelModal .ai-model-technical-toggle:hover {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.06);
}

.user-profile-modal.ai-model-detail-view .ai-model-technical-toggle .fa-chevron-down,
#aiModelModal .ai-model-technical-toggle .fa-chevron-down {
    transition: transform 0.2s ease;
}

.user-profile-modal.ai-model-detail-view .ai-model-technical.is-open .ai-model-technical-toggle .fa-chevron-down,
#aiModelModal .ai-model-technical.is-open .ai-model-technical-toggle .fa-chevron-down {
    transform: rotate(180deg);
}

.user-profile-modal.ai-model-detail-view .ai-model-technical-content,
#aiModelModal .ai-model-technical-content {
    display: none;
    padding: 12px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.user-profile-modal.ai-model-detail-view .ai-model-technical.is-open .ai-model-technical-content,
#aiModelModal .ai-model-technical.is-open .ai-model-technical-content {
    display: block;
}

.user-profile-modal.ai-model-detail-view .detail-actions,
#aiModelModal .detail-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 20px;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Create CTA: right half of row; Learn more stays compact on the left (override global flex:1 on .detail-action-btn) */
.user-profile-modal.ai-model-detail-view .detail-actions.ai-model-detail-actions-row,
#aiModelModal .detail-actions.ai-model-detail-actions-row {
    justify-content: flex-end;
    align-items: center;
}

.user-profile-modal.ai-model-detail-view .detail-actions.ai-model-detail-actions-row > .detail-action-btn,
#aiModelModal .detail-actions.ai-model-detail-actions-row > .detail-action-btn {
    flex: 0 0 auto;
}

.user-profile-modal.ai-model-detail-view .ai-model-create-cta-wrap,
#aiModelModal .ai-model-create-cta-wrap {
    flex: 0 0 50%;
    max-width: 50%;
    margin-left: auto;
    display: flex;
    justify-content: flex-end;
    box-sizing: border-box;
}

.user-profile-modal.ai-model-detail-view .ai-model-create-cta-wrap .detail-action-btn.primary,
.user-profile-modal.ai-model-detail-view .ai-model-create-cta-wrap a.detail-action-btn.primary,
#aiModelModal .ai-model-create-cta-wrap .detail-action-btn.primary,
#aiModelModal .ai-model-create-cta-wrap a.detail-action-btn.primary {
    flex: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    text-decoration: none;
}

.user-profile-modal.ai-model-detail-view .detail-action-btn.primary,
#aiModelModal .detail-action-btn.primary {
    background:linear-gradient(135deg, #000000 0%, #162125 100%);
    color: #17a5a5;
    padding: 14px 24px;
    border-radius: 10px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.user-profile-modal.ai-model-detail-view .detail-action-btn.primary:hover,
#aiModelModal .detail-action-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.35);
}

/* Responsive */
@media (max-width: 768px) {
    .user-profile-modal.ai-model-detail-view .ai-model-create-cta-wrap,
    #aiModelModal .ai-model-create-cta-wrap {
        flex: 1 1 100%;
        max-width: 100%;
        margin-left: 0;
        justify-content: stretch;
    }

    #aiModelModal .profile-modal-container {
        width: 95%;
        max-height: 95vh;
    }
    
    #aiModelModal .profile-modal-header {
        padding: 15px 20px;
    }
    
    #aiModelModal .profile-modal-header .header-left h2 {
        font-size: 18px;
    }
    
    #aiModelModal .profile-modal-body {
        padding: 20px;
    }
    
    .model-detail-title-row h2 {
        font-size: 22px;
    }
    
    .model-layers-grid {
        grid-template-columns: 1fr;
    }
    
    .recent-generations-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .model-detail-actions {
        flex-direction: column;
    }
}

