/* Стили для главной страницы */

.main-title {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 2rem;
}

.main-container {
    position: relative; /* Added for correct pseudo-element positioning */
    width: 80vw;
    height: 80vw;
    max-width: 600px;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    margin: auto;
    position: relative; /* Added for absolute positioning of children */
    overflow: hidden; /* To clip sliding elements */
}

.top-ribbon {
    position: absolute; /* Changed to absolute */
    top: 0;
    left: 0;
    width: 100%;
    height: calc(50% - 5px); /* Occupy top half, with gap */
    background-color: var(--lilac-pale);
    border-radius: 15px;
    /* Removed margin-bottom: 10px; */
    transition: background-color 0.5s ease-in-out;
    user-select: none; /* Prevent text selection on drag */
    cursor: grab; /* Show that it's draggable */
    overflow: hidden; /* Ensure content is clipped during slide */
    z-index: 1; /* Ensure it's below bottom-section */
    margin-bottom: 20px; /* Add spacing below the top ribbon */
    /* Added for swipe feedback */
    transition: background-color 0.5s ease-in-out;
}

.top-ribbon.is-swiping {
    cursor: grabbing;
}

.bottom-section {
    position: absolute;
    top: calc(50% + 5px);
    left: 0;
    width: 100%;
    height: calc(50% - 5px);
    display: flex;
    gap: 10px;
    z-index: 2; /* Ensure it's above top-ribbon */
    overflow: hidden; /* To clip pseudo-element */
    border-radius: 15px; /* Match card radius */
}

.main-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 150%; /* Extend below the cards */
    background-color: var(--paper-grey);
    z-index: -1; /* Solid background */
}

.main-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px; /* 1-5 pixels blurred border */
    background-color: var(--paper-grey); /* Match background color */
    filter: blur(10px); /* Sharp blur */
    z-index: 2; /* Increased z-index to ensure visibility */
    overflow: hidden; /* Ensure blur is contained */
}


.left-ribbon {
    flex: 1;
    background-color: var(--lilac-pale);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.5s ease-in-out;
}

.banner {
    width: 80%;
    height: 40%;
    background-color: var(--white);
    border-radius: 10px;
}

.text-card {
    flex: 1;
    background-color: var(--grey-background);
    border-radius: 15px;
    padding: 20px;
    box-sizing: border-box;
    color: var(--text-color);
    position: relative; /* For absolute positioning of spinner */
    display: flex;
    flex-direction: column; /* Added to stack children vertically */
    aspect-ratio: 1 / 1;
}

.text-card.loading {
    justify-content: center;
    align-items: center;
    flex-direction: row; /* Temporarily change direction to center spinner */
}

.progress-balls {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.progress-balls span {
    display: block;
    width: 15px;
    height: 15px;
    background-color: #999;
    border-radius: 50%;
}

.text-card h4 {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 5px;
}

.text-card p {
    font-size: 1.1rem;
}

.progress-balls span.active {
    background-color: #333;
}

/* Top Ribbon Slide Animations */
@keyframes slideOutLeft {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

@keyframes slideInRight { /* This is not used for slide-in-up, but for consistency */
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slideOutRight {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

@keyframes slideInLeft { /* This is not used for slide-in-up, but for consistency */
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes slideInUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.top-ribbon.slide-out-left {
    animation: slideOutLeft 0.4s ease-in-out forwards;
}

.top-ribbon.slide-out-right {
    animation: slideOutRight 0.4s ease-in-out forwards;
}

.top-ribbon.slide-in-up {
    animation: slideInUp 0.4s ease-in-out forwards;
}

/* Loading Spinner */
.loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--text-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    position: absolute; /* Position absolutely within text-card */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Center the spinner */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* Carousel Slide Animations */
.carousel-slides.slide-out-left {
    animation: slideOutLeft 0.4s ease-in-out forwards;
}

.carousel-slides.slide-out-right {
    animation: slideOutRight 0.4s ease-in-out forwards;
}

.carousel-slides.slide-in-left {
    animation: slideInLeft 0.4s ease-in-out forwards;
}

.carousel-slides.slide-in-right {
    animation: slideInRight 0.4s ease-in-out forwards;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .main-container {
        width: 100%;
        max-width: 450px;
        height: auto;
        max-height: none;
        flex-direction: column;
        gap: 15px;
        margin: 0 auto;
        padding: 0;
    }

    .top-ribbon {
        position: relative;
        width: 100%;
        height: 350px;
        top: auto;
        left: auto;
        margin-bottom: 0;
    }

    .bottom-section {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        height: auto;
        flex-direction: column;
        gap: 0;
    }

    .left-ribbon {
        display: none; /* Скрываем левую ленту на мобильных */
    }

    .text-card {
        width: 100%;
        aspect-ratio: auto;
        min-height: 200px;
        padding: 20px;
    }

    .text-card h4 {
        font-size: 1.3rem;
    }

    .text-card p {
        font-size: 1rem;
    }

    .main-container::after,
    .main-container::before {
        display: none; /* Убираем blur и background эффекты на мобильных */
    }
}