/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* 制作区域样式 */
.creation-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.creation-section h2 {
    margin-bottom: 20px;
    color: #4a5568;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2d3748;
}

.form-group textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.3s;
}

.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group select, 
.form-group input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 1rem;
}

.form-group input[type="text"] {
    margin-top: 8px;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

button:active {
    transform: translateY(0);
}

/* 浏览区域样式 */
.browse-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    color: #4a5568;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.controls select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 1rem;
}

.controls button {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* 闪卡列表样式 */
.flashcard-container {
    margin-top: 20px;
}

.flashcard-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

@media (max-width: 768px) {
    .flashcard-list {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

.flashcard {
    height: 200px;
    perspective: 1000px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner,
.flashcard-inner.flipped {
    transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.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-content {
    font-size: 1.2rem;
    text-align: center;
    word-break: break-word;
    overflow-wrap: break-word;
    max-height: 100%;
    overflow-y: auto;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.card-actions button {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.edit-btn {
    background: #4caf50;
}

.delete-btn {
    background: #f44336;
}

/* 空状态样式 */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #718096;
}

.empty-state p {
    font-size: 1.2rem;
}

/* 学习模式样式 */
.study-mode {
    text-align: center;
}

.study-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.study-header h3 {
    color: #4a5568;
    font-size: 1.5rem;
}

.study-card {
    height: 300px;
    max-width: 500px;
    margin: 0 auto;
    perspective: 1000px;
}

.study-controls {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.study-controls button {
    padding: 12px 24px;
}

#flip-card {
    background: #ff9800;
}

#next-card {
    background: #4caf50;
}

#prev-card {
    background: #2196f3;
}

#exit-study-mode {
    background: #f44336;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .creation-section, .browse-section {
        padding: 20px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls {
        justify-content: center;
    }
    
    .study-card {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .form-group textarea {
        min-height: 80px;
    }
    
    .flashcard-list {
        grid-template-columns: 1fr;
    }
    
    .study-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .study-controls button {
        width: 80%;
    }
}