/* Gems Manager Container */
#gems-manager-view {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Gems Manager Styles */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-body);
}

.view-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.view-header .btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.view-header .btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(243, 123, 32, 0.3);
}

.view-header .btn-primary svg {
    width: 18px;
    height: 18px;
}

.gems-grid-container {
    padding: 37px 32px 32px 32px;
    /* 5px extra top padding */
    flex: 1;
    overflow-y: auto;
    background: var(--bg-body);
}

.gems-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding: 4px 8px 0 0;
    /* Extra top padding for hover effect */
}

.gems-grid::-webkit-scrollbar {
    width: 8px;
}

.gems-grid::-webkit-scrollbar-track {
    background: var(--bg-body);
    border-radius: 4px;
}

.gems-grid::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.gems-grid::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.gem-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.gem-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-color: var(--accent-color);
}

.gem-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.gem-icon-large {
    font-size: 2rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    border-radius: 12px;
}

.gem-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.gem-card:hover .gem-actions {
    opacity: 1;
}

.gem-action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gem-action-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.gem-action-btn.delete-gem-btn:hover {
    color: #ef4444;
}

.gem-card-body {
    flex: 1;
    overflow: hidden;
}

.gem-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gem-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 3;
}

.gem-card-footer {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.gem-purpose-badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.gem-purpose-badge.purpose-chat {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.gem-purpose-badge.purpose-media {
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
}

.gem-model-badge {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    background: var(--bg-body);
    padding: 4px 8px;
    border-radius: 4px;
}

.shared-badge {
    font-size: 0.75rem;
    color: var(--accent-color);
    background: rgba(243, 123, 32, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    font-weight: 500;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Gems Loading Animation - Override stats-view spinner */
.gems-grid-container .loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    height: 200px;
    /* Override any inherited animations */
    animation: none !important;
    border: none !important;
    width: auto !important;
}

.gems-grid-container .loading-dots {
    display: flex;
    gap: 12px;
    align-items: center;
}

.gems-grid-container .loading-dots .dot {
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: pulse-dot 1.4s ease-in-out infinite;
}

.gems-grid-container .loading-dots .dot:nth-child(1) {
    animation-delay: 0s;
}

.gems-grid-container .loading-dots .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.gems-grid-container .loading-dots .dot:nth-child(3) {
    animation-delay: 0.4s;
}

.gems-grid-container .loading-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

@keyframes pulse-dot {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.3);
        opacity: 1;
    }
}

.error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #ef4444;
}