﻿/* Read More Button & Expandable Description */
.prediction-description {
    position: relative;
    margin: 1rem 0 0.5rem 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}

    .prediction-description.expandable {
        padding-bottom: 3.5rem;
    }

.description-content {
    position: relative;
    overflow: hidden;
    transition: max-height 0.4s ease;
    max-height: 4.2em;
    line-height: 1.4;
    width: 100%;
    text-align: left;
}

.description-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    text-align: left;
    word-break: break-word;
}

    .description-text h1,
    .description-text h2,
    .description-text h3,
    .description-text h4 {
        color: var(--text-primary);
        margin-top: 0.75rem;
        margin-bottom: 0.5rem;
        font-size: 0.95rem;
        line-height: 1.3;
        text-align: left;
        font-weight: 600;
    }

    .description-text p {
        margin-bottom: 0.75rem;
        line-height: 1.5;
        text-align: left;
    }

    .description-text ul,
    .description-text ol {
        padding-left: 1.5rem;
        margin-bottom: 0.75rem;
        text-align: left;
    }

    .description-text li {
        margin-bottom: 0.25rem;
        line-height: 1.5;
        text-align: left;
    }

.description-overlay {
    position: absolute;
    bottom: 3.5rem;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, rgba(15, 23, 42, 0.95));
    pointer-events: none;
    display: none;
    border-radius: 0 0 8px 8px;
}

/* Read More Button */
.btn-read-more {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.5);
    color: #667eea;
    padding: 0.6rem 1.5rem;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
    backdrop-filter: blur(15px);
    white-space: nowrap;
    min-width: 140px;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: buttonSlideUp 0.3s ease-out;
}

    .btn-read-more:hover {
        background: rgba(102, 126, 234, 0.3);
        border-color: #667eea;
        transform: translateX(-50%) translateY(-2px);
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    }

    .btn-read-more:active {
        transform: translateX(-50%) translateY(0);
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    }

    .btn-read-more.loading {
        pointer-events: none;
        opacity: 0.7;
    }

        .btn-read-more.loading .read-more-icon,
        .btn-read-more.loading .read-less-icon {
            animation: spin 1s linear infinite;
        }

/* Expanded State */
.prediction-description.expanded {
    padding-bottom: 1rem;
}

    .prediction-description.expanded .description-overlay {
        display: none !important;
    }

    .prediction-description.expanded .btn-read-more {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin: 1rem auto 0 auto;
        display: flex;
        width: fit-content;
    }

    .prediction-description.expanded .description-content {
        max-height: none !important;
    }

/* Hidden State */
.prediction-description:not(.expandable) .btn-read-more,
.prediction-description .btn-read-more.hidden {
    display: none;
}

/* Animations */
@keyframes buttonSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .prediction-description.expandable {
        padding-bottom: 3.25rem;
    }

    .description-overlay {
        bottom: 3.25rem;
        height: 35px;
    }

    .btn-read-more {
        padding: 0.5rem 1.25rem;
        font-size: 0.8rem;
        min-width: 130px;
        bottom: 0.6rem;
    }

    .prediction-description {
        padding: 0.875rem;
    }

        .prediction-description.expanded .btn-read-more {
            margin-top: 0.875rem;
        }

    .description-text {
        font-size: 0.85rem;
    }

        .description-text h1,
        .description-text h2,
        .description-text h3,
        .description-text h4 {
            font-size: 0.9rem;
        }
}

@media (max-width: 576px) {
    .prediction-description.expandable {
        padding-bottom: 4rem;
    }

    .description-overlay {
        bottom: 4rem;
        height: 30px;
    }

    .btn-read-more {
        padding: 0.5rem 1.25rem;
        font-size: 0.8rem;
        min-width: 120px;
        bottom: 1rem;
        gap: 0.4rem;
        width: 90%;
    }

    .prediction-description {
        padding: 0.75rem;
        margin: 0.75rem 0 0.5rem 0;
        text-align: center;
    }

    .description-content {
        max-height: 4.5em;
        text-align: center;
    }

    .description-text {
        font-size: 0.8rem;
        line-height: 1.5;
        text-align: center;
    }

        .description-text h1,
        .description-text h2,
        .description-text h3,
        .description-text h4 {
            font-size: 0.85rem;
            margin-top: 0.5rem;
            margin-bottom: 0.25rem;
            text-align: center;
        }

        .description-text p {
            text-align: center;
        }

        .description-text ul,
        .description-text ol {
            text-align: left;
            display: inline-block;
            margin-left: 0;
            padding-left: 1rem;
        }

    .prediction-description.expanded .btn-read-more {
        margin-top: 0.75rem;
        width: auto;
        position: static;
        transform: none;
        align-self: center;
    }
}

@media (max-width: 400px) {
    .prediction-description.expandable {
        padding-bottom: 3.5rem;
    }

    .description-overlay {
        bottom: 3.5rem;
        height: 25px;
    }

    .btn-read-more {
        padding: 0.45rem 1rem;
        font-size: 0.75rem;
        min-width: 110px;
        bottom: 0.75rem;
    }

    .prediction-description {
        padding: 0.6rem;
    }

    .description-text {
        font-size: 0.75rem;
    }

        .description-text h1,
        .description-text h2,
        .description-text h3,
        .description-text h4 {
            font-size: 0.8rem;
        }
}

@media (max-width: 320px) {
    .prediction-description.expandable {
        padding-bottom: 3rem;
    }

    .description-overlay {
        bottom: 3rem;
    }

    .btn-read-more {
        padding: 0.4rem 0.875rem;
        font-size: 0.7rem;
        min-width: 100px;
        bottom: 0.6rem;
    }

    .prediction-description {
        padding: 0.5rem;
    }

    .description-text {
        font-size: 0.7rem;
    }

        .description-text h1,
        .description-text h2,
        .description-text h3,
        .description-text h4 {
            font-size: 0.75rem;
        }
}
