/* Medical Terminology Flashcards Styles */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #1e293b;
}

.app-container {
    max-width: 800px;
    width: 100%;
    text-align: center;
}

.app-header {
    margin-bottom: 40px;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #0ea5e9;
    margin-bottom: 8px;
}

.app-header p {
    font-size: 1.1rem;
    color: #64748b;
    font-weight: 400;
}

.flashcard-container {
    perspective: 1000px;
    margin-bottom: 30px;
}

.flashcard {
    width: 100%;
    max-width: 600px;
    height: 450px;
    margin: 0 auto;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    cursor: pointer;
}

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

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    background: white;
    box-shadow: 0 10px 25px rgba(14, 165, 233, 0.15), 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Hover effects removed to prevent interference with click behavior */
.flashcard-front:hover,
.flashcard-back:hover {
    box-shadow: 0 12px 30px rgba(14, 165, 233, 0.18), 0 5px 12px rgba(0, 0, 0, 0.12);
}

.flashcard-back {
    transform: rotateY(180deg);
    justify-content: flex-start;
    padding: 25px;
    overflow-y: auto;
}

.card-level {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.025em;
}

.term-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 40px 0 30px 0;
}

.medical-term {
    font-size: 2.5rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.speaker-btn {
    background: #0ea5e9;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.speaker-btn:hover {
    background: #0284c7;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

.speaker-btn:active {
    transform: scale(0.98);
}

.speaker-btn.playing {
    background: #059669;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.speaker-icon {
    font-size: 1.5rem;
    color: white;
}

.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.instruction-text {
    color: #64748b;
    font-size: 0.95rem;
    margin-top: auto;
    font-style: italic;
}

/* Back Side Styles */
.flashcard-back .card-level {
    position: relative;
    top: 0;
    transform: none;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.term-breakdown {
    width: 100%;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.term-breakdown h3,
.definition-section h3,
.context-section h3 {
    color: #0ea5e9;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: left;
}

.breakdown-parts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 12px;
    border-left: 4px solid #0ea5e9;
}

.part {
    background: #0ea5e9;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}

.meaning {
    color: #475569;
    font-size: 0.9rem;
    font-style: italic;
}

.plus {
    color: #0ea5e9;
    font-weight: bold;
    font-size: 1.2rem;
}

.definition-section,
.context-section {
    width: 100%;
    margin-bottom: 15px;
    text-align: left;
    flex-shrink: 0;
}

.definition,
.context {
    color: #334155;
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 12px;
    background: #f1f5f9;
    border-radius: 8px;
    border-left: 4px solid #0ea5e9;
}

.flashcard-back .instruction-text {
    margin-top: auto;
    text-align: center;
    flex-shrink: 0;
    padding-top: 10px;
}

.audio-status {
    min-height: 30px;
    color: #64748b;
    font-size: 0.9rem;
    padding: 10px;
    transition: all 0.3s ease;
}

.audio-status.loading {
    color: #0ea5e9;
    font-weight: 500;
}

.audio-status.ready {
    color: #059669;
    font-weight: 500;
}

.audio-status.playing {
    color: #0ea5e9;
    font-weight: 500;
}

.audio-status.complete {
    color: #059669;
    font-weight: 500;
}

.audio-status.error {
    color: #dc2626;
    font-weight: 500;
}

/* App loading state */
body:not(.app-loaded) {
    opacity: 0;
}

body.app-loaded {
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* Keyboard instructions */
.keyboard-instructions {
    z-index: 1000;
}

.keyboard-instructions ul {
    list-style: none;
    margin: 8px 0 0 0;
}

.keyboard-instructions li {
    margin: 4px 0;
    font-family: monospace;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .app-header h1 {
        font-size: 2rem;
    }
    
    .app-header p {
        font-size: 1rem;
    }
    
    .flashcard {
        height: 550px;
    }
    
    .flashcard-front,
    .flashcard-back {
        padding: 20px;
    }
    
    .flashcard-back {
        padding: 18px;
    }
    
    .medical-term {
        font-size: 2rem;
        text-align: center;
    }
    
    .term-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .speaker-btn {
        width: 50px;
        height: 50px;
    }
    
    .speaker-icon {
        font-size: 1.25rem;
    }
    
    .breakdown-parts {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .flashcard {
        height: 550px;
    }
    
    .medical-term {
        font-size: 1.75rem;
        word-break: break-word;
        hyphens: auto;
    }
    
    .flashcard-front,
    .flashcard-back {
        padding: 20px;
    }
    
    .card-level {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}