/* Clumis Widget Styles - Isolated with prefix */
.clumis-widget * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.clumis-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    position: fixed;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.clumis-widget.position-br {
    bottom: 20px;
    right: 20px;
}

.clumis-widget.position-bl {
    bottom: 20px;
    left: 20px;
}

.clumis-widget.position-tr {
    top: 20px;
    right: 20px;
}

.clumis-widget.position-tl {
    top: 20px;
    left: 20px;
}

/* Theme Variables */
.clumis-widget.theme-default {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --primary-hover: rgba(102, 126, 234, 0.6);
    --primary-light: rgba(102, 126, 234, 0.1);
    --accent-color: #f59e0b;
}

.clumis-widget.theme-ocean {
    --primary-gradient: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    --primary-color: #0ea5e9;
    --primary-hover: rgba(14, 165, 233, 0.6);
    --primary-light: rgba(14, 165, 233, 0.1);
    --accent-color: #06b6d4;
}

.clumis-widget.theme-forest {
    --primary-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --primary-color: #10b981;
    --primary-hover: rgba(16, 185, 129, 0.6);
    --primary-light: rgba(16, 185, 129, 0.1);
    --accent-color: #f59e0b;
}

.clumis-widget.theme-sunset {
    --primary-gradient: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    --primary-color: #f97316;
    --primary-hover: rgba(249, 115, 22, 0.6);
    --primary-light: rgba(249, 115, 22, 0.1);
    --accent-color: #fbbf24;
}

.clumis-widget.theme-royal {
    --primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    --primary-color: #8b5cf6;
    --primary-hover: rgba(139, 92, 246, 0.6);
    --primary-light: rgba(139, 92, 246, 0.1);
    --accent-color: #a78bfa;
}

.clumis-widget.theme-black {
    --primary-gradient: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    --primary-color: #374151;
    --primary-hover: rgba(55, 65, 81, 0.6);
    --primary-light: rgba(55, 65, 81, 0.1);
    --accent-color: #f59e0b;
    --bg-primary: rgba(17, 24, 39, 0.95);
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border-color: #4b5563;
    --shadow-color: rgba(0, 0, 0, 0.4);
}

/* Dark Mode - Pure Black Background with Adapted Colors */
.clumis-widget.dark-mode {
    --bg-primary: rgba(0, 0, 0, 0.95) !important;
    --bg-secondary: #0a0a0a !important;
    --bg-tertiary: #1a1a1a !important;
    --text-primary: #ffffff !important;
    --text-secondary: #cccccc !important;
    --border-color: #333333 !important;
    --shadow-color: rgba(255, 255, 255, 0.1) !important;
}

/* Dark Mode Theme Adaptations */
.clumis-widget.dark-mode.theme-default {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-hover: rgba(102, 126, 234, 0.8);
    --primary-light: rgba(102, 126, 234, 0.2);
}

.clumis-widget.dark-mode.theme-ocean {
    --primary-gradient: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    --primary-hover: rgba(14, 165, 233, 0.8);
    --primary-light: rgba(14, 165, 233, 0.2);
}

.clumis-widget.dark-mode.theme-forest {
    --primary-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --primary-hover: rgba(16, 185, 129, 0.8);
    --primary-light: rgba(16, 185, 129, 0.2);
}

.clumis-widget.dark-mode.theme-sunset {
    --primary-gradient: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    --primary-hover: rgba(249, 115, 22, 0.8);
    --primary-light: rgba(249, 115, 22, 0.2);
}

.clumis-widget.dark-mode.theme-royal {
    --primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    --primary-hover: rgba(139, 92, 246, 0.8);
    --primary-light: rgba(139, 92, 246, 0.2);
}

.clumis-widget.dark-mode.theme-black {
    --primary-gradient: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    --primary-hover: rgba(75, 85, 99, 0.8);
    --primary-light: rgba(75, 85, 99, 0.2);
}

/* Minimized State */
.clumis-minimized {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-gradient);
    box-shadow: 0 4px 20px var(--primary-hover);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 12px;
    text-transform: lowercase;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.clumis-minimized:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px var(--primary-hover);
}

/* Minimized Image Mode */
.clumis-minimized-image {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.8);
    position: relative;
}

.clumis-minimized-image:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.clumis-minimized-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Notification badge positioning for image mode */
.clumis-minimized-image .clumis-notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    z-index: 30;
}

/* Notification Badge */
.clumis-notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
    z-index: 10;
}

.clumis-notification-badge.urgent {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.4);
}

.clumis-notification-badge.pulse {
    animation: clumis-pulse 2s infinite;
}

.clumis-notification-badge.urgent-pulse {
    animation: clumis-urgent-pulse 1.5s infinite;
}

.clumis-notification-badge.bounce-in {
    animation: clumis-bounce-in 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.clumis-notification-badge.hidden {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

/* Theme-aware notification colors */
.clumis-widget.theme-ocean .clumis-notification-badge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.clumis-widget.theme-forest .clumis-notification-badge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.clumis-widget.theme-sunset .clumis-notification-badge {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.clumis-widget.theme-royal .clumis-notification-badge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* Notification Badge Animations */
@keyframes clumis-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes clumis-urgent-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(249, 115, 22, 0.4);
    }
    25% {
        transform: scale(1.15);
        box-shadow: 0 4px 16px rgba(249, 115, 22, 0.6);
    }
    75% {
        transform: scale(1.05);
        box-shadow: 0 3px 12px rgba(249, 115, 22, 0.5);
    }
}

@keyframes clumis-bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Expanded State */
.clumis-expanded {
    width: min(350px, 25vw);
    max-height: 75vh;
    min-width: 300px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.clumis-header {
    height: 40px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    cursor: move;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.clumis-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.clumis-minimize-btn,
.clumis-dark-mode-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.clumis-minimize-btn {
    font-size: 18px;
}

.clumis-minimize-btn:hover,
.clumis-dark-mode-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Content Area */
.clumis-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    max-height: calc(75vh - 40px);
}

/* Authentication Forms */
.clumis-auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.clumis-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.clumis-form-label {
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.clumis-form-input {
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    background: white;
}

.clumis-form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.clumis-form-input.error {
    border-color: #ef4444;
}

.clumis-error-text {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
}

.clumis-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.clumis-btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.clumis-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-hover);
}

.clumis-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.clumis-btn-secondary:hover {
    background: #e5e7eb;
}

.clumis-btn-small {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.clumis-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
}

.clumis-link:hover {
    text-decoration: underline;
}

/* User Profile - Compact Version */
.clumis-profile {
    text-align: center;
    padding: 8px 0;
}

.clumis-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    margin: 0 auto 6px;
}

.clumis-username {
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
    font-size: 13px;
}

.clumis-coins {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 12px;
}

.clumis-profile-actions {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 6px;
}

/* Quest System */
.clumis-quest-tabs {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 16px;
}

.clumis-quest-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s ease;
    position: relative;
}

.clumis-quest-tab.active {
    color: var(--primary-color);
}

.clumis-quest-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.clumis-quest-tab:hover:not(.active) {
    color: #374151;
}

.clumis-quest-count {
    background: #e5e7eb;
    color: #6b7280;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
}

.clumis-quest-tab.active .clumis-quest-count {
    background: var(--primary-color);
    color: white;
}

.clumis-quest-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.clumis-quest-card {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
    background: white;
}

.clumis-quest-card:hover:not(.completed) {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--primary-light);
}

.clumis-quest-card.completed {
    background: #f0fdf4;
    border-color: #22c55e;
    cursor: default;
}

.clumis-quest-title {
    font-weight: 600;
    color: #111827;
    margin-bottom: 6px;
}

.clumis-quest-description {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 12px;
    line-height: 1.4;
}

.clumis-quest-reward {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.clumis-quest-coins {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--accent-color);
    font-weight: 600;
    font-size: 14px;
}

.clumis-quest-status {
    color: #22c55e;
    font-weight: 600;
    font-size: 12px;
}

.clumis-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

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

/* Quest Taking Interface */
.clumis-quest-interface {
    padding: 20px 0;
}

.clumis-question {
    margin-bottom: 20px;
}

.clumis-question-text {
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
    line-height: 1.4;
}

.clumis-answers {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.clumis-answer {
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.clumis-answer:hover {
    border-color: var(--primary-color);
    background: #f8faff;
}

.clumis-answer.selected {
    border-color: var(--primary-color);
    background: #f8faff;
}

.clumis-quest-progress {
    text-align: center;
    margin-bottom: 20px;
    color: #6b7280;
    font-size: 14px;
}

.clumis-back-btn {
    margin-bottom: 16px;
}

/* Profile Management */
.clumis-profile-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.clumis-profile-header {
    text-align: center;
    margin-bottom: 20px;
}

.clumis-profile-avatar-section {
    text-align: center;
    margin-bottom: 20px;
}

.clumis-avatar-upload {
    position: relative;
    display: inline-block;
}

.clumis-avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
    color: white;
    font-size: 12px;
}

.clumis-avatar-upload:hover .clumis-avatar-overlay {
    opacity: 1;
}

.clumis-theme-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.clumis-theme-option {
    width: 60px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.clumis-theme-option.selected {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.clumis-theme-option::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.clumis-theme-option.selected::after {
    opacity: 1;
}

.clumis-theme-default { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.clumis-theme-ocean { background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%); }
.clumis-theme-forest { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.clumis-theme-sunset { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }
.clumis-theme-royal { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }
.clumis-theme-black { background: linear-gradient(135deg, #1f2937 0%, #111827 100%); }

/* Loading and Success States */
.clumis-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.clumis-success {
    text-align: center;
    padding: 40px 20px;
}

.clumis-success-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #22c55e;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    margin: 0 auto 16px;
}

/* Responsive Design */
@media (max-width: 480px) {
    .clumis-expanded {
        width: calc(100vw - 40px);
        max-width: none;
        min-width: 280px;
    }
}

/* Hidden State */
.clumis-hidden {
    display: none;
}

/* Dragging State */
.clumis-dragging {
    transition: none;
}

/* Custom Scrollbar */
.clumis-content::-webkit-scrollbar {
    width: 6px;
}

.clumis-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.clumis-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.clumis-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}