/* ========================================
   Emotion Analysis & TTS Demo Styles
   ======================================== */

/* Emotion Results Container */
#emotion-results {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#emotion-results.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Loading Container */
.loading-container {
    text-align: center;
    padding: 3rem 2rem;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1.5rem;
    border: 4px solid rgba(0, 204, 204, 0.2);
    border-top-color: var(--primary-teal, #00cccc);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-subtext {
    font-size: 0.9rem;
    color: var(--text-gray, #64748b);
    margin-top: 0.5rem;
}

/* Emotion Results Header */
.emotion-results-header h3 {
    color: var(--primary-teal, #00cccc);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.results-description {
    color: var(--text-gray, #64748b);
    font-size: 0.95rem;
}

/* Emotion Summary Section */
.emotion-summary {
    background: rgba(0, 204, 204, 0.1);
    border-left: 4px solid var(--primary-teal, #00cccc);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
}

.emotion-summary h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-teal, #00cccc);
    font-size: 1.25rem;
}

.emotion-summary p {
    color: var(--text-white, #fff);
    line-height: 1.7;
    margin-bottom: 0;
    font-size: 1rem;
}

/* Toggle Details Button */
.toggle-details {
    background: var(--primary-orange, #FF9933);
    color: #000;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
    width: 100%;
}

.toggle-details:hover {
    background: #FFB347;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 153, 51, 0.4);
}

.toggle-details:active {
    transform: translateY(0);
}

/* Collapsible Emotion Details */
.emotion-details {
    max-height: 3000px;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out, opacity 0.3s ease, margin-top 0.3s ease;
    opacity: 1;
    margin-top: 1rem;
}

.emotion-details.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.emotion-details h4 {
    color: var(--primary-teal, #00cccc);
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.15rem;
}

/* Emotions List */
.emotions-list {
    margin-top: 2rem;
}

.emotion-item {
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInLeft 0.5s ease forwards;
}

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.emotion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.emotion-label {
    font-weight: 600;
    color: var(--text-white, #fff);
    font-size: 1rem;
}

.emotion-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-teal, #00cccc);
}

/* Emotion Bar */
.emotion-bar-container {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.emotion-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

/* Emotion Footer */
.emotion-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Error Container */
.error-container {
    text-align: center;
    padding: 3rem 2rem;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-message {
    color: #f44336;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* TTS Demo Buttons */
.emotion-btn {
    position: relative;
    overflow: hidden;
}

.emotion-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0.9;
}

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

.emotion-btn.loading {
    opacity: 0.6;
    cursor: wait;
}

.emotion-btn.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.emotion-btn.active {
    box-shadow: 0 0 20px currentColor;
    transform: scale(1.05);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1000;
    max-width: 300px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-error {
    border-left: 4px solid #f44336;
}

.toast-success {
    border-left: 4px solid #4CAF50;
}

.toast-info {
    border-left: 4px solid #2196F3;
}

/* Audio Player Styling */
#emotion-audio {
    width: 100%;
    margin-top: 1.5rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
}

#emotion-audio::-webkit-media-controls-panel {
    background: linear-gradient(to bottom, rgba(0, 204, 204, 0.1), rgba(0, 0, 0, 0.3));
}

/* Button Styling (override inline styles on hover) */
#analyze-btn:hover {
    background: var(--primary-orange, #FF9933) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 204, 204, 0.4);
}

#analyze-btn:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white, #fff);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .emotion-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .emotion-label {
        font-size: 0.9rem;
    }

    .emotion-value {
        font-size: 1rem;
    }

    .emotion-buttons {
        grid-template-columns: 1fr 1fr !important;
    }

    .demo-phrase {
        font-size: 1.1rem !important;
        padding: 1rem !important;
    }

    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .emotions-list {
        margin-top: 1.5rem;
    }

    .emotion-item {
        margin-bottom: 1rem;
    }

    .loading-container,
    .error-container {
        padding: 2rem 1rem;
    }

    .spinner {
        width: 40px;
        height: 40px;
    }

    .emotion-results-header h3 {
        font-size: 1.25rem;
    }

    .results-description {
        font-size: 0.85rem;
    }
}
