* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
}

h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #3498db, #2c3e50);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.subtitle {
    font-size: 1.2rem;
    color: #7f8c8d;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.upload-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
    text-align: center;
}

.upload-area {
    border: 3px dashed #3498db;
    border-radius: 10px;
    padding: 40px 20px;
    margin: 20px 0;
    cursor: pointer;
    transition: all 0.3s;
    background-color: #f8f9fa;
}

.upload-area:hover {
    background-color: #e3f2fd;
    border-color: #2980b9;
}

.upload-icon {
    font-size: 48px;
    color: #3498db;
    margin-bottom: 15px;
}

.file-input {
    display: none;
}

.file-info {
    margin: 15px 0;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.generate-btn {
    background: linear-gradient(135deg, #3498db, #2c3e50);
    color: white;
    border: none;
    padding: 14px 28px;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    margin-top: 10px;
}

.generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(52, 152, 219, 0.4);
}

.generate-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.loading {
    display: none;
    text-align: center;
    margin: 20px 0;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #3498db;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.cards-section {
    display: none;
    margin-top: 30px;
}

.section-title {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.card {
    height: 200px;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    border-radius: 12px;
}

.card-front {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.card-back {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    transform: rotateY(180deg);
}

.card-number {
    position: absolute;
    top: 10px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.card-content {
    font-size: 1.1rem;
    line-height: 1.5;
    max-height: 80%;
    overflow: auto;
}

.card-hint {
    position: absolute;
    bottom: 10px;
    font-size: 0.8rem;
    opacity: 0.8;
}

.pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    gap: 10px;
}

.page-btn {
    background: #3498db;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

.page-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.current-page {
    display: flex;
    align-items: center;
    font-weight: 600;
}

.status-message {
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    display: none;
}

.success {
    background-color: #d4edda;
    color: #155724;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
}

@media (max-width: 768px) {
    .cards-container {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .cards-container {
        grid-template-columns: 1fr;
    }

    .upload-section {
        padding: 20px;
    }
}