/* Components - Reusable UI components */

/* Personality Mode Selector */
.personality-mode-selector {
  margin: 10px 0;
  padding: 10px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.personality-mode-selector .mode-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.personality-mode-selector .mode-header span {
  font-weight: 600;
  color: var(--text);
}

#personality-mode-select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s ease;
}

#personality-mode-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-alpha);
}

#personality-mode-select option {
  background: var(--background);
  color: var(--text);
}

/* Gamification Components */
.user-level-display {
  margin: 10px 0;
  padding: 15px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 12px;
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.level-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.level-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.level-number {
  font-size: 24px;
  font-weight: bold;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.level-title {
  font-size: 12px;
  margin-top: 5px;
  opacity: 0.9;
}

.level-progress {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: rgba(255,255,255,0.8);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  opacity: 0.9;
}

.achievements-btn {
  padding: 8px 16px;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease;
}

.achievements-btn:hover {
  background: rgba(255,255,255,0.3);
}

/* Achievement Modal */
.achievements-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--background);
  border-radius: 12px;
  max-width: 800px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  color: var(--text);
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text);
  padding: 5px;
}

.modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
}

.achievement-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  border-radius: 8px;
  border: 2px solid var(--border);
  transition: all 0.2s ease;
}

.achievement-card.earned {
  border-color: var(--success);
  background: rgba(76, 175, 80, 0.1);
}

.achievement-card.locked {
  opacity: 0.6;
  border-color: var(--border);
}

.achievement-icon {
  font-size: 32px;
  min-width: 50px;
  text-align: center;
}

.achievement-info h3 {
  margin: 0 0 5px 0;
  color: var(--text);
}

.achievement-info p {
  margin: 0 0 10px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.rarity {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
}

.rarity.common { background: #87CEEB; color: white; }
.rarity.rare { background: #32CD32; color: white; }
.rarity.epic { background: #9370DB; color: white; }
.rarity.legendary { background: #FFD700; color: black; }
.rarity.mythic { background: #FF6347; color: white; }

.earned-badge, .locked-badge {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 5px;
}

.earned-badge {
  background: var(--success);
  color: white;
}

.locked-badge {
  background: var(--border);
  color: var(--text-secondary);
}

/* Achievement Notification */
.achievement-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: black;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 1001;
  animation: slideIn 0.3s ease;
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notification-icon {
  font-size: 24px;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Buttons */
.btn {
    padding: 16px 32px;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    font-size: 18px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0) scale(0.98);
    transition: all 0.1s ease;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    pointer-events: none;
}

.btn:disabled::before {
    display: none;
}

.btn:disabled:hover {
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

/* Button variants */
.btn-primary {
    background: linear-gradient(135deg, #22d3ee, #0891b2);
    color: #000;
    border: none;
    box-shadow: 0 4px 15px rgba(34, 211, 238, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0891b2, #0e7490);
    box-shadow: 0 8px 25px rgba(34, 211, 238, 0.5);
    transform: translateY(-2px) scale(1.05);
}

.btn-primary:disabled {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: linear-gradient(135deg, #000, #1f2937);
    color: #fff;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #1f2937, #374151);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    transform: translateY(-2px) scale(1.05);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    border: none;
    padding: 15px 30px;
    font-size: 16.92px;
    transform: scale(0.94);
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c, #991b1b);
    transform: scale(0.94) translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.5);
}

.btn-danger:active {
    transform: scale(0.94) translateY(0);
}

/* Input fields */
.input-field {
    padding: 16px;
    border-radius: 12px;
    border: 2px solid #22d3ee;
    background: rgba(0,0,0,0.8);
    color: #fff;
    width: 60%;
    max-width: 500px;
    margin: 0 auto 16px auto;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(34, 211, 238, 0.2);
    position: relative;
    display: block;
}

.input-field:focus {
    outline: none;
    border-color: #0891b2;
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.1), 0 8px 25px rgba(34, 211, 238, 0.3);
    transform: translateY(-1px);
}

.input-field:hover {
    border-color: #0891b2;
    box-shadow: 0 6px 20px rgba(34, 211, 238, 0.25);
}

.input-field::placeholder {
    color: #9ca3af;
    transition: color 0.3s ease;
}

.input-field:focus::placeholder {
    color: #6b7280;
}

/* Character cards */
.character-card {
    border: none;
    border-radius: 0;
    padding: 2.5rem 2rem;
    background: transparent;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    box-shadow: none;
    position: relative;
    overflow: visible;
    animation: cardFadeIn 0.8s ease-out, gentleFloat 4s ease-in-out infinite;
    width: 100%;
    margin: 0 auto;
    backdrop-filter: none;
    pointer-events: auto;
    z-index: 1;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}


.character-card:hover {
    background: transparent;
    transform: translateY(-20px) scale(1.05);
    box-shadow: none;
    border: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}


.character-card:hover .character-icon {
    transform: scale(1.1) rotate(5deg);
    filter: brightness(1.2);
}

.character-card:hover .character-name {
    transform: translateY(-2px);
    text-shadow: 0 0 15px currentColor;
}

.character-card:hover .character-description {
    transform: translateY(-1px);
    opacity: 1;
}

.character-card:active {
    transform: translateY(-4px) scale(0.98);
    transition: all 0.1s ease;
}

.character-card.selected {
    border: none !important;
    background: transparent !important;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.9) !important;
    animation: selectedPulse 2s infinite ease-in-out, gentleFloat 4s ease-in-out infinite;
    z-index: 3;
}

/* Premium Character Styling - preserve inline styles */
.character-card.premium-character {
    /* Remove the overriding styles to allow inline styles to show */
    /* border, background, and box-shadow will come from inline styles */
}

.character-card.premium-character:hover {
    /* Preserve hover effects for premium characters */
    opacity: 0.9;
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

.character-card.selected::after {
    content: '✓';
    position: absolute;
    top: 15px;
    right: 15px;
    background: #ffd700;
    color: #000;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    animation: checkmarkBounce 0.5s ease-out;
}

.character-card:nth-child(1) {
    animation-delay: 0.2s;
}

.character-card:nth-child(2) {
    animation-delay: 0.4s;
}

/* Character-specific styles - all floating */
.character-card.character-crimson {
    position: relative;
    z-index: 10;
    cursor: pointer !important;
    background: transparent;
    border: none;
    background-clip: initial;
    box-shadow: none;
    backdrop-filter: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
    pointer-events: auto;
}

.character-card.character-blayzica {
    position: relative;
    z-index: 10;
    cursor: pointer !important;
    background: transparent;
    border: none;
    background-clip: initial;
    box-shadow: none;
    backdrop-filter: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.character-card.character-blayzia {
    position: relative;
    z-index: 10;
    cursor: pointer !important;
    background: transparent;
    border: none;
    background-clip: initial;
    box-shadow: none;
    backdrop-filter: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
    pointer-events: auto;
}

.character-card.character-violet {
    position: relative;
    z-index: 10;
    cursor: pointer !important;
    background: transparent;
    border: none;
    background-clip: initial;
    box-shadow: none;
    backdrop-filter: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
    pointer-events: auto;
}

.character-icon {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: iconFloat 3s ease-in-out infinite;
    display: inline-block;
}

.character-name {
    transition: all 0.3s ease;
    font-size: 2rem !important;
    font-weight: 700 !important;
    margin-bottom: 1rem !important;
    letter-spacing: -0.01em !important;
}

.character-description {
    transition: all 0.3s ease;
    opacity: 0.85;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    font-weight: 400 !important;
}

/* Chat components */
.chat-container {
    height: 300px;
    overflow-y: auto;
    border: 2px solid #22d3ee;
    background: rgba(0,0,0,0.8);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
    max-width: 800px;
    margin: 0 auto 16px auto;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: rgba(34, 211, 238, 0.5) transparent;
}

.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: rgba(34, 211, 238, 0.5);
    border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: rgba(34, 211, 238, 0.7);
}

.chat-message { 
    margin-bottom: 1rem; 
    padding: 0.75rem 1rem; 
    border-radius: 1rem; 
    background: rgba(0,0,0,0.8);
    transition: background-color 0.3s ease, color 0.3s ease;
    max-width: 70%;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

.user-message { 
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.8), rgba(34, 211, 238, 0.6));
    text-align: center; 
    border-bottom-right-radius: 0.25rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.ai-message { 
    background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(0,0,0,0.7)) !important;
    text-align: center; 
    border-bottom-left-radius: 0.25rem;
    border: 1px solid rgba(255,255,255,0.1);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.timestamp {
    font-size: 0.75rem;
    opacity: 0.7;
    font-weight: normal;
}

.message-text {
    line-height: 1.4;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(0,0,0,0.7));
    border-radius: 1rem;
    border-bottom-left-radius: 0.25rem;
    border: 1px solid rgba(255,255,255,0.1);
    max-width: 80%;
    margin-left: 0;
    margin-right: auto;
    transition: all 0.3s ease;
}

.typing-text {
    color: #22d3ee;
    font-style: italic;
    margin-right: 10px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #22d3ee;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0s;
}

/* Error messages */
.error-message {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.9), rgba(185, 28, 28, 0.8));
    border-radius: 1rem;
    border-bottom-left-radius: 0.25rem;
    border: 1px solid rgba(220, 38, 38, 0.3);
    max-width: 80%;
    margin-left: 0;
    margin-right: auto;
    transition: all 0.3s ease;
    animation: errorSlideIn 0.3s ease-out;
}

.error-content {
    flex: 1;
    color: #fff;
}

.error-title {
    font-weight: bold;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-text {
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.4;
}

.error-actions {
    display: flex;
    gap: 8px;
    margin-left: 12px;
}

.error-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.retry-btn {
    background: rgba(34, 211, 238, 0.9);
    color: #000;
}

.retry-btn:hover {
    background: rgba(34, 211, 238, 1);
    transform: translateY(-1px);
}

.retry-btn:disabled {
    background: rgba(107, 114, 128, 0.5);
    color: rgba(156, 163, 175, 0.8);
    cursor: not-allowed;
    transform: none;
}

.dismiss-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.dismiss-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(34, 211, 238, 0.9);
    color: #000;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    z-index: 10;
}

.scroll-indicator:hover {
    background: rgba(34, 211, 238, 1);
    transform: translateY(-2px);
}

/* Connection status */
.connection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    z-index: 100;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.connection-status.online {
    background: rgba(34, 197, 94, 0.9);
    color: #fff;
}

.connection-status.offline {
    background: rgba(220, 38, 38, 0.9);
    color: #fff;
}

.connection-status.connecting {
    background: rgba(249, 115, 22, 0.9);
    color: #fff;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: statusPulse 2s infinite;
}
