/* Compliance Flashcards Game Styles */

/* Local variables extending the main theme */
:root {
    --color-surface: #ffffff;
    --color-primary-light: var(--color-accent-light);
    --color-primary-dark: var(--color-secondary);
}

/* Game Screens */
.game-screen {
    display: none;
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

.game-screen.active {
    display: block;
}

/* Mode Selection */
.game-header {
    text-align: center;
    margin-bottom: 3rem;
}

.game-header h1 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.game-intro {
    color: var(--color-text-light);
    font-size: 1.1rem;
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.mode-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.mode-icon {
    width: 64px;
    height: 64px;
    background: var(--color-primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: var(--color-primary);
}

.mode-card h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.mode-card p {
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin: 0;
}

/* Back Button */
.back-btn {
    background: none;
    border: none;
    color: var(--color-text-light);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 0;
    margin-bottom: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.2s;
}

.back-btn:hover {
    color: var(--color-primary);
}

/* Settings Screen */
.settings-content {
    max-width: 600px;
    margin: 0 auto;
}

.settings-content h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    margin-bottom: 2rem;
    text-align: center;
}

.settings-group {
    margin-bottom: 2rem;
}

.settings-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-light);
}

.industry-filters,
.direction-options,
.card-count-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn,
.direction-btn,
.count-btn {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover,
.direction-btn:hover,
.count-btn:hover {
    border-color: var(--color-primary);
}

.filter-btn.active,
.direction-btn.active,
.count-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.card-count-info {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.start-btn {
    width: 100%;
    padding: 1rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 1rem;
}

.start-btn:hover {
    background: var(--color-primary-dark);
}

/* Study Mode */
.study-header {
    margin-bottom: 2rem;
}

.study-header h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.study-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.industry-select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.study-list {
    display: grid;
    gap: 1rem;
}

.study-term {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.study-term:hover {
    border-color: var(--color-primary);
}

.study-term-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.study-term-acronym {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
}

.study-term-fullname {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.study-term-definition {
    color: var(--color-text-light);
    font-size: 0.9rem;
    line-height: 1.5;
    display: none;
}

.study-term.expanded .study-term-definition {
    display: block;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.study-term-industries {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.industry-tag {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.study-term-why {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--color-text);
    display: none;
}

.study-term.expanded .study-term-why {
    display: block;
}

/* Flashcard Mode */
.flashcard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.progress-info {
    text-align: right;
}

#card-progress {
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
}

.progress-bar {
    width: 200px;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-primary);
    transition: width 0.3s ease;
    width: 0%;
}

.flashcard-container {
    perspective: 1000px;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.flashcard {
    width: 100%;
    min-height: 350px;
    cursor: pointer;
    position: relative;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 350px;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}

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

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    min-height: 350px;
    backface-visibility: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease;
}

.flashcard:hover .flashcard-front,
.flashcard:hover .flashcard-back {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.flashcard.flipped .flashcard-front {
    box-shadow: none;
}

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

.card-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-light);
    margin-bottom: auto;
}

.card-term {
    font-family: var(--font-display);
    font-size: 3rem;
    text-align: center;
    margin: auto 0;
}

.card-hint {
    color: var(--color-text-light);
    font-size: 0.85rem;
    text-align: center;
    margin-top: auto;
}

.card-full-name {
    font-size: 1.5rem;
    color: var(--color-primary);
    margin: 0.5rem 0;
}

.card-definition {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    margin: 1rem 0;
    flex-grow: 1;
}

.card-meta {
    margin-top: auto;
}

.card-industries {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.card-why {
    font-size: 0.85rem;
    color: var(--color-text-light);
    line-height: 1.5;
}

.flashcard-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.action-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.action-btn.still-learning {
    background: #fef3c7;
    color: #92400e;
}

.action-btn.still-learning:hover {
    background: #fde68a;
}

.action-btn.got-it {
    background: #d1fae5;
    color: #065f46;
}

.action-btn.got-it:hover {
    background: #a7f3d0;
}

.action-btn.primary {
    background: var(--color-primary);
    color: white;
}

.action-btn.primary:hover {
    background: var(--color-primary-dark);
}

/* Timed Mode */
.timed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.timed-info {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.score-display {
    font-weight: 600;
    font-size: 1.1rem;
}

.timer-bar {
    width: 100%;
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.timer-fill {
    height: 100%;
    background: var(--color-primary);
    transition: width 0.1s linear;
    width: 100%;
}

.timer-fill.warning {
    background: #f59e0b;
}

.timer-fill.danger {
    background: #ef4444;
}

.timed-question {
    text-align: center;
    margin-bottom: 2rem;
}

.question-label {
    color: var(--color-text-light);
    margin-bottom: 1rem;
}

.question-term {
    font-family: var(--font-body, var(--font-family));
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
    color: var(--color-text);
}

.answer-options {
    display: grid;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.answer-option {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.answer-option:hover:not(:disabled) {
    border-color: var(--color-primary);
}

.answer-option.correct {
    background: #d1fae5;
    border-color: #10b981;
}

.answer-option.incorrect {
    background: #fee2e2;
    border-color: #ef4444;
}

.answer-option:disabled {
    cursor: default;
}

.timed-feedback {
    display: none;
    text-align: center;
    margin-top: 2rem;
}

.timed-feedback.show {
    display: block;
}

.feedback-text {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.feedback-text.correct {
    color: #059669;
}

.feedback-text.incorrect {
    color: #dc2626;
}

.next-btn {
    padding: 0.75rem 2rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.next-btn:hover {
    background: var(--color-primary-dark);
}

/* Results Screen */
.results-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.results-content h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    margin-bottom: 2rem;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.results-terms {
    text-align: left;
    margin-bottom: 2rem;
}

.results-terms h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

#review-list {
    list-style: none;
    padding: 0;
}

#review-list li {
    padding: 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

#review-list li strong {
    color: var(--color-primary);
}

.results-terms:empty,
.results-terms:has(#review-list:empty) {
    display: none;
}

.results-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.results-actions .back-btn {
    margin: 0.5rem auto 0;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .game-header h1 {
        font-size: 2rem;
    }

    .mode-cards {
        grid-template-columns: 1fr;
    }

    .flashcard-front,
    .flashcard-back {
        min-height: 300px;
        padding: 1.5rem;
    }

    .card-term {
        font-size: 2.5rem;
    }

    .flashcard-actions {
        flex-direction: column;
    }

    .study-controls {
        flex-direction: column;
    }

    .progress-bar {
        width: 120px;
    }

    .results-stats {
        grid-template-columns: 1fr;
    }

    .timed-info {
        gap: 1rem;
        font-size: 0.9rem;
    }

    .share-card-inner {
        padding: 1.5rem;
    }

    .share-score-number {
        font-size: 3rem;
    }
}

/* Confetti */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
    animation: confetti-fall 3s ease-out forwards;
}

.confetti.circle {
    border-radius: 50%;
}

.confetti.square {
    border-radius: 2px;
}

.confetti.ribbon {
    width: 8px;
    height: 20px;
    border-radius: 2px;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg) scale(0.5);
    }
}

/* Share Card */
.share-card {
    margin: 1.5rem auto;
    max-width: 320px;
}

.share-card-inner {
    background: linear-gradient(135deg, #1a2e1a 0%, #2d4a2d 100%);
    border-radius: 16px;
    padding: 2rem;
    color: white;
    text-align: center;
    box-shadow: 0 10px 40px rgba(26, 46, 26, 0.3);
}

.share-card-header {
    margin-bottom: 1.5rem;
}

.share-card-logo {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.9;
}

.share-card-score {
    margin-bottom: 1rem;
}

.share-score-number {
    display: block;
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
    font-family: var(--font-display);
}

.share-score-label {
    font-size: 1rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.share-card-details {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.share-card-footer {
    font-size: 0.75rem;
    opacity: 0.6;
}

.share-btn {
    background: var(--color-surface) !important;
    color: var(--color-primary) !important;
    border: 1px solid var(--color-border) !important;
}

.share-btn:hover {
    background: var(--color-primary-light) !important;
}

.share-copied {
    display: none;
    color: #059669;
    font-size: 0.9rem;
    margin-top: 0.75rem;
    animation: fade-in-out 2s ease-out forwards;
}

.share-copied.show {
    display: block;
}

@keyframes fade-in-out {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* Card entrance animation */
.flashcard {
    animation: card-entrance 0.4s ease-out;
}

@keyframes card-entrance {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Celebration animation for results */
.results-content.celebrate .stat-card {
    animation: pop-in 0.4s ease-out backwards;
}

.results-content.celebrate .stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.results-content.celebrate .stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.results-content.celebrate .stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes pop-in {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Personal Bests Section */
.personal-bests {
    margin-top: 3rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    background: linear-gradient(135deg, var(--color-surface) 0%, rgba(74, 124, 89, 0.03) 100%);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.personal-bests-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.personal-bests-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.personal-bests-header h3::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 50%;
    flex-shrink: 0;
}

.clear-scores-btn {
    background: none;
    border: none;
    color: var(--color-text-light);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.clear-scores-btn:hover {
    color: var(--color-text);
    background: var(--color-border);
    opacity: 1;
}

.personal-bests-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.best-score-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--color-surface);
    border-radius: 8px;
    font-size: 0.85rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.best-score-item:hover {
    transform: translateX(2px);
}

.best-score-item.top-score {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(245, 158, 11, 0.05));
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.15);
}

.best-score-rank {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--color-text-light);
    background: var(--color-border);
    border-radius: 50%;
}

.top-score .best-score-rank {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a1a;
}

.best-score-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.best-score-percent {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-text);
}

.best-score-details {
    color: var(--color-text-light);
    font-size: 0.75rem;
}

.best-score-date {
    color: var(--color-text-light);
    font-size: 0.75rem;
    opacity: 0.7;
}

.personal-bests-note {
    margin-top: 1rem;
    font-size: 0.7rem;
    color: var(--color-text-light);
    text-align: center;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.personal-bests-note::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 1.5px solid currentColor;
    border-radius: 2px;
    opacity: 0.5;
}

/* New Best Badge */
.new-best-badge {
    display: inline-block;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a1a;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    margin-bottom: 1rem;
    animation: badge-pulse 0.6s ease-out;
}

@keyframes badge-pulse {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 600px) {
    .personal-bests {
        margin-left: 1rem;
        margin-right: 1rem;
        padding: 1.25rem;
    }

    .best-score-item {
        grid-template-columns: 26px 1fr auto;
        gap: 0.5rem;
        padding: 0.5rem 0.6rem;
    }

    .best-score-rank {
        width: 26px;
        height: 26px;
        font-size: 0.75rem;
    }

    .best-score-date {
        display: none;
    }
}

/* Privacy Note */
.privacy-note {
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-light);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}
