:root {
    --bg-color: #f4f4f9;
    --card-bg: #ffffff;
    --primary-color: #4a90e2;
    /* Niebieski */
    --text-color: #333;
    --border-color: #e0e0e0;
    --font-family: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    font-family: var(--font-family);
    color: var(--text-color);
    padding: 20px;
    padding-bottom: 100px;
    /* Miejsce na FAB */
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 600px;
    /* Węższy widok mobilny/karty */
}

.main-header {
    margin-bottom: 20px;
    text-align: center;
}

.main-header h1 {
    font-size: 1.5rem;
    color: #444;
    margin-bottom: 10px;
}

#footer-stats {
    text-align: center;
    margin-top: 30px;
    margin-bottom: 80px;
    /* Miejsce na FAB */
}

#global-workout-volume {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    display: inline-block;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(74, 144, 226, 0.2);
}

#global-workout-volume .val {
    color: white;
    font-weight: 800;
    font-size: 1.1rem;
}

.save-btn {
    background: none;
    border: none;
    color: #333;
    padding: 0;
    cursor: pointer;
    font-size: 2.5rem;
    line-height: 1;
    transition: transform 0.2s;
}

.save-btn:hover {
    transform: scale(1.1);
}

/* --- EXERCISE BLOCK --- */
.exercise-block {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid var(--border-color);
}

.exercise-header {
    margin-bottom: 15px;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 10px;
}

.exercise-name {
    width: 100%;
    border: none;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: var(--font-family);
    color: var(--text-color);
    outline: none;
}

.exercise-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.row {
    display: flex;
    align-items: center;
}

.input-volume {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    background-color: #f9f9f9;
    border: 1px solid transparent;
    border-radius: 4px;
    font-family: monospace;
    /* Lepiej do liczb */
}

.input-volume:focus {
    background-color: #fff;
    border-color: var(--primary-color);
    outline: none;
}

/* Footer bloku */
.exercise-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-volume {
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
}

.val {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.add-row-btn {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
}

.add-row-btn:hover {
    background-color: rgba(74, 144, 226, 0.1);
}

/* --- FAB (Floating Action Button) --- */
.fab-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-size: 2rem;
    box-shadow: 0 4px 10px rgba(74, 144, 226, 0.3);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s;
}

.fab-btn:hover {
    transform: scale(1.1);
}

/* --- Deletion & Util Styles --- */
.exercise-header {
    margin-bottom: 15px;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.delete-exercise-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.delete-exercise-btn:hover {
    opacity: 1;
}

.delete-row-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    margin-left: 10px;
    line-height: 1;
    padding: 0 5px;
}

.delete-row-btn:hover {
    color: #ff6b6b;
}

.row {
    display: flex;
    align-items: center;
    position: relative;
    /* Dla pewności */
}

/* Empty State */
#empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-style: italic;
}

.hidden {
    display: none !important;
}

/* --- Calendar --- */
#calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: bold;
}

#calendar-header button {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px 10px;
}

#calendar-container {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day {
    aspect-ratio: 1;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
    position: relative;
    cursor: default;
}

.calendar-day.empty {
    background: none;
    border: none;
}

.calendar-day.has-workout {
    background-color: #e3f2fd;
    border-color: #bbdefb;
    cursor: pointer;
    font-weight: bold;
    color: var(--primary-color);
}

.calendar-day.has-workout:hover {
    background-color: #bbdefb;
}

/* --- Modal --- */
dialog {
    border: none;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 400px;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    padding: 20px;
}

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

#close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-exercise {
    margin-bottom: 15px;
}

.modal-exercise h4 {
    margin-bottom: 5px;
    font-size: 1rem;
    color: #333;
}

.modal-set {
    font-family: monospace;
    font-size: 0.9rem;
    color: #666;
    margin-left: 10px;
}

/* --- Mobile Optimization (standard mobile sizes) --- */
@media (max-width: 768px) {
    body {
        font-size: 1rem;
        padding: 10px;
        padding-bottom: 50px;
    }

    .main-header h1 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    .exercise-block {
        padding: 15px;
        margin-bottom: 20px;
        border-radius: 8px;
    }

    .exercise-name {
        font-size: 1.2rem;
        padding: 5px 0;
    }

    .input-volume {
        font-size: 1rem;
        padding: 10px;
        border-radius: 4px;
    }

    .add-row-btn {
        font-size: 0.9rem;
        padding: 5px 10px;
        border-radius: 4px;
    }

    .save-btn {
        font-size: 0.9rem;
        padding: 8px 16px;
        border-radius: 6px;
    }

    .fab-btn {
        width: 60px;
        height: 60px;
        font-size: 2rem;
        bottom: 15px;
        right: 15px;
    }

    .delete-exercise-btn {
        font-size: 1.2rem;
    }

    .delete-row-btn {
        font-size: 1.5rem;
        padding: 0 5px;
    }

    .total-volume {
        font-size: 0.9rem;
    }

    .val {
        font-size: 1.1rem;
    }

    #global-workout-volume {
        font-size: 0.9rem;
        padding: 10px 20px;
        border-radius: 20px;
    }

    #global-workout-volume .val {
        font-size: 1.1rem;
    }

    .exercise-footer {
        margin-top: 15px;
        padding-top: 15px;
    }

    #calendar-header button {
        font-size: 1.2rem;
        padding: 5px 10px;
    }

    #calendar-header span {
        font-size: 1rem;
    }

    .calendar-day {
        font-size: 0.9rem;
    }

    #history-section h3 {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }

    #empty-state {
        padding: 40px 20px;
        font-size: 0.9rem;
    }

    .modal-content {
        padding: 20px;
    }

    .modal-header h3 {
        font-size: 1.2rem;
    }

    #close-modal {
        font-size: 1.5rem;
    }

    .modal-exercise h4 {
        font-size: 1rem;
        margin-bottom: 5px;
    }

    .modal-set {
        font-size: 0.9rem;
        margin-left: 10px;
    }
}