/* Learn Page Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f1419 0%, #1a1f2e 100%);
    color: #e0e6ed;
    min-height: 100vh;
    padding-bottom: 40px;
}

.learn-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.learn-header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.1) 0%, rgba(122, 81, 178, 0.1) 100%);
    border-radius: 16px;
    border: 1px solid rgba(88, 166, 255, 0.2);
    margin-bottom: 40px;
}

.header-content h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #58a6ff 0%, #7a51b2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-content p {
    font-size: 1.1rem;
    color: #8b949e;
}

/* Controls Section */
.controls-section {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 20px;
    margin-bottom: 40px;
    align-items: end;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    background: rgba(30, 36, 48, 0.8);
    border: 2px solid rgba(88, 166, 255, 0.3);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 45px;
    background: transparent;
    border: none;
    color: #e0e6ed;
    font-size: 1rem;
    outline: none;
}

.search-input::placeholder {
    color: #6e7681;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #6e7681;
    pointer-events: none;
}

.filter-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-section label {
    font-size: 0.95rem;
    color: #8b949e;
    white-space: nowrap;
}

.category-filter {
    background: rgba(30, 36, 48, 0.8);
    border: 2px solid rgba(88, 166, 255, 0.3);
    color: #e0e6ed;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.category-filter:hover {
    border-color: #58a6ff;
}

.category-filter:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.category-filter option {
    background: #1a1f2e;
    color: #e0e6ed;
}

.stats {
    text-align: right;
    padding: 12px 16px;
    background: rgba(30, 36, 48, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(88, 166, 255, 0.2);
}

.term-count {
    font-size: 0.95rem;
    color: #58a6ff;
    font-weight: 500;
}

/* Cards Grid */
.cards-section {
    margin-bottom: 60px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Flip Card */
.flip-card {
    perspective: 1000px;
    cursor: pointer;
    height: 380px;
    position: relative;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.flip-card-front {
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.15) 0%, rgba(122, 81, 178, 0.15) 100%);
    border: 2px solid rgba(88, 166, 255, 0.3);
    transform: rotateY(0deg);
}

.flip-card-front:hover {
    border-color: #58a6ff;
    box-shadow: 0 8px 24px rgba(88, 166, 255, 0.15);
}

.flip-card-back {
    background: linear-gradient(135deg, rgba(122, 81, 178, 0.2) 0%, rgba(88, 166, 255, 0.15) 100%);
    border: 2px solid rgba(122, 81, 178, 0.4);
    transform: rotateY(180deg);
    overflow-y: auto;
}

.flip-card-back::-webkit-scrollbar {
    width: 6px;
}

.flip-card-back::-webkit-scrollbar-track {
    background: transparent;
}

.flip-card-back::-webkit-scrollbar-thumb {
    background: rgba(88, 166, 255, 0.3);
    border-radius: 3px;
}

.flip-card-back::-webkit-scrollbar-thumb:hover {
    background: rgba(88, 166, 255, 0.5);
}

/* Card Front Content */
.card-front-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.card-category {
    display: inline-block;
    background: rgba(88, 166, 255, 0.2);
    color: #58a6ff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    margin-bottom: 12px;
}

.card-term {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e0e6ed;
    line-height: 1.3;
    word-break: break-word;
}

.card-flip-hint {
    color: #6e7681;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 12px;
    font-style: italic;
}

/* Card Back Content */
.card-back-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.definition-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.definition-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #58a6ff;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.definition-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #c9d1d9;
}

.example-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(88, 166, 255, 0.2);
}

.example-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #7a51b2;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.example-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #8b949e;
    font-style: italic;
    background: rgba(30, 36, 48, 0.5);
    padding: 10px 12px;
    border-radius: 6px;
    border-left: 3px solid #7a51b2;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.empty-state.hidden {
    display: none;
}

.empty-icon {
    width: 120px;
    height: 120px;
    color: rgba(88, 166, 255, 0.3);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: #8b949e;
    margin-top: 20px;
}

.empty-state p {
    color: #6e7681;
    font-size: 1rem;
}

/* Legend Section */
.legend-section {
    background: rgba(30, 36, 48, 0.8);
    border: 2px solid rgba(88, 166, 255, 0.2);
    border-radius: 12px;
    padding: 40px;
    margin-top: 60px;
}

.legend-section h3 {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: #e0e6ed;
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.legend-item {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.legend-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: rgba(88, 166, 255, 0.1);
    border-radius: 8px;
}

.legend-item p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #c9d1d9;
}

.legend-item strong {
    color: #58a6ff;
}

/* Responsive Design */
@media (max-width: 768px) {
    .learn-header {
        padding: 30px 15px;
    }

    .header-content h1 {
        font-size: 2rem;
    }

    .controls-section {
        grid-template-columns: 1fr;
    }

    .filter-section {
        width: 100%;
    }

    .category-filter {
        width: 100%;
    }

    .stats {
        text-align: left;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .flip-card {
        height: 350px;
    }

    .flip-card-front,
    .flip-card-back {
        padding: 20px;
    }

    .card-term {
        font-size: 1.3rem;
    }

    .legend-items {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .legend-section {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .learn-container {
        padding: 10px;
    }

    .header-content h1 {
        font-size: 1.5rem;
    }

    .header-content p {
        font-size: 0.95rem;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .flip-card {
        height: 320px;
    }

    .flip-card-front,
    .flip-card-back {
        padding: 16px;
    }

    .card-term {
        font-size: 1.1rem;
    }

    .definition-text,
    .example-text {
        font-size: 0.85rem;
    }
}

/* Smooth Transitions */
.flip-card-front,
.flip-card-back,
.search-box,
.category-filter,
.cards-grid {
    transition: all 0.3s ease;
}

/* Loading Animation */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.loading {
    background: linear-gradient(90deg, rgba(88, 166, 255, 0.1) 25%, rgba(122, 81, 178, 0.1) 50%, rgba(88, 166, 255, 0.1) 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}