/* Base Styles */
:root {
    --primary-color: #4285f4;
    --secondary-color: #34a853;
    --accent-color: #ea4335;
    --light-color: #f8f9fa;
    --dark-color: #202124;
    --correct-color: #34a853;
    --incorrect-color: #ea4335;
    --card-width: 350px;
    --card-height: auto;
    --min-card-height: 480px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--light-color);
    color: var(--dark-color);
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    margin: 0;
    font-size: 1.8rem;
}

.subtitle {
    font-weight: 300;
    font-size: 1.2rem;
}

.controls {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.exam-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.filter-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.filter-btn.active {
    background-color: white;
    color: var(--primary-color);
    font-weight: bold;
}

/* Main Content Styles */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* Stats Container */
.stats-container {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 1.5rem;
    background-color: white;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem;
}

.stat i {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat span {
    font-size: 1.5rem;
    font-weight: bold;
}

.stat label {
    font-size: 0.8rem;
    color: #666;
}

/* Card Styles */
.card-container {
    perspective: 1000px;
    width: var(--card-width);
    min-height: var(--min-card-height);
    height: var(--card-height);
    margin: 0 auto;
}

.card {
    width: 100%;
    height: 100%;
    min-height: var(--min-card-height);
    position: relative;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-radius: 15px;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    min-height: var(--min-card-height);
    -webkit-backface-visibility: hidden; /* Safari */
    backface-visibility: hidden;
    border-radius: 15px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: white;
    overflow-y: auto;
}

.card-front {
    transform: rotateY(0deg);
}

.card-back {
    transform: rotateY(180deg);
    background-color: #f8f9fa;
}

.word {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    text-align: center;
}

.exam-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.exam-tag {
    background-color: var(--primary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: auto;
    width: 100%;
}

.option-btn {
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 0.9rem;
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    line-height: 1.4;
    word-wrap: break-word;
    height: auto;
}

.option-btn:hover {
    border-color: var(--primary-color);
    background-color: #f0f7ff;
}

.option-btn.correct {
    border-color: var(--correct-color);
    background-color: rgba(52, 168, 83, 0.1);
}

.option-btn.incorrect {
    border-color: var(--incorrect-color);
    background-color: rgba(234, 67, 53, 0.1);
}

.definition {
    font-size: 1.1rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    text-align: center;
}

.example-container {
    background-color: #f0f7ff;
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    margin: 1rem 0;
}

.example-container {
    margin: 1rem 0;
    padding: 0.5rem;
    border-left: 3px solid var(--primary-color);
    background-color: rgba(59, 130, 246, 0.05);
}

.example {
    font-style: italic;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    color: #333;
}

.attribution {
    font-size: 0.85rem;
    text-align: right;
    color: #666;
    font-style: normal;
    margin-top: 0.5rem;
    font-weight: 500;
}

.pronunciation-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: auto;
    width: 100%;
}

.pronunciation-btn:hover {
    background-color: #3b78e7;
}

/* Feedback and Action Buttons */
.feedback-container {
    margin: 1rem 0;
    min-height: 2rem;
}

.feedback {
    font-weight: bold;
    transition: all 0.3s ease;
}

.feedback.correct {
    color: var(--correct-color);
}

.feedback.incorrect {
    color: var(--incorrect-color);
}

.feedback.warning {
    color: #f39c12;
}

.pronunciation-help {
    padding: 0.5rem;
    border-radius: 4px;
    background-color: rgba(243, 156, 18, 0.1);
    margin-top: 0.5rem;
    line-height: 1.4;
}

.action-buttons {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.primary-btn:hover {
    background-color: #3b78e7;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.primary-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Footer Styles */
footer {
    padding: 0;
    background-color: white;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.05);
    margin-top: auto;
    display: flex;
    flex-direction: column;
}

.progress-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    padding: 1rem 1rem 0.5rem;
}

.progress-bar {
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

#progress-text {
    font-size: 0.9rem;
    color: #666;
}

.footer-info {
    width: 100%;
    margin: 1rem auto 0;
    text-align: center;
    border-top: 1px solid #eaeaea;
    padding-top: 1rem;
    padding-bottom: 0.5rem;
    background-color: white;
}

.pwa-install-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.pwa-install-info {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    flex-wrap: wrap;
}

.install-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.install-btn:hover {
    background-color: var(--secondary-color);
}

.install-btn.hidden {
    display: none;
}

.attribution {
    font-size: 0.8rem;
    color: #888;
    padding: 0 1rem;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.attribution a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.attribution a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    padding: 1rem;
    z-index: 1000;
    transform: translateX(120%);
    transition: transform 0.5s ease;
    max-width: 300px;
}

.achievement-popup.show {
    transform: translateX(0);
}

.achievement-popup.hidden {
    display: none;
}

.achievement-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.achievement-icon {
    font-size: 2rem;
    color: gold;
    margin-bottom: 0.5rem;
}

/* Responsive Design */
@media (max-width: 600px) {
    :root {
        --card-width: 280px;
        --card-height: 380px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .stats-container {
        padding: 0.5rem;
    }
    
    .stat i {
        font-size: 1.2rem;
    }
    
    .stat span {
        font-size: 1.2rem;
    }
    
    .word {
        font-size: 1.8rem;
    }
    
    .option-btn {
        padding: 0.7rem;
    }
}