/* UX Enhancements for Psychological Comfort - Phyzioline */

/* ===== ENHANCED COLOR PALETTE ===== */
:root {
    /* Primary Colors - Calming Medical Theme */
    --primary-color: #008080;
    --primary-light: #20b2aa;
    --primary-dark: #006666;
    --primary-gradient: linear-gradient(135deg, #008080, #20b2aa);
    
    /* Secondary Colors - Warm and Inviting */
    --secondary-color: #4a90e2;
    --secondary-light: #6bb6ff;
    --secondary-dark: #357abd;
    
    /* Accent Colors - Energizing */
    --accent-color: #ff6b6b;
    --accent-light: #ff8e8e;
    --accent-dark: #ff4757;
    
    /* Success Colors - Reassuring */
    --success-color: #2ecc71;
    --success-light: #58d68d;
    --success-dark: #27ae60;
    
    /* Warning Colors - Attention-grabbing */
    --warning-color: #f39c12;
    --warning-light: #f5b041;
    --warning-dark: #e67e22;
    
    /* Neutral Colors - Comfortable */
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    
    /* Psychological Comfort Variables */
    --comfort-shadow: 0 4px 20px rgba(0, 128, 128, 0.1);
    --comfort-radius: 16px;
    --comfort-transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --comfort-hover-lift: translateY(-4px);
    --comfort-active-scale: scale(0.98);
}

/* ===== GAMIFICATION ELEMENTS ===== */
.progress-ring {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 60px;
}

.progress-ring-circle {
    fill: none;
    stroke: var(--gray-200);
    stroke-width: 4;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.progress-ring-progress {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 4;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dasharray 0.5s ease-in-out;
}

.achievement-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    box-shadow: var(--comfort-shadow);
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.level-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--success-color), var(--success-light));
    color: white;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--comfort-shadow);
}

.streak-counter {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--warning-color);
    font-weight: 600;
}

.streak-flame {
    animation: flicker 1.5s ease-in-out infinite alternate;
}

@keyframes flicker {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0.8; transform: scale(1.1); }
}

/* ===== ENHANCED FEEDBACK SYSTEM ===== */
.feedback-positive {
    background: linear-gradient(135deg, var(--success-color), var(--success-light));
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--comfort-radius);
    box-shadow: var(--comfort-shadow);
    animation: successPulse 0.6s ease-out;
}

.feedback-negative {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--comfort-radius);
    box-shadow: var(--comfort-shadow);
    animation: errorShake 0.6s ease-out;
}

.feedback-neutral {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-light));
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--comfort-radius);
    box-shadow: var(--comfort-shadow);
    animation: infoSlide 0.6s ease-out;
}

@keyframes successPulse {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes infoSlide {
    0% { transform: translateY(-20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* ===== COMFORT-FOCUSED BUTTONS ===== */
.btn-comfort {
    background: var(--primary-gradient);
    border: none;
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--comfort-radius);
    font-weight: 600;
    font-size: 1rem;
    transition: var(--comfort-transition);
    box-shadow: var(--comfort-shadow);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.btn-comfort::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s ease;
}

.btn-comfort:hover {
    transform: var(--comfort-hover-lift);
    box-shadow: 0 8px 30px rgba(0, 128, 128, 0.3);
}

.btn-comfort:hover::before {
    left: 100%;
}

.btn-comfort:active {
    transform: var(--comfort-active-scale);
}

.btn-comfort-secondary {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-light));
}

.btn-comfort-success {
    background: linear-gradient(135deg, var(--success-color), var(--success-light));
}

.btn-comfort-warning {
    background: linear-gradient(135deg, var(--warning-color), var(--warning-light));
}

/* ===== ENHANCED CARDS WITH PSYCHOLOGICAL APPEAL ===== */
.comfort-card {
    background: white;
    border-radius: var(--comfort-radius);
    box-shadow: var(--comfort-shadow);
    transition: var(--comfort-transition);
    overflow: hidden;
    position: relative;
}

.comfort-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.comfort-card:hover {
    transform: var(--comfort-hover-lift);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.comfort-card:hover::before {
    transform: scaleX(1);
}

.comfort-card-body {
    padding: 2rem;
}

.comfort-card-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--comfort-transition);
}

.comfort-card:hover .comfort-card-icon {
    transform: scale(1.1) rotate(5deg);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
}

/* ===== MOOD-BASED THEMES ===== */
.theme-energetic {
    --primary-color: #ff6b6b;
    --primary-light: #ff8e8e;
    --primary-dark: #ff4757;
}

.theme-calm {
    --primary-color: #74b9ff;
    --primary-light: #a29bfe;
    --primary-dark: #6c5ce7;
}

.theme-professional {
    --primary-color: #2d3436;
    --primary-light: #636e72;
    --primary-dark: #000000;
}

.theme-warm {
    --primary-color: #fd79a8;
    --primary-light: #fdcb6e;
    --primary-dark: #e84393;
}

/* ===== MICRO-INTERACTIONS FOR COMFORT ===== */
.comfort-input {
    border: 2px solid var(--gray-300);
    border-radius: var(--comfort-radius);
    padding: 1rem 1.5rem;
    font-size: 1rem;
    transition: var(--comfort-transition);
    background: white;
    position: relative;
}

.comfort-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 128, 128, 0.1);
    transform: translateY(-2px);
    outline: none;
}

.comfort-input:valid {
    border-color: var(--success-color);
}

.comfort-input:invalid:not(:placeholder-shown) {
    border-color: var(--accent-color);
}

/* ===== LOADING STATES WITH PERSONALITY ===== */
.comfort-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
}

.comfort-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: comfortSpin 1s linear infinite;
}

@keyframes comfortSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.comfort-dots {
    display: flex;
    gap: 0.5rem;
}

.comfort-dot {
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: comfortBounce 1.4s ease-in-out infinite both;
}

.comfort-dot:nth-child(1) { animation-delay: -0.32s; }
.comfort-dot:nth-child(2) { animation-delay: -0.16s; }
.comfort-dot:nth-child(3) { animation-delay: 0s; }

@keyframes comfortBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ===== EMOTIONAL STATES INDICATORS ===== */
.mood-indicator {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--comfort-radius);
    margin-bottom: 1rem;
}

.mood-emoji {
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--comfort-transition);
    padding: 0.5rem;
    border-radius: 50%;
}

.mood-emoji:hover {
    transform: scale(1.2);
    background: white;
    box-shadow: var(--comfort-shadow);
}

.mood-emoji.active {
    background: var(--primary-color);
    transform: scale(1.1);
}

/* ===== PROGRESS VISUALIZATION ===== */
.comfort-progress {
    background: var(--gray-200);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    position: relative;
}

.comfort-progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 10px;
    transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

.comfort-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ===== CELEBRATION ANIMATIONS ===== */
.celebration {
    position: relative;
    overflow: hidden;
}

.celebration::before {
    content: '🎉';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    animation: celebrationBounce 0.6s ease-out;
    pointer-events: none;
}

@keyframes celebrationBounce {
    0% { transform: translateX(-50%) translateY(0) scale(0); }
    50% { transform: translateX(-50%) translateY(-10px) scale(1.2); }
    100% { transform: translateX(-50%) translateY(-5px) scale(1); }
}

.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    animation: confettiFall 3s linear infinite;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ===== COMFORT ZONES ===== */
.comfort-zone {
    background: linear-gradient(135deg, var(--gray-50), white);
    border: 1px solid var(--gray-200);
    border-radius: var(--comfort-radius);
    padding: 2rem;
    margin: 1rem 0;
    position: relative;
    overflow: hidden;
}

.comfort-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(0, 128, 128, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.comfort-zone-content {
    position: relative;
    z-index: 1;
}

/* ===== BREATHING ANIMATION FOR RELAXATION ===== */
.breathing-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--primary-gradient);
    margin: 2rem auto;
    animation: breathe 4s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* ===== SOUND WAVE VISUALIZATION ===== */
.sound-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 40px;
}

.sound-bar {
    width: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    animation: soundWave 1s ease-in-out infinite;
}

.sound-bar:nth-child(1) { animation-delay: 0s; height: 10px; }
.sound-bar:nth-child(2) { animation-delay: 0.1s; height: 20px; }
.sound-bar:nth-child(3) { animation-delay: 0.2s; height: 30px; }
.sound-bar:nth-child(4) { animation-delay: 0.3s; height: 25px; }
.sound-bar:nth-child(5) { animation-delay: 0.4s; height: 15px; }

@keyframes soundWave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

/* ===== RESPONSIVE COMFORT ADJUSTMENTS ===== */
@media (max-width: 768px) {
    :root {
        --comfort-radius: 12px;
    }
    
    .comfort-card-body {
        padding: 1.5rem;
    }
    
    .btn-comfort {
        padding: 0.875rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .comfort-card-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .breathing-circle {
        width: 80px;
        height: 80px;
    }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    .comfort-card,
    .btn-comfort,
    .comfort-input,
    .achievement-badge,
    .breathing-circle,
    .sound-bar {
        animation: none !important;
        transition: none !important;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --gray-50: #1a1a1a;
        --gray-100: #2d2d2d;
        --gray-200: #404040;
        --gray-300: #525252;
    }
    
    .comfort-card {
        background: var(--gray-100);
        color: white;
    }
    
    .comfort-zone {
        background: linear-gradient(135deg, var(--gray-100), var(--gray-50));
        border-color: var(--gray-300);
    }
}

/* ===== FOCUS STATES FOR ACCESSIBILITY ===== */
.btn-comfort:focus,
.comfort-input:focus,
.mood-emoji:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .comfort-card {
        border: 2px solid var(--gray-800);
    }
    
    .btn-comfort {
        border: 2px solid var(--gray-800);
    }
    
    .comfort-input {
        border: 3px solid var(--gray-800);
    }
}