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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #1a1a2e;
    color: #eee;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #00d4ff;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

button {
    padding: 12px 20px;
    background: #00d4ff;
    color: #1a1a2e;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #00b8e6;
}

button.secondary {
    background: #444;
    color: #eee;
}

button.secondary:hover {
    background: #555;
}

.workout-form {
    background: #16213e;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    color: #00d4ff;
    font-weight: bold;
}

select, input {
    width: 100%;
    padding: 10px;
    background: #0f3460;
    border: 1px solid #00d4ff;
    border-radius: 6px;
    color: #eee;
    font-size: 16px;
}

.exercise-grid {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.exercise-item {
    background: #0f3460;
    padding: 15px;
    border-radius: 8px;
}

.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.exercise-name {
    font-size: 18px;
    font-weight: bold;
    color: #00d4ff;
}

.weight-input {
    display: flex;
    gap: 10px;
    align-items: center;
}

.weight-input input {
    width: 100px;
}

.sets-display {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    justify-content: center;
}

.sets-display input[type="checkbox"] {
    width: 28px;
    height: 28px;
    cursor: pointer;
}

.plate-calculation {
    background: #1a1a2e;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 14px;
}

.history {
    margin-top: 30px;
}

.workout-card {
    background: #16213e;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.workout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.workout-date {
    color: #00d4ff;
    font-weight: bold;
}

.workout-actions {
    display: flex;
    gap: 8px;
}

.workout-exercise {
    margin-left: 15px;
    margin-bottom: 8px;
}

.hidden {
    display: none;
}

input[type="file"] {
    display: none;
}

.icon-btn {
    padding: 8px 12px;
    font-size: 14px;
    min-width: auto;
}

.small-btn {
    padding: 4px 8px;
    font-size: 12px;
    min-width: auto;
    margin-left: 8px;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #16213e;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #00d4ff;
}

.modal-content h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #00d4ff;
    font-size: 18px;
}

.modal-content small {
    color: #aaa;
    font-size: 12px;
    display: block;
    margin-top: 5px;
}

.settings-modal {
    max-width: 700px;
}

.settings-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid #0f3460;
}

.tab-btn {
    flex: 1;
    padding: 10px 15px;
    background: transparent;
    color: #aaa;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #00d4ff;
    border-bottom-color: #00d4ff;
}

.settings-tab {
    display: none;
}

.settings-tab.active {
    display: block;
}

.exercise-config, .workout-config {
    background: #0f3460;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.exercise-field {
    flex: 1;
    min-width: 100px;
}

.workout-name-field {
    min-width: 200px;
}

.exercise-checkboxes {
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.exercise-checkboxes label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #eee;
    font-weight: normal;
    cursor: pointer;
}

.exercise-checkboxes input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.rest-timer {
    background: #00d4ff;
    color: #1a1a2e;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.timer-cancel {
    padding: 5px 10px;
    font-size: 12px;
    background: #1a1a2e;
    color: #00d4ff;
}

.timer-complete {
    background: #00ff88;
    color: #1a1a2e;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    text-align: center;
    font-weight: bold;
}

.exercise-timer {
    background: #ff6b00;
    color: #fff;
    padding: 12px;
    border-radius: 6px;
    margin-top: 10px;
    text-align: center;
    font-weight: bold;
    font-size: 18px;
}

.countdown-timer {
    background: #ffaa00;
    animation: countdown-pulse 1s infinite;
}

@keyframes countdown-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.timer-controls {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.exercise-type-fields {
    display: contents;
}

.github-setup {
    background: #0f3460;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.github-setup h3 {
    margin-top: 0;
}

.github-setup ol {
    margin-left: 20px;
    margin-bottom: 15px;
    line-height: 1.6;
}

.github-setup ul {
    margin-left: 20px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.github-setup a {
    color: #00d4ff;
    text-decoration: none;
}

.github-setup a:hover {
    text-decoration: underline;
}

.gist-selector {
    background: #1a1a2e;
    padding: 15px;
    border-radius: 8px;
}

.gist-selector select {
    margin-bottom: 0;
}

#backupBtn {
    position: relative;
}

.unsynced-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .controls {
        flex-direction: column;
    }

    button {
        width: 100%;
    }

    .modal-content {
        padding: 20px;
    }
}
