/* ========== СТИЛИ ДЛЯ ВЫБОРА ПРЕДМЕТОВ ========== */

/* Скрываем чат на экране выбора предметов */
#subjectSelectScreen.active ~ .chat-container,
#subjectSelectScreen.active ~ .chat-header,
#subjectSelectScreen.active ~ .app-message {
    display: none !important;
}

/* Сам экран выбора предметов */
.subject-selection {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #f0f2f5 0%, #e6e9f0 100%);
    animation: fadeIn 0.5s ease;
    overflow: hidden !important;
    position: relative;
    padding: 0 !important;
    margin: 0 !important;
}

/* ========== ГРАДИЕНТНАЯ ПОЛОСКА STUDYHELPER ========== */

.gradient-header-strip {
    background: linear-gradient(135deg,
    #667eea 0%,
    #764ba2 30%,
    #9f7aea 70%,
    #805ad5 100%);
    background-size: 400% 400%;
    animation: gradientFlow 8s ease infinite;
    color: white;
    padding: 25px 20px 30px;
    border-radius: 0 0 25px 25px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: visible;
    z-index: 10;
    width: 100%;
    flex-shrink: 0;
    box-sizing: border-box;
}

.gradient-header-strip::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 100%);
    animation: shine 3s infinite;
    pointer-events: none;
}

.gradient-header-content {
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.gradient-header-text {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.gradient-header-subtitle {
    font-size: 15px;
    font-weight: 400;
    opacity: 0.9;
    letter-spacing: 0.3px;
}

.gradient-header-wave {
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 15px;
    background: white;
    border-radius: 50% 50% 0 0;
}

/* Контейнер с скроллом для предметов */
.subject-grid-container {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 20px 20px 30px;
    width: 100%;
    box-sizing: border-box;
    min-height: 0; /* Важно для flex-контейнера */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE и Edge */
}

.subject-grid-container::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Сетка предметов */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Кнопки предметов */
.subject-btn {
    background: white;
    border: none;
    border-radius: 20px;
    padding: 25px 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 160px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    transform-origin: center;
    z-index: 2;
    border: none;
    outline: none;
}

.subject-btn:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.subject-btn:active {
    transform: translateY(-4px) scale(1.01);
}

.subject-emoji {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
    transition: transform 0.3s ease;
    transform-origin: center;
}

.subject-btn:hover .subject-emoji {
    transform: scale(1.1) rotate(5deg);
}

.subject-name {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 6px;
    transition: color 0.3s ease;
}

.subject-desc {
    font-size: 13px;
    color: #666;
    opacity: 0.8;
    font-weight: 400;
    transition: opacity 0.3s ease;
}

.subject-btn:hover .subject-desc {
    opacity: 1;
}

.math-subject {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.math-subject .subject-name {
    color: white;
}

.math-subject .subject-desc {
    color: rgba(255, 255, 255, 0.9);
}

.chemistry-subject {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.chemistry-subject .subject-name {
    color: white;
}

.chemistry-subject .subject-desc {
    color: rgba(255, 255, 255, 0.9);
}

.physics-subject {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.physics-subject .subject-name {
    color: white;
}

.physics-subject .subject-desc {
    color: rgba(255, 255, 255, 0.9);
}

.social-subject {
    background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%);
    color: white;
}

.social-subject .subject-name {
    color: white;
}

.social-subject .subject-desc {
    color: rgba(255, 255, 255, 0.9);
}

/* НОВЫЙ ПРЕДМЕТ - Информатика */
.computer-science-subject {
    background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
    color: white;
}

.computer-science-subject .subject-name {
    color: white;
}

.computer-science-subject .subject-desc {
    color: rgba(255, 255, 255, 0.9);
}

@keyframes subjectAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.subject-btn {
    animation: subjectAppear 0.5s ease-out;
}

.subject-btn:nth-child(1) { animation-delay: 0.1s; }
.subject-btn:nth-child(2) { animation-delay: 0.2s; }
.subject-btn:nth-child(3) { animation-delay: 0.3s; }
.subject-btn:nth-child(4) { animation-delay: 0.4s; }
.subject-btn:nth-child(5) { animation-delay: 0.5s; }

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes shine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ========== АДАПТИВНОСТЬ ========== */

@media (max-width: 500px) {
    .gradient-header-strip {
        padding: 22px 15px 27px;
        border-radius: 0 0 20px 20px;
    }

    .gradient-header-text {
        font-size: 24px;
    }

    .gradient-header-subtitle {
        font-size: 14px;
    }

    .subject-grid-container {
        padding: 15px 15px 25px;
    }

    .subject-grid {
        grid-template-columns: 1fr;
        max-width: 300px;
        gap: 15px;
    }

    .subject-btn {
        min-height: 140px;
        padding: 20px 15px;
        border-radius: 18px;
    }

    .subject-emoji {
        font-size: 42px;
    }

    .subject-name {
        font-size: 16px;
    }

    .subject-desc {
        font-size: 12px;
    }
}

@media (max-height: 700px) {
    .gradient-header-strip {
        padding: 20px 15px 25px;
    }

    .gradient-header-text {
        font-size: 22px;
    }

    .gradient-header-subtitle {
        font-size: 13px;
    }

    .subject-grid-container {
        padding: 15px 15px 20px;
    }

    .subject-btn {
        min-height: 130px;
        padding: 18px 12px;
    }

    .subject-emoji {
        font-size: 38px;
        margin-bottom: 8px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .subject-grid-container {
        padding: 10px 15px 15px;
    }

    .subject-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 350px;
        gap: 15px;
    }

    .subject-btn {
        min-height: 110px;
        padding: 12px 8px;
    }
}

.subject-btn[style*="opacity: 0.7"] {
    position: relative;
}

.subject-btn[style*="opacity: 0.7"]::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    pointer-events: none;
}

.subject-btn,
.subject-emoji,
.subject-name,
.subject-desc {
    will-change: transform, opacity;
    backface-visibility: hidden;
}