/* CSS Custom Properties for theming */
:root {
    --primary-color: #6366f1;
    --primary-hover: #5855eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.2s ease-in-out;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* App container */
.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 2rem;
}

.app-header h1 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Flashcard container */
.flashcard-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* Flashcard */
.flashcard {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    width: 100%;
    max-width: 600px;
    transition: all 0.3s ease-in-out;
    opacity: 1;
    transform: translateY(0);
}

.flashcard:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.flashcard.transitioning {
    opacity: 0;
    transform: translateY(-20px);
}

.image-container {
    width: 100%;
    height: 300px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flashcard-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.flashcard-content {
    padding: 2rem;
}

.flashcard-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.hint {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.95rem;
}

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.voice-btn, .skip-btn, .next-btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.voice-btn {
    background: var(--success-color);
    color: white;
    position: relative;
    overflow: hidden;
}

.voice-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

.voice-btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

/* Remove shimmer animation when breathing */
.voice-btn.breathing::before {
    display: none;
}

.skip-btn {
    background: var(--warning-color);
    color: white;
}

.skip-btn:hover {
    background: #d97706;
    transform: translateY(-1px);
}

.next-btn {
    background: var(--success-color);
    color: white;
}

.next-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

.mic-icon {
    font-size: 1.2rem;
}

/* Status */
.status {
    text-align: center;
    min-height: 2rem;
    transition: all 0.2s ease;
}

.status p {
    color: var(--text-secondary);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.status p.success {
    color: var(--success-color);
    font-weight: 500;
}

.status p.error {
    color: var(--danger-color);
    font-weight: 500;
}

/* Answer indicator replaces card prompt */
.flashcard-content.showing-answer.correct {
    animation: greenPulse 0.6s ease-out;
}

.flashcard-content.showing-answer.correct h2 {
    color: var(--success-color);
    font-weight: 600;
}

.flashcard-content.showing-answer.skip {
    animation: grayPulse 0.6s ease-out;
}

.flashcard-content.showing-answer.skip h2 {
    color: var(--text-primary);
    font-weight: 600;
}

/* Green pulse animation for correct answers */
@keyframes greenPulse {
    0% {
        background-color: transparent;
        transform: scale(1);
    }
    50% {
        background-color: rgba(16, 185, 129, 0.1);
        transform: scale(1.02);
    }
    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

/* Gray pulse animation for skips */
@keyframes grayPulse {
    0% {
        background-color: transparent;
        transform: scale(1);
    }
    50% {
        background-color: rgba(107, 114, 128, 0.1);
        transform: scale(1.02);
    }
    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

/* Doughnut wave effect */
.wave-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 600;
    overflow: hidden;
    /* Add circular boundary */
    clip-path: circle(50% at 50% 50%);
}

.wave-doughnut {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    /* Doughnut shape: transparent center, green ring, transparent outside */
    background: radial-gradient(circle, transparent 40%, rgba(16, 185, 129, 0.4) 45%, rgba(16, 185, 129, 0.3) 50%, rgba(16, 185, 129, 0.1) 60%, transparent 70%);
    transform: translate(-50%, -50%);
    animation: doughnutExpand var(--wave-duration) ease-out forwards;
}

@keyframes doughnutExpand {
    0% {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(var(--wave-scale));
        opacity: 0.8; /* Keep opacity constant, let boundary clip it */
    }
}

/* Voice indicator - moved to side */
.voice-indicator {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.listening-text {
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    backdrop-filter: blur(4px);
}

/* Gentle breathing animation for voice button */
.voice-btn.breathing {
    animation: gentleBreathing 3s ease-in-out infinite;
}

@keyframes gentleBreathing {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 8px 15px -3px rgba(0, 0, 0, 0.1);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }
    
    .app-header h1 {
        font-size: 2.5rem;
    }
    
    .flashcard-content {
        padding: 1.5rem;
    }
    
    .controls {
        flex-direction: column;
        width: 100%;
    }
    
    .voice-btn, .skip-btn {
        width: 100%;
        justify-content: center;
    }
    
    .image-container {
        height: 250px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}
