/* assets/css/flashcard/tovch.css */

/* Товчлуурын бүлгийн загвар */
.btn-toolbar {
    display: flex;
    border-top: 1px solid rgba(233, 236, 239, 0.5);
    margin: 0 !important;
    padding: 0;
    background: linear-gradient(to right, #1e293b, #334155);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 10;
    border-radius: 0 0 0px 0px;
    overflow: hidden;
    margin-bottom: 0px !important; /* Товчлуур доод талаас зай нэмэх */
}

.btn-toolbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.btn-group {
    display: flex;
    flex-wrap: nowrap; /* Чухал өөрчлөлт - wrap-ыг nowrap болгож товчлуурыг нэг мөрөнд байлгах */
    width: 100%;
    margin: 0 !important;
    padding: 0 5px; /* Дутуу зай зай авах */
    overflow-x: auto; /* Гар утсанд харагдахгүй бол гүйлгүүр гаргах */
    scrollbar-width: none; /* Firefox дээр гүйлгүүрийг нуух */
    -ms-overflow-style: none; /* IE and Edge дээр гүйлгүүрийг нуух */
}

/* Гүйлгүүрийг нуух (Chrome, Safari) */
.btn-group::-webkit-scrollbar {
    display: none;
}

/* Үндсэн товчлуурууд */
.btn-outline-secondary {
    flex: none; /* Өөрчлөлт: flex: 1-ээс flex: none болгож товчлуур бүрийг өөрийн хэмжээтэй болгох */
    border: none !important;
    border-radius: 0 !important;
    padding: 22px 10px !important; /* Нэмэлт: 0px-ыг 10px болгож хэт нарийн болохоос сэргийлэх */
    color: #f8fafc !important;
    background-color: transparent !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    margin: 0 1px !important; /* Нэмэлт: товчлуурууд хоорондын зай багасгах */
    position: relative;
    overflow: hidden;
    min-width: 70px; /* Өөрчлөлт: 100px-ээс 70px болгож гар утсанд багтаах */
    white-space: nowrap; /* Нэмэлт: текст шинэ мөрөнд шилжихгүй */
}

.btn-outline-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: transparent;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.btn-outline-secondary::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #818cf8, transparent);
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    transform: translateX(-50%);
}

.btn-outline-secondary:hover {
    background: linear-gradient(to bottom, rgba(129, 140, 248, 0.15), rgba(0, 0, 0, 0)) !important;
    color: white !important;
    transform: translateY(-2px);
}

.btn-outline-secondary:hover::before {
    background-color: #818cf8;
}

.btn-outline-secondary:hover::after {
    width: 80%;
}

.btn-outline-secondary:active {
    transform: translateY(1px);
}

/* Товчууд дээрх иконууд */
.btn-outline-secondary i {
    color: #f1f5f9;
    font-size: 26px;
    margin-bottom: 10px;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.btn-outline-secondary:hover i {
    color: #818cf8;
    transform: translateY(-3px) scale(1.15);
    filter: drop-shadow(0 4px 6px rgba(129, 140, 248, 0.5));
}

/* Идэвхтэй товчлуурын загвар */
.btn-outline-secondary.active {
    background: linear-gradient(to bottom, rgba(129, 140, 248, 0.2), rgba(99, 102, 241, 0.1)) !important;
    color: white !important;
}

.btn-outline-secondary.active::before {
    background-color: #818cf8;
}

.btn-outline-secondary.active::after {
    width: 80%;
    background: linear-gradient(90deg, transparent, #818cf8, transparent);
}

.btn-outline-secondary.active i {
    color: #818cf8;
    transform: translateY(-2px);
}

/* Видео товчлуур - Онцгой дизайн */
.toggle-content[data-target*="videos"], 
button[data-target*="videos"] {
 
    color: white !important;
    padding: 22px 10px !important; /* Нэмэлт: 0px-ыг 10px болгож хэт нарийн болохоос сэргийлэх */
    border: none;
    font-size: 16px;

    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
    box-shadow: inset 0 0px 0px rgba(255, 255, 255, 0.3);
    flex: none; /* Өөрчлөлт: flex: 1-ээс flex: none болгох */
    min-width: 70px; /* Өөрчлөлт: 100px-ээс 70px болгох */
    white-space: nowrap; /* Нэмэлт: текст шинэ мөрөнд шилжихгүй */
}

.toggle-content[data-target*="videos"]::before,
button[data-target*="videos"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all 0.8s cubic-bezier(0.19, 1, 0.22, 1);
}

.toggle-content[data-target*="videos"]:hover::before,
button[data-target*="videos"]:hover::before {
    left: 100%;
}

.toggle-content[data-target*="videos"]:hover,
button[data-target*="videos"]:hover {
    background: linear-gradient(135deg, #4f46e5, #4338ca) !important;
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(79, 70, 229, 0.25);
}

.toggle-content[data-target*="videos"]:active,
button[data-target*="videos"]:active {
    transform: translateY(1px);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.2);
}

.toggle-content[data-target*="videos"] i,
button[data-target*="videos"] i {
    color: white;
    font-size: 26px;
    margin-bottom: 10px;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.toggle-content[data-target*="videos"]:hover i,
button[data-target*="videos"]:hover i {
    transform: scale(1.15);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

/* Агуулга хэсгүүд */
.content-section {
    margin: 15px 25px 28px; /* Дээд талаас 15px зай нэмсэн */
    padding: 0;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
    border: 1px solid rgba(233, 236, 239, 0.7);
    overflow: hidden;
    background-color: #ffffff;
    position: relative;
}

.content-section:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

/* Агуулга хэсгүүдийн гарчиг */
.content-section .card-header {
    background: linear-gradient(to right, #f1f5f9, #f8fafc) !important;
    padding: 20px 24px !important;
    font-weight: 700;
    color: #334155;
    border-left: 4px solid #818cf8;
    letter-spacing: 0.01em;
    position: relative;
    display: flex;
    align-items: center;
}

.content-section .card-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, #818cf8, transparent);
}

.content-section .card-header h5 {
    font-size: 18px;
    margin: 0;
    display: flex;
    align-items: center;
}

.content-section .card-header i {
    margin-right: 10px;
    color: #6366f1;
    font-size: 20px;
}

/* Агуулга хэсгүүдийн их бие */
.content-section .card-body {
    padding: 24px !important;
    color: #475569;
    font-size: 16px;
    line-height: 1.6;
}

/* Зурагтай хэсэг */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 12px;
}

.image-gallery img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.image-gallery img:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Сонсох хурдны тохиргооны хэсэг */
.speech-rate-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px !important;
    background: linear-gradient(to right, #f1f5f9, #f8fafc);
    padding: 16px 20px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.speech-rate-label {
    font-weight: 600;
    color: #475569;
    margin-right: 5px;
}

/* Хурд сонгох гүйлгүүр - Slider */
.speech-rate-slider {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.speech-rate-value {
    font-weight: 600;
    color: #6366f1;
    min-width: 55px;
    text-align: center;
    padding: 5px 8px;
    background-color: #f1f5f9;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

/* Гүйлгүүр товчлуур */
.speech-rate-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: linear-gradient(to right, #cbd5e1, #6366f1);
    outline: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Гүйлгүүр товчлуурын бөмбөлөг */
.speech-rate-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: #ffffff;
    border: 2px solid #6366f1;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
    transition: all 0.2s ease;
}

.speech-rate-range::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: #ffffff;
    border: 2px solid #6366f1;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
    transition: all 0.2s ease;
}

/* Гүйлгүүр товчлуурын бөмбөлөг hover */
.speech-rate-range::-webkit-slider-thumb:hover {
    background: #6366f1;
    transform: scale(1.1);
    box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.2);
}

.speech-rate-range::-moz-range-thumb:hover {
    background: #6366f1;
    transform: scale(1.1);
    box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.2);
}

/* Гүйлгүүр товчлуурын бөмбөлөг active */
.speech-rate-range:active::-webkit-slider-thumb {
    background: #4f46e5;
    transform: scale(1.2);
}

.speech-rate-range:active::-moz-range-thumb {
    background: #4f46e5;
    transform: scale(1.2);
}

/* Хурдыг хурдан өөрчлөх товчлуурууд */
.speech-rate-quick-btns {
    display: flex;
    gap: 8px;
}

.speech-rate-quick-btn {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #475569;
    font-weight: 500;
    min-width: 35px;
    text-align: center;
}

.speech-rate-quick-btn:hover {
    background: #f8fafc;
    border-color: #6366f1;
    color: #6366f1;
}

.speech-rate-quick-btn:active {
    background: #6366f1;
    color: white;
    transform: translateY(1px);
}

/* Дуу сонсох товч */
.speak-btn {
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #6366f1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.speak-btn:hover {
    background: #6366f1;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.2);
}

/* Жишээ хэсгийн загвар */
.chinese-example, .mongolian-example {
    background: #f8fafc;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 16px !important;
    border-left: 3px solid #6366f1;
}

.example-text {
    font-size: 17px;
    line-height: 1.7;
}

.chinese-example strong, .mongolian-example strong {
    color: #334155;
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}

/* Нэмэлт жишээнүүдийн загвар */
.example-item {
    background: #f8fafc;
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 20px !important;
    border-left: 3px solid #6366f1;
    transition: all 0.3s ease;
}

.example-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Орчуулга хэсгийн загвар */
.translation-text {
    font-size: 18px;
    line-height: 1.7;
    padding: 5px 0;
}

.translation-text strong {
    color: #334155;
    font-weight: 600;
}

/* Тайлбар хэсгийн загвар */
.explanation-text {
    font-size: 16px;
    line-height: 1.8;
    color: #475569;
    padding: 5px 0;
}

/* Pinyin хэсгийн загвар */
.pinyin-text {
    font-size: 18px;
    line-height: 1.8;
    color: #475569;
    background: #f8fafc;
    padding: 15px;
    border-radius: 10px;
    border-left: 3px solid #6366f1;
}

/* Навигаци хэсэг */
.flashcard-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(to right, #f8fafc, #f1f5f9);
    margin-bottom: 0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    position: relative;
}

/* Өмнөх/дараах товчууд */
#prevCardBtn, #nextCardBtn {
    background: none !important;
    border: none !important;
    font-size: 0 !important;
    color: #1f2937 !important;
    width: 58px;
    height: 58px;
    cursor: pointer !important;
    text-align: center;
    padding: 0 !important;
    min-width: 58px;
    min-height: 58px;
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    background: linear-gradient(135deg, #ffffff, #f8fafc) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#prevCardBtn::after, #nextCardBtn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    transform: scale(0.5);
}

#prevCardBtn:hover, #nextCardBtn:hover {
    background: linear-gradient(135deg, #ffffff, #f1f5f9) !important;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1), 0 3px 6px rgba(0, 0, 0, 0.05);
}

#prevCardBtn:hover::after, #nextCardBtn:hover::after {
    opacity: 1;
    transform: scale(1.5);
}

#prevCardBtn:active, #nextCardBtn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#prevCardBtn i, #nextCardBtn i {
    display: none !important;
}

#prevCardBtn::before {
    content: "❮";
    font-size: 30px;
    display: block;
    color: #6366f1;
    font-weight: bold;
    transition: all 0.3s ease;
}

#nextCardBtn::before {
    content: "❯";
    font-size: 30px;
    display: block;
    color: #6366f1;
    font-weight: bold;
    transition: all 0.3s ease;
}

#prevCardBtn:hover::before, #nextCardBtn:hover::before {
    transform: scale(1.2);
}

/* Зурагтай агуулга хэсэгт анимэйшн нэмэх */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.image-gallery img {
    animation: fadeIn 0.4s ease forwards;
}

/* Видео хэсгийн загвар */
.video-container {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.video-container iframe {
    display: block;
    width: 100%;
    border-radius: 12px;
    border: none;
}

/* Гар утас дээрх харагдац */
@media (max-width: 768px) {
    .btn-outline-secondary {
        padding: 15px 5px !important; /* Өөрчлөлт: товчлуурын padding багасгах */
        font-size: 12px; /* Өөрчлөлт: font хэмжээг багасгах */
        min-width: 60px; /* Өөрчлөлт: хамгийн бага өргөнийг багасгах */
    }
    
    .btn-outline-secondary i {
        font-size: 18px; /* Өөрчлөлт: иконы хэмжээг багасгах */
        margin-bottom: 5px; /* Өөрчлөлт: дээд зай багасгах */
    }
    
    .toggle-content[data-target*="videos"], 
    button[data-target*="videos"] {
        padding: 15px 5px !important; /* Өөрчлөлт: товчлуурын padding багасгах */
        font-size: 12px; /* Өөрчлөлт: font хэмжээг багасгах */
        min-width: 60px; /* Өөрчлөлт: хамгийн бага өргөнийг багасгах */
    }
    
    .toggle-content[data-target*="videos"] i,
    button[data-target*="videos"] i {
        font-size: 18px; /* Өөрчлөлт: иконы хэмжээг багасгах */
        margin-bottom: 5px; /* Өөрчлөлт: дээд зай багасгах */
    }
    
    .btn-group {
        padding: 0 2px; /* Өөрчлөлт: padding багасгах */
        justify-content: start; /* Өөрчлөлт: товчлуурууд зүүн талд эхлэх */
    }
    
    /* Хэт нарийн дэлгэцэнд текстийг нуух */
    @media (max-width: 480px) {
        .btn-outline-secondary span {
            font-size: 10px;
        }
    }
    
    @media (max-width: 400px) {
        .btn-outline-secondary span {
            display: none;
        }
        
        .btn-outline-secondary i {
            margin-bottom: 0;
        }
        
        .btn-outline-secondary {
            min-width: 40px;
            padding: 10px 5px !important;
        }
    }
    
    /* Гар утсан дээр хоёр мөр болсон үед хуудсыг хэвтээ гүйлгэх сануулга */
    .btn-toolbar::after {
        content: '';
        position: absolute;
        right: 10px;
        top: 50%;
        width: 15px;
        height: 15px;
        background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 70%);
        border-radius: 50%;
        transform: translateY(-50%);
        pointer-events: none;
        animation: pulse 1.5s infinite;
    }
    
    @keyframes pulse {
        0% { opacity: 0.3; }
        50% { opacity: 1; }
        100% { opacity: 0.3; }
    }
    
    .content-section {
        margin: 15px 15px 20px; /* Гар утсан дээр хажуугийн зайг багасгах */
    }
    
    .content-section .card-header {
        padding: 16px !important;
    }
    
    .content-section .card-body {
        padding: 16px !important;
    }
    
    .speech-rate-controls {
        padding: 12px 15px;
        gap: 10px;
    }
    
    .speech-rate-slider {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
    
    .speech-rate-value {
        width: 100%;
        margin-top: 5px;
    }
    
    .speech-rate-label {
        margin-right: 0;
        margin-bottom: 5px;
    }
    
    .speech-rate-quick-btns {
        display: flex;
        gap: 5px;
        width: 100%;
        justify-content: space-between;
    }
    
    .speech-rate-quick-btn {
        flex: 1;
    }
    
    .chinese-example, .mongolian-example {
        padding: 12px;
    }
    
    .example-text {
        font-size: 15px;
    }
    
    .translation-text, .explanation-text, .pinyin-text {
        font-size: 15px;
    }
}

/* Өргөн дэлгэцний тохиргоо */
@media (min-width: 769px) {
    .btn-outline-secondary span {
        display: block;
    }
    
    .content-section {
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }
}