/* Timer App Container */
.timer-app {
    max-width: 500px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    text-align: left;
}

/* Header */
.timer-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.back-link {
    color: #003688;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
}

.back-link:hover {
    text-decoration: underline;
}

.timer-header h1 {
    font-size: 1.5rem;
    margin: 0;
    color: #003688;
}

/* Sections */
.timer-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.timer-section.hidden {
    display: none;
}

.timer-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #003688;
}

/* Workout Selection */
.workout-search {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

#workout-search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #003688;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#workout-search-input:focus {
    border-color: #0098D4;
    box-shadow: 0 0 0 3px rgba(0, 150, 212, 0.2);
}

#workout-search-input::placeholder {
    color: #999;
}

.workout-count {
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap;
}

.workout-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.workout-list::-webkit-scrollbar {
    width: 8px;
}

.workout-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.workout-list::-webkit-scrollbar-thumb {
    background: #003688;
    border-radius: 4px;
}

.workout-list::-webkit-scrollbar-thumb:hover {
    background: #002266;
}

.workout-btn {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background: #003688;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.workout-btn:hover {
    background: #002266;
}

.workout-btn:disabled {
    background: #999;
    cursor: not-allowed;
}

.workout-btn.hidden {
    display: none;
}

.no-workouts {
    color: #666;
    font-style: italic;
}

/* Workout Preview */
#workout-preview h2 {
    margin-bottom: 1rem;
}

.workout-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.workout-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 8px;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: bold;
    color: #003688;
}

.stat-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
}

.exercise-list {
    flex: 1;
    overflow-y: auto;
    max-height: 250px;
}

.exercise-list h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #003688;
}

.exercise-list ol {
    margin: 0;
    padding-left: 1.5rem;
}

.exercise-list li {
    padding: 0.4rem 0;
    border-bottom: 1px solid #eee;
    color: #333;
}

.exercise-list li:last-child {
    border-bottom: none;
}

.workout-total {
    text-align: center;
    padding: 0.75rem;
    background: #003688;
    color: white;
    border-radius: 8px;
    font-weight: 500;
}

#preview-total-time {
    font-size: 1.25rem;
    font-weight: bold;
}

.preview-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

/* Timer Display */
.workout-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
}

#workout-name {
    font-weight: 500;
}

/* Timer Circle - Main Display */
.timer-circle {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, border-color 0.3s;
    border: 8px solid;
}

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

/* State-based colors */
.timer-circle.state-ready,
.timer-circle.state-initial,
.timer-circle.state-round-rest {
    background-color: #fff8e1;
    border-color: #ffc107;
}

.timer-circle.state-work {
    background-color: #e8f5e9;
    border-color: #28a745;
}

.timer-circle.state-exercise-rest {
    background-color: #e3f2fd;
    border-color: #17a2b8;
}

.timer-circle.state-paused {
    background-color: #f5f5f5;
    border-color: #6c757d;
}

.timer-circle.state-complete {
    background-color: #e8f5e9;
    border-color: #28a745;
}

/* Timer Text Elements */
.timer-phase {
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.timer-time {
    font-size: 4rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.timer-exercise {
    font-size: 1.1rem;
    color: #333;
    max-width: 200px;
    word-wrap: break-word;
}

.timer-next-exercise {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
    max-width: 200px;
    word-wrap: break-word;
}

/* State-based text colors */
.state-work .timer-phase,
.state-work .timer-time {
    color: #28a745;
}

.state-exercise-rest .timer-phase,
.state-exercise-rest .timer-time {
    color: #17a2b8;
}

.state-ready .timer-phase,
.state-ready .timer-time,
.state-initial .timer-phase,
.state-initial .timer-time,
.state-round-rest .timer-phase,
.state-round-rest .timer-time {
    color: #f39c12;
}

.state-paused .timer-phase,
.state-paused .timer-time {
    color: #6c757d;
}

.state-complete .timer-phase,
.state-complete .timer-time {
    color: #28a745;
}

/* Progress Section */
.progress-section {
    margin-bottom: 1.5rem;
    text-align: center;
}

.exercise-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.exercise-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ddd;
    transition: background-color 0.2s, transform 0.2s;
}

.exercise-dot.completed {
    background-color: #28a745;
}

.exercise-dot.current {
    background-color: #003688;
    transform: scale(1.3);
}

.progress-labels {
    font-size: 0.85rem;
    color: #666;
}

/* Control Buttons */
.timer-controls {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.timer-controls.secondary {
    margin-top: 0.25rem;
}

.control-btn {
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    border: 2px solid #003688;
    background: white;
    color: #003688;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.control-btn:hover {
    background: #003688;
    color: white;
}

.control-btn:disabled {
    border-color: #ccc;
    color: #ccc;
    cursor: not-allowed;
}

.control-btn:disabled:hover {
    background: white;
    color: #ccc;
}

.control-btn.primary {
    background: #003688;
    color: white;
    min-width: 100px;
}

.control-btn.primary:hover {
    background: #002266;
}

/* Completion Screen */
.completion-content {
    text-align: center;
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.completion-content h2 {
    font-size: 2rem;
    color: #28a745;
    margin-bottom: 0.5rem;
}

.completion-content p {
    color: #666;
    margin-bottom: 1rem;
}

/* Mobile Responsiveness */
@media (max-width: 400px) {
    .timer-circle {
        width: 240px;
        height: 240px;
    }

    .timer-time {
        font-size: 3rem;
    }

    .timer-exercise {
        font-size: 1rem;
        max-width: 160px;
    }

    .timer-controls {
        flex-wrap: wrap;
    }

    .control-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}
