/* ========================================
   PHASE 3: ENHANCED MICRO-INTERACTIONS CSS
   ======================================== */

/* Ripple Effect System */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::before {
    width: 300px;
    height: 300px;
    transition: width 0s, height 0s;
}

body.dark-theme .ripple::before {
    background: rgba(255, 255, 255, 0.3);
}

/* Enhanced Button States */
.control-btn,
.mode-btn,
.template-btn,
.action-btn,
.send-btn {
    will-change: transform;
}

.control-btn:active,
.mode-btn:active,
.template-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* Glow effect for primary buttons */
@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    }

    50% {
        box-shadow: 0 5px 25px rgba(102, 126, 234, 0.6);
    }
}

/* Enhanced Message Animations */
@keyframes slideUpBounce {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }

    60% {
        opacity: 1;
        transform: translateY(-5px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: slideUpBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Message hover effect */
.message:hover .message-content {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

body.dark-theme .message:hover .message-content {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Staggered animation for multiple messages */
.message:nth-child(1) {
    animation-delay: 0s;
}

.message:nth-child(2) {
    animation-delay: 0.1s;
}

.message:nth-child(3) {
    animation-delay: 0.2s;
}

.message:nth-child(4) {
    animation-delay: 0.3s;
}

.message:nth-child(5) {
    animation-delay: 0.4s;
}

/* New message pulse */
@keyframes newMessagePulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(102, 126, 234, 0);
    }
}

.message.new-message .message-content {
    animation: newMessagePulse 1s ease-out;
}

/* Enhanced Loading States */
@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: translateY(0) scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: translateY(-8px) scale(1);
        opacity: 1;
    }
}

.typing-dots span {
    animation: typingBounce 1.4s infinite ease-in-out !important;
}

/* Skeleton loader for streaming messages */
.skeleton-loader {
    background: linear-gradient(90deg,
            var(--chat-messages-bg) 25%,
            var(--message-assistant-border) 50%,
            var(--chat-messages-bg) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
    height: 20px;
    margin: 5px 0;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Send button loading state */
@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 0.7;
    }
}

/* Enhanced Input Focus Effects */
.message-input:focus {
    transform: translateY(-2px);
}

/* Animated border glow */
@keyframes borderGlow {

    0%,
    100% {
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }

    50% {
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    }
}

.message-input:focus {
    animation: borderGlow 2s infinite;
}

/* File Upload Animations */
.upload-section {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-section.drag-over {
    border-color: #667eea !important;
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

.file-item {
    animation: slideInLeft 0.4s ease-out;
}

@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* File upload progress bar */
.upload-progress {
    height: 3px;
    background: var(--input-border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 5px;
}

.upload-progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
}

/* Smooth Scroll Behavior */
.chat-messages {
    scroll-behavior: smooth;
}

/* Scroll to top button */
.scroll-to-top {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Enhanced Notification System */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 12px;
    color: white;
    z-index: 1001;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 350px;
}

@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(100px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.notification.success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.notification.error {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.notification.info {
    background: linear-gradient(135deg, #17a2b8, #138496);
}

.notification.warning {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #212529;
}

/* Notification progress bar */
.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    width: 100%;
    border-radius: 0 0 12px 12px;
}

.notification-progress-bar {
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    width: 100%;
    animation: notificationProgress 3s linear;
}

@keyframes notificationProgress {
    0% {
        width: 100%;
    }

    100% {
        width: 0%;
    }
}

/* Mode switching animations */
.mode-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-btn.active {
    animation: modeActivate 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes modeActivate {
    0% {
        transform: scale(0.9);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Mode badge slide animation */
.mode-badge {
    animation: badgeSlide 0.4s ease-out;
}

@keyframes badgeSlide {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Theme toggle icon transition */
.theme-toggle i {
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: inline-block;
}

.theme-toggle:hover i {
    transform: rotate(180deg) scale(1.2);
}

/* Action button reveal animation */
.message-actions {
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.3s ease;
}

.message:hover .message-actions {
    opacity: 1;
    transform: translateY(0);
}

/* Copy success feedback */
@keyframes copySuccess {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

.action-btn.copy.copied {
    animation: copySuccess 0.4s ease;
    background: #28a745 !important;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
