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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.hidden {
    display: none !important;
}

.card-form {
    margin-bottom: 40px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-study {
    background: #28a745;
    color: white;
    font-size: 1.2rem;
    padding: 16px 32px;
    width: 100%;
}

.btn-study:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-study:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-nav {
    background: #667eea;
    color: white;
    min-width: 140px;
}

.btn-nav:hover:not(:disabled) {
    background: #5568d3;
}

.btn-nav:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.deck-list {
    margin-bottom: 30px;
}

.deck-list h2 {
    color: #333;
    margin-bottom: 20px;
}

.card-list-container {
    max-height: 400px;
    overflow-y: auto;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
}

.card-item {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.card-text {
    flex: 1;
}

.card-text strong {
    display: block;
    color: #667eea;
    margin-bottom: 5px;
}

.card-text p {
    color: #555;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.btn-delete {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.btn-delete:hover {
    background: #c82333;
}

.study-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.study-header h2 {
    color: #333;
}

.study-progress {
    text-align: center;
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 30px;
    font-weight: 600;
}

.flashcard-container {
    perspective: 1000px;
    margin-bottom: 30px;
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flashcard {
    width: 100%;
    max-width: 600px;
    height: 350px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

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

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.flashcard-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.flashcard-back {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    transform: rotateY(180deg);
}

.card-label {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.8;
    text-transform: uppercase;
}

.card-content {
    font-size: 1.5rem;
    text-align: center;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 100%;
    overflow-y: auto;
}

.flip-hint {
    position: absolute;
    bottom: 20px;
    font-size: 0.9rem;
    opacity: 0.7;
}

.study-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.empty-message {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.2rem;
}

.empty-deck-msg {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .section {
        padding: 20px;
    }
    
    .flashcard {
        height: 300px;
    }
    
    .card-content {
        font-size: 1.2rem;
    }
    
    .study-controls {
        flex-direction: column;
    }
    
    .btn-nav {
        width: 100%;
    }
}
