/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: #fafafa;
    color: #222;
    padding: 24px;
    line-height: 1.6;
}

.container {
    max-width: 770px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Headings */
h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: #111;
    letter-spacing: -0.015em;
    line-height: 1.2;
}

h2 {
    font-size: 2rem;
    margin: 2rem 0 1rem;
    color: #222;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

h3 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    color: #333;
    font-weight: 600;
    letter-spacing: -0.005em;
    line-height: 1.4;
}

/* Button text */
button {
    font-weight: 600;
    letter-spacing: 0.01em;
    font-size: 0.95rem;
}

/* Inputs */
input[type="text"], input[type="number"] {
    font-size: 0.95rem;
    letter-spacing: 0.005em;
}

/* Workout selector buttons */
.workout-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.workout-selector button {
    flex: 1 0 auto;
    min-width: 120px;
    padding: 12px 18px;
    border: 2px solid #e0e0e0;
    background: white;
    color: #333;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease, box-shadow 0.2s ease;
}

.workout-selector button:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
}

.workout-selector button.active {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Controls toolbar */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 24px 0;
}

.controls button {
    flex: 1 0 auto;
    padding: 14px 20px;
    border: none;
    background: #475569;
    color: white;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.controls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(71, 85, 105, 0.25);
}

/* Primary button */
#saveWorkoutBtn {
    display: none;
    background: #10b981;
}
.showing-workout #saveWorkoutBtn{
    display: block;
}

#saveWorkoutBtn:hover {
    background: #059669;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
}

/* Exercise card */
.exercise {
    background: white;
    padding: 24px;
    margin: 18px 0;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}


.exercise:hover {
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.05);
}

/* Inputs */
input[type="text"], input[type="number"] {
    flex: 1 1 200px;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: white;
    min-width: 120px;
}

input[type="text"]:focus, input[type="number"]:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Sets section */
.sets {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.set-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.set-container button {
    flex: 0 0 auto;
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #eee;
    font-weight: 500;
    font-size: 0.95rem;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}
.set-container button::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100% 100%;
    transition: background-image 0.2s ease;
    margin-right: 8px;
    transform: translateY(2px);
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="%23333333" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>');
}

.set-container button.completed::before {
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><polyline points="20 6 9 17 4 12"/></svg>');
}



.set-container button:hover {
    border-color: #4f46e5;
    color: #4f46e5;
}

.set-container button.completed {
    background: #4f46e5;
    border-color: #4f46e5;
    color: white;
}
.exercise h3{
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.exercise h3 span{
    justify-self: flex-start;
    margin-right: auto;

}
.exercise h3 .add-btn,
.exercise h3 .remove-btn{
    text-align: center;
    font-size: 1rem;
    line-height: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #333;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    text-align: center;
    width: 40px;
    height: 40px;
}
.exercise h3 .remove-btn{
    margin-left: 20px;
}

/* Set controls */
.set-controls {
    margin-top: 12px;
    display: flex;
    gap: 10px;
}

.set-controls button {
    flex: 1 1 50%;
    padding: 12px 0;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #333;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    text-align: center;
}

.set-controls button:hover {
    background-color: #5b51e5;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
    color: white;
    transform: translateY(-1px);
}

/* Timer */
.timer {
    width: 100%;
    text-align: center;
    margin-top: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #ea580c;
    background: #fff5f0;
    border: 1px solid #fdba74;
    border-radius: 8px;
    padding: 10px 14px;
    display: inline-block;
}

/* Timer buttons */
.timer-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.timer-controls button {
    flex: 1 1 50%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.timer-controls .start-timer {
    background: #ea580c;
    color: white;
}

.timer-controls .start-timer:hover {
    background: #f97316;
}

.timer-controls .stop-timer {
    background: #64748b;
    color: white;
}

.timer-controls .stop-timer:hover {
    background: #475569;
}

.exercise .master-weight{
    width: 100%;
    flex:0;
    order:1;
    margin-top: 10px;
}

/* History */
#historyList {
    margin-top: 24px;
}

.history-entry {
    background: white;
    padding: 18px;
    margin-bottom: 14px;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.history-entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.05);
}

.history-entry button {
    margin-top: 10px;
    padding: 10px 16px;
    border: none;
    background: #dc2626;
    color: white;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.history-entry button:hover {
    transform: translateY(-1px);
    background-color: #b91c1c;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

/* Responsive */
@media (max-width: 600px) {
    .workout-selector {
        flex-direction: column;
    }

    .controls {
        flex-direction: column;
    }

    .set-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .sets input {
        width: 100%;
    }

    .set-controls {
        justify-content: flex-start;
    }

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