* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 2rem;
    font-weight: 600;
}

h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.import-export-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.import-export-buttons button {
    background-color: #7f8c8d;
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
}

.import-export-buttons button:hover {
    background-color: #95a5a6;
}

#importBtn {
    background-color: #27ae60;
}

#importBtn:hover {
    background-color: #2ecc71;
}

#exportBtn {
    background-color: #8e44ad;
}

#exportBtn:hover {
    background-color: #9b59b6;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #2980b9;
}

.hidden {
    display: none;
}

#cardForm {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

input, textarea {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

textarea {
    height: 100px;
    resize: vertical;
}

.card-container {
    perspective: 1000px;
    height: 300px;
    margin-bottom: 2rem;
}

.card {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

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

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

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.review-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.difficulty-btn {
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-btn[data-difficulty="1"] {
    background-color: #e74c3c;
}

.difficulty-btn[data-difficulty="2"] {
    background-color: #e67e22;
}

.difficulty-btn[data-difficulty="3"] {
    background-color: #2ecc71;
}

.difficulty-btn[data-difficulty="4"] {
    background-color: #3498db;
}

.difficulty-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

#nextReview {
    text-align: center;
    margin-top: 1rem;
    color: #666;
    font-size: 0.9rem;
}

#cardCount {
    font-size: 1rem;
    color: #666;
}

/* Gallery View Styles */
#galleryView {
    padding: 1rem;
}

.gallery-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1rem 0;
    color: #666;
    font-size: 0.9rem;
}

.gallery-filters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.filter-btn {
    background-color: #f0f0f0;
    color: #666;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.filter-btn:hover {
    background-color: #e0e0e0;
}

.filter-btn.active {
    background-color: #3498db;
    color: white;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 180px;
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.gallery-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #3498db;
    opacity: 0.8;
}

.gallery-card.due::before {
    background: #e74c3c;
}

.gallery-card.mastered::before {
    background: #2ecc71;
}

.gallery-card .card-content {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
}

.gallery-card .card-content p {
    margin: 0;
    font-size: 1.1rem;
    color: #2c3e50;
    line-height: 1.4;
}

.gallery-card .card-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    font-size: 0.85rem;
    color: #7f8c8d;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gallery-card .review-status {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    background: #f0f0f0;
}

.gallery-card .review-status.due {
    background: #fde8e8;
    color: #e74c3c;
}

.gallery-card .review-status.mastered {
    background: #e8f8f0;
    color: #2ecc71;
}

.gallery-card .review-count {
    color: #95a5a6;
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
        padding: 0.5rem;
    }

    .gallery-card {
        min-height: 150px;
    }
}

@media (max-width: 600px) {
    .container {
        margin: 1rem auto;
    }
    
    .buttons {
        flex-direction: column;
    }
    
    .card-container {
        height: 200px;
    }
}
