/* styles.css - Vintage-themed styling for Guitar Flash Cards PWA */

:root {
    --vintage-brown: #5D4037;
    --vintage-gold: #C9A961;
    --vintage-orange: #D4A574;
    --vintage-green: #8B9467;
    --vintage-bg: #F5E6D3;
    --vintage-white: #FFF8E7;
}

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

body {
    font-family: 'Lora', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, serif;
    background-color: var(--vintage-bg);
    background-image: url('../images/flashcard-bg.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--vintage-brown);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-y;
}

#app {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Common Elements */
button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

/* Buttons */
.btn-primary {
    background: var(--vintage-gold);
    color: white;
    padding: 16px 32px;
    border-radius: 15px;
    font-size: 18px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(201, 169, 97, 0.3);
    transition: all 0.2s;
}

.btn-primary:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(201, 169, 97, 0.3);
}

.btn-secondary {
    background: var(--vintage-brown);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    margin-top: 16px;
}

.btn-text {
    color: var(--vintage-brown);
    font-size: 16px;
    padding: 8px 16px;
    text-decoration: none;
}

.btn-back {
    font-size: 24px;
    color: var(--vintage-brown);
    padding: 8px;
}

.btn-close {
    font-size: 32px;
    color: var(--vintage-brown);
    padding: 0;
    line-height: 1;
}

.btn-danger {
    background: #C62828;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 20px;
}

/* Home View */
.home-view {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

.home-view::after {
    content: '';
    position: fixed;
    bottom: 0;
    right: 0;
    width: 500px;
    height: 500px;
    background-image: url('../images/guitar.webp');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom right;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

@media (min-width: 768px) {
    .home-view::after {
        width: 600px;
        height: 600px;
    }
}

.home-view > * {
    position: relative;
    z-index: 1;
}

.home-header {
    text-align: center;
    padding: 60px 20px 40px;
}

.app-title {
    font-family: 'Cinzel', serif;
    font-size: 38px;
    font-weight: bold;
    color: var(--vintage-brown);
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(201, 169, 97, 0.3);
}

.app-subtitle {
    font-size: 24px;
    color: rgba(93, 64, 55, 0.8);
    font-weight: 400;
}

.home-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 40px;
}

.btn-start {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 300px;
    justify-content: center;
}

.btn-icon {
    font-size: 20px;
}

/* Stats Container */
.stats-container {
    display: flex;
    gap: 20px;
    background: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.stat-card {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-icon {
    font-size: 32px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--vintage-brown);
}

.stat-label {
    font-size: 14px;
    color: rgba(93, 64, 55, 0.7);
}

.settings-link {
    padding-bottom: 40px;
}

/* Mode Selection View */
.mode-selection-view {
    min-height: 100vh;
    padding: 20px;
}

.view-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.view-header h2 {
    flex: 1;
    font-size: 24px;
    font-weight: 600;
}

.mode-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.btn-explore {
    width: 100%;
    background: var(--vintage-gold);
    color: white;
    padding: 20px 32px;
    border-radius: 15px;
    font-size: 20px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(201, 169, 97, 0.3);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.btn-explore:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(201, 169, 97, 0.3);
}

.btn-explore i {
    font-size: 24px;
}

.fret-range-selector {
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.fret-range-selector label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
}

.range-buttons {
    display: flex;
    gap: 12px;
}

.btn-range {
    flex: 1;
    padding: 12px;
    background: var(--vintage-bg);
    border: 2px solid transparent;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-range.active {
    background: var(--vintage-gold);
    color: white;
    border-color: var(--vintage-gold);
}

.modes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.mode-card {
    background: white;
    padding: 20px;
    border-radius: 16px;
    border: 3px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.mode-card:active {
    transform: scale(0.98);
}

.mode-card.selected {
    border-color: var(--vintage-gold);
    background: rgba(201, 169, 97, 0.1);
}

.mode-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.mode-name {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 16px;
}

.mode-description {
    font-size: 13px;
    color: rgba(93, 64, 55, 0.7);
    white-space: pre-line;
}

.fret-range-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
}

.fret-range-toggle label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(93, 64, 55, 0.8);
}

.range-buttons-small {
    display: flex;
    gap: 8px;
}

.btn-range-small {
    padding: 8px 16px;
    background: var(--vintage-bg);
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-range-small.active {
    background: var(--vintage-gold);
    color: white;
    border-color: var(--vintage-gold);
}

.string-selector {
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.string-selector label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
}

.string-buttons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.btn-string {
    padding: 12px 8px;
    background: var(--vintage-bg);
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-string.active {
    background: var(--vintage-gold);
    color: white;
    border-color: var(--vintage-gold);
}

.custom-fret-slider {
    margin-top: 12px;
}

.dual-range-slider {
    position: relative;
    height: 30px;
    margin-bottom: 8px;
}

.dual-range-slider input[type="range"] {
    position: absolute;
    width: 100%;
    height: 6px;
    background: transparent;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
    top: 12px;
}

.dual-range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--vintage-gold);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: all;
    position: relative;
    z-index: 3;
}

.dual-range-slider input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--vintage-gold);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: all;
    position: relative;
    z-index: 3;
}

.slider-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background: var(--vintage-bg);
    border-radius: 3px;
    top: 12px;
    z-index: 1;
}

.slider-range {
    position: absolute;
    height: 6px;
    background: var(--vintage-gold);
    border-radius: 3px;
    top: 12px;
    z-index: 2;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 12px;
    color: rgba(93, 64, 55, 0.7);
}

.btn-start-session {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

/* Practice View */
.practice-view {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.practice-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.progress-info {
    flex: 1;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(93, 64, 55, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

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

.progress-text {
    font-size: 14px;
    color: rgba(93, 64, 55, 0.7);
    text-align: center;
}

/* Flashcard */
.flashcard-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
    padding: 0;
}

.flashcard {
    width: 100%;
    max-width: 400px;
    height: 600px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

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

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.card-front {
    /* Front side is default (rotateY(0deg) implied) */
}

.card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #ffffff 0%, #f8f8f8 100%);
    padding: 30px 20px 20px 20px;
    gap: 0;
}

.staff-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-play-note {
    background: var(--vintage-gold);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(201, 169, 97, 0.3);
    transition: all 0.2s;
}

.btn-play-note:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(201, 169, 97, 0.3);
}

.btn-play-note i {
    font-size: 18px;
}

.note-name {
    font-size: 32px;
    font-weight: bold;
    color: var(--vintage-brown);
    margin-bottom: 8px;
    flex-shrink: 0;
}

.fretboard-container {
    width: 100%;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    min-height: 0;
}

.fretboard-container svg {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
}

/* Swipe Hints */
.swipe-hint {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
    font-size: 14px;
    color: rgba(93, 64, 55, 0.6);
}

.hint-left,
.hint-right {
    flex: 1;
}

.hint-left {
    text-align: left;
}

.hint-center {
    flex: 1;
    text-align: center;
}

.hint-right {
    text-align: right;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 16px;
    padding-bottom: 20px;
}

.btn-action {
    flex: 1;
    padding: 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.btn-action:active {
    transform: scale(0.95);
}

.btn-review {
    background: #FF9800;
    color: white;
}

.btn-correct {
    background: #4CAF50;
    color: white;
}

/* Session Complete */
.practice-view.complete {
    display: flex;
    align-items: center;
    justify-content: center;
}

.complete-container {
    text-align: center;
    max-width: 400px;
    width: 100%;
    padding: 40px 20px;
}

.complete-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.complete-container h2 {
    font-size: 32px;
    margin-bottom: 32px;
}

.complete-stats {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin-bottom: 32px;
}

.complete-stat {
    text-align: center;
}

.complete-stat .stat-value {
    font-size: 48px;
    font-weight: bold;
    color: var(--vintage-gold);
}

.complete-stat .stat-label {
    font-size: 16px;
    color: rgba(93, 64, 55, 0.7);
    margin-top: 8px;
}

.review-message {
    font-size: 16px;
    margin-bottom: 20px;
    color: var(--vintage-brown);
}

/* Confetti Animation */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 9999;
    animation: confetti-fall linear forwards;
    opacity: 0;
}

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

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 24px;
}

.modal-body {
    padding: 20px;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.setting-item select,
.setting-item input[type="checkbox"] {
    font-size: 16px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    width: 100%;
}

.setting-item input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.setting-actions {
    text-align: center;
    margin-top: 24px;
}

.progress-stats {
    margin: 16px 0;
}

.progress-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.progress-stat-label {
    font-weight: 500;
    color: var(--vintage-brown);
}

.progress-stat-value {
    font-weight: 600;
    color: var(--vintage-gold);
}

/* Explore View */
.explore-view {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.explore-content {
    flex: 1;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
    align-items: start;
}

.explore-selectors {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.explore-card-area {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 600px;
}

/* Accidental selector spans full width */
.accidental-selector {
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Two column layout for Note and String on larger screens */
.selector-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.selector-group {
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.selector-group label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 16px;
}

.selector-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Note buttons - single column layout */
.note-buttons {
    flex-direction: column;
}

.note-buttons .btn-selector {
    flex: none;
}

/* String buttons - single column layout */
.string-buttons {
    flex-direction: column;
}

.string-buttons .btn-selector {
    flex: none;
}

.btn-selector {
    flex: 1;
    min-width: 50px;
    padding: 12px;
    background: var(--vintage-bg);
    border: 2px solid transparent;
    border-radius: 8px;
    font-weight: 500;
    font-size: 16px;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-selector.active {
    background: var(--vintage-gold);
    color: white;
    border-color: var(--vintage-gold);
}

.btn-selector:active {
    transform: scale(0.95);
}

.explore-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 20px;
    color: rgba(93, 64, 55, 0.5);
}

.explore-placeholder i {
    font-size: 64px;
}

.explore-placeholder p {
    font-size: 18px;
    text-align: center;
}

/* Responsive */
@media (max-width: 900px) {
    .explore-content {
        grid-template-columns: 1fr;
    }

    .explore-card-area {
        min-height: auto;
    }
}

@media (max-width: 480px) {
    .modes-grid {
        grid-template-columns: 1fr;
    }

    .string-buttons {
        grid-template-columns: repeat(3, 1fr);
    }

    .app-title {
        font-size: 32px;
    }

    .complete-stats {
        gap: 20px;
    }

    .complete-stat .stat-value {
        font-size: 36px;
    }

    .selector-columns {
        grid-template-columns: 1fr;
    }

    .selector-buttons {
        gap: 6px;
    }

    .note-buttons,
    .string-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .note-buttons .btn-selector,
    .string-buttons .btn-selector {
        flex: 1;
        min-width: 40px;
    }

    .btn-selector {
        min-width: 40px;
        padding: 10px;
        font-size: 14px;
    }

    /* Explore view optimizations for small screens */
    .explore-view {
        padding: 12px;
    }

    .explore-selectors {
        gap: 8px;
    }

    .selector-group {
        padding: 10px;
    }

    .selector-group label {
        display: none;
    }

    .explore-card-area {
        min-height: 400px;
    }

    .flashcard {
        height: 500px;
    }
}

/* Larger phones (iPhone 12, 13, 14 Pro, etc) */
@media (min-width: 481px) and (max-width: 767px) {
    .flashcard {
        height: 550px;
    }
}

/* Prevent text selection during swipe */
.flashcard * {
    user-select: none;
    -webkit-user-select: none;
}
