/**
 * SempiCoach Universal Popup Styles
 * Modern, trendy design with Sempi branding
 */

/* ===== FLOATING ACTION BUTTON (FAB) ===== */
#sempicoach-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    background: linear-gradient(145deg, #F16926, #ff8447);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(241, 105, 38, 0.5);
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fabPulse 2s infinite;
}

#sempicoach-fab:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 35px rgba(241, 105, 38, 0.7);
}

.coach-fab-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coach-fab-inner i {
    font-size: 32px;
    color: white;
    animation: robotBounce 3s infinite;
}

.pulse-ring {
    position: absolute;
    width: 70px;
    height: 70px;
    border: 3px solid #F16926;
    border-radius: 50%;
    opacity: 0;
    animation: pulseRing 2s infinite;
}

@keyframes fabPulse {
    0%, 100% { box-shadow: 0 8px 25px rgba(241, 105, 38, 0.5); }
    50% { box-shadow: 0 12px 35px rgba(241, 105, 38, 0.7); }
}

@keyframes robotBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes pulseRing {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* ===== POPUP CONTAINER ===== */
.sempicoach-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.sempicoach-popup.active {
    opacity: 1;
    pointer-events: all;
}

.sempicoach-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.sempicoach-popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    background: linear-gradient(135deg, rgba(20, 20, 20, 0.98) 0%, rgba(30, 30, 30, 0.95) 100%);
    border: 2px solid rgba(241, 105, 38, 0.4);
    border-radius: 28px;
    padding: 0;
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 0 60px rgba(241, 105, 38, 0.2);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.sempicoach-popup-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, #F16926, transparent);
    border-radius: 28px 28px 0 0;
    z-index: 1;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.sempicoach-popup.active .sempicoach-popup-content {
    transform: translate(-50%, -50%) scale(1);
}

/* ===== HEADER ===== */
.sempicoach-header {
    background: linear-gradient(145deg, #F16926, #ff6b35);
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    box-shadow: 0 4px 20px rgba(241, 105, 38, 0.3);
}

.coach-avatar-large {
    position: relative;
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.avatar-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4), transparent);
    animation: avatarGlow 3s infinite;
}

@keyframes avatarGlow {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.coach-avatar-large i {
    font-size: 42px;
    color: white;
    z-index: 1;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.coach-title-section {
    flex: 1;
}

.coach-title-section h2 {
    margin: 0;
    color: white;
    font-size: 28px;
    font-weight: 700;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.coach-subtitle {
    margin: 5px 0 0 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 400;
}

.close-popup-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    z-index: 2;
}

.close-popup-btn:hover {
    background: rgba(241, 105, 38, 0.2);
    border-color: rgba(241, 105, 38, 0.4);
    transform: rotate(90deg) scale(1.1);
}

/* ===== MODE BADGE FIXED (solo Stile Sempi) ===== */
.mode-badge-fixed {
    padding: 15px 20px;
    background: linear-gradient(145deg, #F16926, #ff8447);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(241, 105, 38, 0.3);
}

.mode-badge-fixed .mode-icon {
    font-size: 20px;
}

/* ===== CONTENT AREA ===== */
.coach-content-area {
    padding: 25px;
    max-height: 50vh;
    overflow-y: auto;
    background: #1a1a1a;
}

.coach-content-area::-webkit-scrollbar {
    width: 8px;
}

.coach-content-area::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.coach-content-area::-webkit-scrollbar-thumb {
    background: linear-gradient(145deg, #F16926, #ff8447);
    border-radius: 10px;
}

.context-info-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.context-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(241, 105, 38, 0.3);
}

.context-header i {
    font-size: 24px;
    color: #F16926;
}

.context-header h3 {
    margin: 0;
    color: white;
    font-size: 22px;
    font-weight: 700;
}

.context-section {
    margin-bottom: 20px;
}

.context-section h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #F16926;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.context-section h4 i {
    font-size: 18px;
}

.context-section p {
    color: #ccc;
    line-height: 1.7;
    margin: 0;
    font-size: 14px;
}

.tips-section {
    background: rgba(241, 105, 38, 0.1);
    border-left: 4px solid #F16926;
    padding: 15px;
    border-radius: 10px;
}

.tips-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
}

.tips-list li {
    color: #fff;
    padding: 8px 0;
    font-size: 14px;
    line-height: 1.6;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tips-list li:last-child {
    border-bottom: none;
}

/* ===== INPUT SECTION ===== */
.coach-input-section {
    display: flex;
    gap: 10px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.coach-input {
    flex: 1;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 14px;
    transition: all 0.3s ease;
}

.coach-input:focus {
    outline: none;
    border-color: #F16926;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(241, 105, 38, 0.1);
}

.coach-input::placeholder {
    color: #999;
}

.send-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(145deg, #F16926, #ff8447);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(241, 105, 38, 0.3);
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(241, 105, 38, 0.5);
}

.send-btn:active {
    transform: translateY(0);
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    #sempicoach-fab {
        width: 60px;
        height: 60px;
        bottom: 20px;
        right: 20px;
    }

    .coach-fab-inner i {
        font-size: 28px;
    }

    .sempicoach-popup-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 20px;
    }

    .sempicoach-header {
        padding: 20px;
    }

    .coach-avatar-large {
        width: 60px;
        height: 60px;
    }

    .coach-avatar-large i {
        font-size: 32px;
    }

    .coach-title-section h2 {
        font-size: 22px;
    }

    .mode-badge-fixed {
        padding: 12px 15px;
        font-size: 14px;
    }

    .coach-content-area {
        padding: 15px;
    }

    .context-info-card {
        padding: 15px;
    }

    .coach-input-section {
        padding: 15px;
    }
}

/* ===== RESPONSE CARDS (3 MODALITÀ) ===== */
.coach-response-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-top: 15px;
    animation: slideInUp 0.5s ease;
}

.coach-response-card .response-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(241, 105, 38, 0.2);
}

.coach-response-card .mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(45deg, #F16926, #ff8447);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.coach-response-card .response-header h4 {
    color: #1a1a1a;
    font-size: 16px;
    margin: 0;
    flex: 1;
}

.coach-response-card .response-body {
    color: #333;
    line-height: 1.6;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
