/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header styles */
.main-header {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.main-header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    font-weight: 300;
    opacity: 0.9;
}

/* Main content layout */
.flashcard-editor-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    flex: 1;
}

/* Flashcard display section */
.flashcard-display-section {
    flex: 1;
    min-width: 300px;
}

.flashcard-wrapper {
    width: 100%;
    height: 700px;
    perspective: 1500px;
    cursor: pointer;
    outline: none;
}

.flashcard-wrapper:focus {
    outline: 3px solid #667eea;
    outline-offset: 4px;
    border-radius: 16px;
}

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

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

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

.flashcard-front {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.flashcard-back {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transform: rotateY(180deg);
}

.card-content {
    padding: 3rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 2.5rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1.5rem;
}

.card-text {
    font-size: 1.3rem;
    color: #4a5568;
    margin-bottom: 2rem;
    flex-shrink: 0;
    line-height: 1.8;
}

.image-container {
    flex: 1;
    margin: 1.5rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card-image:hover {
    transform: scale(1.03);
}

.instruction {
    margin-top: auto;
    padding: 1.2rem;
    background: rgba(102, 126, 234, 0.15);
    border-radius: 10px;
    font-size: 1rem;
    color: #4a5568;
}

.key-hint {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: #667eea;
    color: white;
    border-radius: 6px;
    font-weight: 600;
    margin-right: 0.5rem;
    font-size: 1rem;
}

/* Editor panel */
.editor-panel {
    flex: 1;
    min-width: 300px;
    max-width: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.editor-section {
    padding: 2rem;
}

.editor-title {
    font-size: 2rem;
    color: #2d3748;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.editor-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.editor-tab {
    padding: 0.8rem 1.5rem;
    background: #f7fafc;
    border: none;
    border-radius: 8px 8px 0 0;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
}

.editor-tab:hover {
    background: #edf2f7;
}

.editor-tab.active {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.editor-content {
    position: relative;
}

.editor-form {
    display: none;
    animation: fadeIn 0.3s ease;
}

.editor-form.active {
    display: block;
}

.editor-form h3 {
    font-size: 1.5rem;
    color: #2d3748;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

/* Form elements */
.form-group {
    margin-bottom: 1.8rem;
}

.form-group label {
    display: block;
    font-size: 1.1rem;
    color: #4a5568;
    margin-bottom: 0.8rem;
    font-weight: 500;
}

.editor-input {
    width: 100%;
    padding: 1rem 1.2rem;
    font-size: 1.1rem;
    font-family: 'Poppins', sans-serif;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    transition: all 0.3s ease;
    color: #2d3748;
}

.editor-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.editor-textarea {
    width: 100%;
    padding: 1.2rem;
    font-size: 1.1rem;
    font-family: 'Poppins', sans-serif;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    transition: all 0.3s ease;
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
    color: #2d3748;
}

.editor-textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #718096;
}

.apply-button {
    width: 100%;
    padding: 1.2rem;
    font-size: 1.2rem;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    font-family: 'Poppins', sans-serif;
}

.apply-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.apply-button:active {
    transform: translateY(0);
}

/* Save section */
.save-section {
    padding: 2rem;
    border-top: 2px solid #e2e8f0;
}

.save-section h3 {
    font-size: 1.5rem;
    color: #2d3748;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.save-buttons {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
}

.save-button {
    flex: 1;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

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

.save-button.secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.save-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.file-input-container {
    margin: 1.5rem 0;
}

.file-input-label {
    display: block;
    font-size: 1rem;
    color: #4a5568;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.file-input {
    width: 100%;
    padding: 0.8rem;
    font-family: 'Poppins', sans-serif;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.save-status {
    padding: 1rem;
    border-radius: 10px;
    margin-top: 1rem;
    font-size: 0.95rem;
    min-height: 20px;
}

/* Controls info */
.controls-info {
    padding: 2rem;
    background: #f8fafc;
    border-top: 2px solid #e2e8f0;
}

.control-item {
    margin-bottom: 2rem;
}

.control-item:last-child {
    margin-bottom: 0;
}

.control-item h3 {
    font-size: 1.3rem;
    color: #2d3748;
    margin-bottom: 1rem;
    font-weight: 600;
}

.instructions-list {
    list-style: none;
    padding-left: 0;
}

.instructions-list li {
    padding: 0.6rem 0;
    color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
    font-size: 1rem;
}

.instructions-list li:last-child {
    border-bottom: none;
}

kbd {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
    background: #edf2f7;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    box-shadow: 0 2px 0 #cbd5e0;
}

/* Footer */
.main-footer {
    text-align: center;
    padding: 1.5rem;
    background: #2d3748;
    color: white;
    margin-top: auto;
}

.main-footer a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s ease;
}

.main-footer a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.footer-note {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* Responsive design */
@media (min-width: 1200px) {
    .flashcard-editor-container {
        flex-wrap: nowrap;
    }
    
    .flashcard-display-section {
        flex: 2;
    }
    
    .editor-panel {
        flex: 1;
    }
}

@media (max-width: 1199px) {
    .flashcard-editor-container {
        flex-direction: column;
        align-items: center;
    }
    
    .flashcard-wrapper {
        max-width: 900px;
        height: 600px;
    }
    
    .editor-panel {
        max-width: 900px;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .flashcard-wrapper {
        height: 500px;
    }
    
    .card-content {
        padding: 2rem;
    }
    
    .card-title {
        font-size: 2rem;
    }
    
    .card-text {
        font-size: 1.1rem;
    }
    
    .editor-section, .save-section, .controls-info {
        padding: 1.5rem;
    }
    
    .editor-title {
        font-size: 1.8rem;
    }
    
    .save-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .flashcard-wrapper {
        height: 450px;
    }
    
    .card-content {
        padding: 1.5rem;
    }
    
    .card-title {
        font-size: 1.8rem;
    }
    
    .editor-tabs {
        flex-direction: column;
    }
    
    .editor-tab {
        width: 100%;
        text-align: center;
    }
}

/* Animations */
@keyframes flip {
    0% {
        transform: rotateY(0);
    }
    100% {
        transform: rotateY(180deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flashcard-wrapper.flipped .flashcard-inner {
    animation: flip 0.8s forwards;
}