/* ===== MAIN APP STYLES ===== */
.stretches-app {
    padding: 1rem;
    max-width: 1000px;
    margin: 0 auto;
    padding-bottom: 2rem;
}

.app-container {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Stretches Grid */
.exercise-selector h2 {
    font-size: 2rem;
    color: #5a67d8;
    margin-bottom: 1.5rem;
    text-align: center;
}

.stretches-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* Stretch Card */
.stretch-card {
    background: #f7fafc;
    padding: 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e2e8f0;
    text-align: center;
}

.stretch-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.1);
}

.stretch-grid-name {
    font-size: 1.2rem;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.stretch-benefit {
    color: #718096;
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 500;
    padding-bottom: .75rem;
}

.stretch-meta {
    padding: 0.25rem 0.75rem;
    border-radius: 5px;
    font-size: 0.9rem;
    background: #c6f6d5;
    color: #276749;
    font-weight: 600;
}

/* Stretch Interface */
.stretch-interface {
    background: #f8fafc;
    border-radius: 20px;
    padding: 1.5rem;
    margin: 1rem 0;
}

[hidden] {
    display: none !important;
}

.stretch-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: start;
}

.stretch-visual {
    flex: 1;
    min-width: 0;
}

.stretch-image {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.stretch-instructions {
    flex: 1;
    min-width: 0;
}

.stretch-instructions::-webkit-scrollbar {
    width: 6px;
}

.stretch-instructions::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.stretch-instructions::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.stretch-name {
    font-size: 1.5rem;
    color: #2e7d32;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.instructions-container {
    padding: 0rem 1.5rem;
}

.instructions-container h3 {
    color: #4a5568;
    margin-bottom: .5rem;
    font-size: 1.2rem;
}

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

.instructions-list li {
    padding: 0.5rem 0;
    color: #666;
    line-height: 1.5;
    position: relative;
    padding-left: 1.5rem;
}

.instructions-list li:before {
    content: '•';
    color: #667eea;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Session Controls */
.session-controls {
    padding: 1.5rem;
}

.control-row {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 200px;
}

.control-item label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.select-wrapper {
    position: relative;
    display: inline-block;
    min-width: 180px;
}

.styled-select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 1rem;
    color: #4a5568;
    cursor: pointer;
    appearance: none;
    transition: all 0.3s ease;
    font-family: inherit;
}

.styled-select:hover {
    border-color: #cbd5e0;
}

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

.select-arrow {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #718096;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.styled-select:focus+.select-arrow {
    transform: translateY(-50%) rotate(180deg);
    color: #667eea;
}

.estimated-time {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: #4a5568;
}

.estimated-time span {
    font-weight: 600;
    color: #2e7d32;
}

/* Exercise Interface */
.exercise-interface {
    background: #f8fafc;
    border-radius: 20px;
    padding: 2rem;
    margin: 1rem 0;
    position: relative;
}

.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.exercise-header h2 {
    font-size: 1.8rem;
    color: #2e7d32;
    margin: 0;
}

.exercise-timer {
    text-align: center;
}

.timer-display {
    font-size: 2.5rem;
    font-weight: 600;
    color: #2e7d32;
    font-variant-numeric: tabular-nums;
}

.timer-label {
    font-size: 0.9rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Step Display */
.step-display {
    border-top: 1px solid #e9f3e6;
    padding-top: 1rem;
    margin-bottom: 2rem;
}

.step-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.step-counter {
    font-size: 1.1rem;
    color: #4a5568;
    font-weight: 500;
}

.step-counter span {
    color: #2e7d32;
    font-weight: 600;
}

.rep-counter {
    font-size: 1.1rem;
    color: #4a5568;
    font-weight: 500;
    background: #e8f5e9;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.rep-counter span {
    color: #2e7d32;
    font-weight: 600;
}

.step-instruction {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
}

.step-instruction p {
    font-size: 1.4rem;
    color: #2d3748;
    line-height: 1.6;
    margin: 0;
}

.step-visual {
    text-align: center;
}

.exercise-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

/* Exercise Controls */
.exercise-controls {
    text-align: center;
}

.exercise-controls,
.control-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Completion Overlay */
.completion-view {
    background: #f8fafc;
    border-radius: 20px;
    padding: 3rem 2rem;
    margin: 2rem 0;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.completion-container {
    max-width: 500px;
    margin: 0 auto;
}

.completion-icon {
    font-size: 4rem;
    color: #48bb78;
    margin-bottom: 1.5rem;
    animation: scaleIn 0.5s ease;
}

.completion-view h2 {
    font-size: 2rem;
    color: #2e7d32;
    margin-bottom: 1rem;
}

.completion-view p {
    color: #4a5568;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.completion-stats {
    font-size: 1.2rem;
    color: #2e7d32;
    font-weight: 600;
    margin: 1.5rem 0;
}

.completion-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn.primary {
    background: #667eea;
    color: white;
}

.btn.primary:hover:not(:disabled) {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.btn.primary:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn.secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn.secondary:hover:not(:disabled) {
    background: #cbd5e0;
    transform: translateY(-2px);
}

.btn.outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn.outline:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .exercise-selector h2 {
        font-size: 1.5rem;
    }

    .stretch-interface,
    .exercise-interface {
        padding: 1.2rem;
        border-radius: 16px;
    }

    .timer-display {
        font-size: 2rem;
    }

    .step-display {
        padding: 1.5rem;
    }

    .step-instruction p {
        font-size: 1.2rem;
    }

    .completion-content h3 {
        font-size: 1.5rem;
    }

    .completion-icon {
        font-size: 3rem;
    }

    .control-row {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .control-item {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .stretch-interface,
    .exercise-interface {
        padding: 1rem;
    }

    .step-display {
        padding: 1rem;
    }

    .step-instruction p {
        font-size: 1.1rem;
    }

    .exercise-controls .control-buttons {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 280px;
        min-width: auto;
    }

    .exercise-header h2 {
        font-size: 1.3rem;
    }

    .timer-display {
        font-size: 1.3rem;
    }

    .timer-label {
        font-size: .8rem;
    }

    .step-counter {
        font-size: 1rem;
    }

    .rep-counter {
        font-size: 1rem;
    }
}

/* Tablet and larger */
@media (min-width: 600px) {
    .stretches-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stretch-main {
        grid-template-columns: repeat(2, 1fr);
    }

    .stretch-instructions {
        height: 300px;
        overflow-y: auto;
        padding-right: 1rem;
    }
}

/* Desktop and larger */
@media (min-width: 900px) {
    .stretches-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .exercise-header {
        flex-direction: row;
    }
}

#customReps:invalid {
    border-color: #e53e3e;
    background-color: #fff5f5;
}

/* Voice Controls */
.voice-controls-section {
    margin: 1.5rem 0;
}

.voice-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.voice-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 1rem;
    color: #4a5568;
    user-select: none;
    font-weight: 500;
}

.voice-toggle input {
    display: none;
}

.checkmark {
    width: 24px;
    height: 24px;
    border: 2px solid #cbd5e0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.voice-toggle input:checked + .checkmark {
    background: #667eea;
    border-color: #667eea;
}

.checkmark:after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.voice-toggle input:checked + .checkmark:after {
    opacity: 1;
}

.voice-toggle:hover .checkmark {
    border-color: #667eea;
}

.volume-control {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding-left: 1rem;
    border-left: 2px solid #e2e8f0;
    width: 100%;
    max-width: 300px;
}

.volume-control.visible {
    display: flex;
}

.volume-control label {
    font-size: 0.95rem;
    color: #4a5568;
    font-weight: 500;
    white-space: nowrap;
}

.volume-slider {
    width: 120px;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#volumeValue {
    font-size: 0.9rem;
    color: #718096;
    min-width: 40px;
    text-align: center;
}

/* Responsive voice controls */
@media (max-width: 768px) {
    .voice-controls-section {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {

    .voice-control {
        flex-direction: column;
    }

    .volume-control {
        border: none;
    }
    
    .volume-slider {
        width: 150px;
    }

    .voice-toggle {
        font-size: 0.95rem;
    }
}