/**
 * User Profile Modal Styles
 * CivitAI-style modal with split layout
 */

/* Modal Overlay */
.user-profile-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* When opened from create modal, appear above it */
.user-profile-modal.above-create-modal {
    z-index: 10001 !important;
}

body.light-mode .user-profile-modal {
    background: rgba(0, 0, 0, 0.5);
}

.user-profile-modal.active {
    opacity: 1;
}

/* Modal Container */
.profile-modal-container {
    width: 98vw;
    max-width: 98vw;
    height: 96vh;
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.user-profile-modal.active .profile-modal-container {
    transform: scale(1);
}

/* Fullscreen Mode */
.user-profile-modal.fullscreen .profile-modal-container {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
}

/* Modal Header */
.profile-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}

.profile-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.profile-modal-title i {
    color: #00d4ff;
    font-size: 20px;
}

.profile-modal-controls {
    display: flex;
    gap: 8px;
}

.modal-control-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-control-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Modal Body (Split Layout) */
.profile-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Side: Media Display (70%) */
.profile-media-section {
    flex: 0 0 70%;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    position: relative;
}

.profile-media-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

.profile-media-item {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    object-fit: contain;
}

.profile-media-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: rgba(255, 255, 255, 0.5);
}

.profile-media-loading i {
    font-size: 48px;
    color: #00d4ff;
}

.profile-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: rgba(255, 255, 255, 0.7);
    padding: 40px;
    text-align: center;
}

.profile-error-state i {
    font-size: 48px;
    color: #ff6b6b;
}

/* Media Navigation */
.profile-media-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.media-nav-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-nav-btn:hover {
    background: rgba(0, 212, 255, 0.3);
    transform: scale(1.1);
}

.media-counter {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-family: monospace;
}

/* Right Side: User Info + Details (30%) */
.profile-info-section {
    flex: 0 0 30%;
    background: var(--bg-primary);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
}

/* Custom Scrollbar */
.profile-info-section::-webkit-scrollbar {
    width: 8px;
}

.profile-info-section::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.profile-info-section::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 4px;
}

.profile-info-section::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.5);
}

/* User Header */
.profile-user-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.profile-user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d4ff, #8a2be2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.profile-user-details {
    flex: 1;
}

.profile-user-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
}

.profile-user-joined {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}

/* User Stats */
.profile-user-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.stat-box {
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #00d4ff;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Generation Details */
.profile-generation-details {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.details-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
}

.details-title i {
    color: #00d4ff;
}

.detail-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

.detail-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
}

.detail-prompt {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.detail-prompt-text {
    margin-top: 8px;
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.8;
    background: var(--bg-surface);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.detail-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.detail-action-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.detail-action-btn.primary {
    background: linear-gradient(135deg, #00d4ff, #0099ff);
    color: var(--text-primary);
}

.detail-action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.detail-action-btn:not(.primary) {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.detail-action-btn:not(.primary):hover {
    background: var(--bg-secondary);
}

/* User Gallery */
/* Gallery styles removed - no longer needed */

/* Minimized Box - Left side to avoid collision with create-modal */
.profile-minimized-box {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 9998;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.profile-minimized-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 212, 255, 0.2);
}

.minimized-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 600;
}

.minimized-content i {
    color: #00d4ff;
    font-size: 18px;
}

.minimized-close {
    width: 24px;
    height: 24px;
    border: none;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.minimized-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .profile-media-section {
        flex: 0 0 65%;
    }
    
    .profile-info-section {
        flex: 0 0 35%;
    }
}

@media (max-width: 968px) {
    .user-profile-modal > div:first-child {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
    
    .profile-modal-body {
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .profile-media-section,
    .profile-info-section {
        flex: 1 1 auto;
    }
    
    .profile-info-section {
        overflow-y: visible;
    }
    
    /* Gallery removed */
}

@media (max-width: 576px) {
    .profile-modal-header {
        padding: 16px;
    }
    
    .profile-modal-title {
        font-size: 16px;
    }
    
    .profile-info-section {
        padding: 16px;
    }
    
    .profile-user-name {
        font-size: 20px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    /* Gallery removed */
}

/* =====================
   TAG SYSTEM STYLES
   ===================== */

.detail-tags-section {
    margin-top: 20px;
    padding-top: 20px;
    padding-bottom: 10px;
    border-top: 1px solid var(--border-color);
    display: block !important;
    visibility: visible !important;
    min-height: 60px !important;
    width: 100% !important;
    overflow: visible !important;
}

.detail-tags-section .detail-label {
    text-transform: none !important; /* Override any uppercase styling */
    font-weight: 500;
    font-size: 14px !important;
    line-height: 1.5 !important;
    min-height: 20px !important;
    display: block !important;
    margin-bottom: 8px !important;
    color: var(--text-secondary) !important;
}

.tags-container,
#mediaTags {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 12px;
    min-height: 40px !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    align-items: center !important;
    padding: 4px 0 !important;
}

#mediaTags > * {
    visibility: visible !important;
    opacity: 1 !important;
}

.no-tags {
    display: inline-block !important;
    color: var(--text-tertiary);
    font-size: 13px;
    font-style: italic;
    visibility: visible !important;
    opacity: 1 !important;
}

.media-tag {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(138, 43, 226, 0.15));
    color: #00d4ff !important;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px !important;
    font-weight: 500;
    border: 1px solid rgba(0, 212, 255, 0.3);
    transition: all 0.2s ease;
    visibility: visible !important;
    min-height: 28px !important;
    min-width: 60px !important;
    line-height: 1.4 !important;
    white-space: nowrap !important;
}

.media-tag:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.25), rgba(138, 43, 226, 0.25));
    border-color: rgba(0, 212, 255, 0.5);
    transform: translateY(-1px);
}

.tag-remove {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 11px;
    padding: 2px;
    transition: color 0.2s ease;
}

.tag-remove:hover {
    color: #ff4757;
}

.no-tags {
    color: var(--text-tertiary);
    font-size: 13px;
    font-style: italic;
}

.tag-input-container {
    position: relative;
    margin-top: 12px;
}

.tag-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.tag-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-surface);
}

.tag-input::placeholder {
    color: var(--text-secondary);
}

.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.tag-suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.tag-suggestion-item:last-child {
    border-bottom: none;
}

.tag-suggestion-item:hover {
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
}

.tag-count {
    color: var(--text-secondary);
    font-size: 12px;
    margin-left: 4px;
}

.popular-tags-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.popular-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.popular-tag {
    display: inline-block;
    background: var(--bg-surface);
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.popular-tag:hover {
    background: var(--bg-secondary);
    color: #00d4ff;
    border-color: var(--border-color);
    transform: translateY(-1px);
}

/* Tag Management Buttons */
.remove-tag-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 0 0 6px;
    margin-left: 4px;
    font-size: 10px;
    transition: all 0.2s ease;
    display: inline-flex !important;
    align-items: center;
    visibility: visible !important;
}

.remove-tag-btn:hover {
    color: #ff4444;
    transform: scale(1.1);
}

.add-tag-btn {
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    color: #00d4ff !important;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px !important;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    margin-left: 8px;
    visibility: visible !important;
    min-height: 28px !important;
    min-width: 80px !important;
    line-height: 1.4 !important;
    white-space: nowrap !important;
}

.add-tag-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    transform: translateY(-1px);
}

.add-tag-btn i {
    font-size: 10px;
}

/* Tag Input Wrapper */
.tag-input-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    background: var(--bg-surface);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.tag-input-wrapper .tag-input {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    width: 150px;
    outline: none;
    transition: all 0.2s ease;
}

.tag-input-wrapper .tag-input:focus {
    background: var(--bg-surface);
    border-color: var(--border-color);
}

.tag-input-btn {
        background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 12px;
}

.tag-input-btn:hover {
    transform: scale(1.05);
}

.save-tag-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: #00d4ff;
}

.cancel-tag-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: #ff4444;
}

/* Responsive tag styles */
@media (max-width: 768px) {
    .media-tag {
        font-size: 12px;
        padding: 5px 10px;
    }
    
    .tag-input {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .tag-input-wrapper .tag-input {
        width: 120px;
    }
}

