/* Tinder-style swipeable cards for learning */
.swipe-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
}

.swipe-progress {
    margin-bottom: 15px;
    text-align: center;
}

.progress-bar {
    height: 6px;
    background-color: #eee;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-fill {
    height: 100%;
    background-color: #1a73e8;
    width: 0;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 14px;
    color: #666;
}

.cards-container {
    position: relative;
    flex: 1;
    width: 100%;
    perspective: 1000px;
}

.card {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background-color: #fff;
    transform-style: preserve-3d;
    transition: transform 0.6s, opacity 0.3s, transform 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    touch-action: pan-y; /* Enable vertical scrolling but disable horizontal to help swipe */
}

/* Card content structure */
.card-content {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 25px;
    box-sizing: border-box;
    flex: 1;
    position: relative;
    z-index: 1;
}

.question-section {
    padding-bottom: 15px;
    padding-left: 10px;
    padding-right: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.answer-section {
    padding-top: 5px;
    padding-left: 10px;
    padding-right: 10px;
}

/* Card swipe animations */
.card.swipe-left {
    transform: translateX(-150%) rotate(-15deg);
    opacity: 0;
}

.card.swipe-right {
    transform: translateX(150%) rotate(15deg);
    opacity: 0;
}

/* Card content styling */
.card h3 {
    margin-top: 0;
    color: #1a73e8;
    text-align: center;
    font-size: 1.5rem;
    padding: 0 10px;
    margin-bottom: 20px;
}

.card h4 {
    color: #333;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.explanation, .practical, .code-example, .simple {
    margin-bottom: 25px;
}

.explanation p, .practical p, .simple p {
    line-height: 1.6;
    font-size: 16px;
}

/* Controls */
.swipe-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 30px;
}

.swipe-btn {
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.swipe-btn:active {
    transform: scale(0.95);
}

.swipe-left {
    background-color: #f8f8f8;
}

.swipe-left svg {
    fill: #666;
}

.swipe-right {
    background-color: #1a73e8;
}

.swipe-right svg {
    fill: #fff;
}

.swipe-info {
    background-color: #fff;
}

.swipe-info svg {
    fill: #1a73e8;
}

/* Completion card */
.completion-card {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.restart-btn {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #1a73e8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.restart-btn:hover {
    background-color: #1557b0;
}

/* Card appear animation */
@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.card {
    animation: cardAppear 0.3s forwards;
}

/* Category headings in sidebar */
.category-heading {
    padding: 15px;
    font-size: 16px;
    font-weight: bold;
    color: #1a73e8;
    background-color: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    border-left: 3px solid #1a73e8;
    margin-top: 10px;
}

/* Mobile optimizations */
@media (max-width: 767px) {
    .swipe-container {
        height: calc(100vh - 150px);
        padding: 10px 15px;
        max-width: calc(100% - 30px);
    }
    
    .card-content {
        padding: 25px;
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch;
        max-height: 100%;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    
    .card {
        overflow: hidden;
        height: 100%;
        margin: 0 10px;
        display: flex;
        flex-direction: column;
        border-radius: 12px;
    }
    
    /* Improve card content readability on mobile */
    .explanation p, .practical p, .simple p {
        line-height: 1.7;
        font-size: 16px;
        margin-bottom: 18px;
        letter-spacing: 0.2px;
    }
    
    .code {
        margin: 12px 0;
        padding: 20px;
        border-radius: 8px;
        font-size: 15px;
        line-height: 1.6;
    }
    
    .swipe-controls {
        gap: 20px;
    }
    
    .swipe-btn {
        width: 50px;
        height: 50px;
    }
    
    .card h3 {
        font-size: 1.3rem;
    }
}

/* Error message */
.error-message {
    text-align: center;
    padding: 20px;
    color: #d32f2f;
    background-color: #ffebee;
    border-radius: 8px;
    margin: 20px auto;
    max-width: 400px;
}

/* Code blocks */
pre.code {
    background-color: #f1f3f4;
    padding: 18px;
    border-radius: 5px;
    overflow-x: auto;
    font-size: 14px;
    white-space: pre-wrap;
    line-height: 1.5;
    margin-top: 10px;
}

/* Dark mode for code blocks */
@media (prefers-color-scheme: dark) {
    pre.code {
        background-color: #282c34;
        color: #abb2bf;
    }
}
