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

/* ===== BASE LAYOUT ===== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f6fbfa;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 22px;
    border: 1px solid #e8f0ee;
    box-shadow: 0 8px 24px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.05);
}

h1 {
    color: #0a0f0f;
    font-size: 2em;
    font-weight: 800;
}

/* ===== NAVIGATION ===== */
.back-button {
    display: inline-block;
    padding: 12px 24px;
    background: #0f3d3e;
    color: white;
    text-decoration: none;
    border-radius: 16px;
    font-weight: 700;
    transition: all 0.2s;
    box-shadow: 0 8px 24px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.05);
}

.back-button:hover {
    background: #145252;
    transform: translateY(-2px);
}

/* ===== FORM GRID ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.form-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.form-group-header label {
    margin-bottom: 0;
    overflow: visible;
}

/* ===== BUTTONS ±1/±5 ===== */
.input-with-buttons {
    display: flex;
    gap: 3px;
    align-items: stretch;
}

.input-with-buttons input {
    flex: 1;
    min-width: 50px;
}

.btn-group {
    display: flex;
    gap: 2px;
}

.increment-btn {
    width: 32px;
    padding: 0;
    background: #0f3d3e;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: none;
    align-items: center;
    justify-content: center;
}

.increment-btn:hover {
    background: #145252;
    transform: scale(1.05);
}

.increment-btn:active {
    transform: scale(0.95);
}

.increment-btn.minus {
    background: #d9534f;
}

.increment-btn.minus:hover {
    background: #c9302c;
}

.increment-btn.step-5 {
    background: #1f6e5c;
    font-size: 0.75em;
}

.increment-btn.step-5:hover {
    background: #145252;
}

.increment-btn.minus.step-5 {
    background: #a94442;
}

.increment-btn.minus.step-5:hover {
    background: #843534;
}

/* ===== FORM INPUTS ===== */
label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #0a0f0f;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

input[type="number"],
input[type="text"] {
    padding: 10px;
    border: 1px solid #dbe9e6;
    border-radius: 12px;
    font-size: 1em;
    transition: all 0.3s;
    background: white;
}

input[type="number"]:focus,
input[type="text"]:focus {
    outline: none;
    border-color: #1f6e5c;
    box-shadow: 0 0 0 4px rgba(31, 110, 92, 0.1);
}

textarea {
    padding: 10px;
    border: 1px solid #dbe9e6;
    border-radius: 12px;
    font-size: 1em;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: all 0.3s;
    resize: vertical;
    width: 100%;
    color: #1a3330;
    background: white;
}

textarea:focus {
    outline: none;
    border-color: #1f6e5c;
    box-shadow: 0 0 0 4px rgba(31, 110, 92, 0.1);
}

.calc-a-btn {
    width: auto;
    font-size: 0.75em;
    padding: 2px 8px;
    border: 1px solid #1f6e5c;
    border-radius: 8px;
    background: transparent;
    color: #1f6e5c;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}

.calc-a-btn:hover {
    background: #1f6e5c;
    color: white;
}

/* ===== ACTION BUTTONS ===== */
.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

button {
    width: 100%;
    padding: 15px;
    background: #0f3d3e;
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 8px 24px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.05);
}

button:hover {
    background: #145252;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button.secondary {
    background: white;
    color: #0f3d3e;
    border: 2px solid #0f3d3e;
}

button.secondary:hover {
    background: #f0faf6;
    border-color: #145252;
}

/* ===== RESULT BOX ===== */
.result-box {
    background: #0f3d3e;
    color: white;
    padding: 20px;
    border-radius: 16px;
    margin: 20px 0;
    text-align: center;
}

.result-box h2 {
    margin-bottom: 10px;
    font-size: 1.2em;
}

.penalties h3 {
    color: #0a0f0f;
    margin-bottom: 10px;
}

.penalty-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    color: #516667;
}

/* ===== MESSAGES ===== */
.success-message {
    background: #0f3d3e;
    color: white;
    padding: 15px;
    border-radius: 16px;
    margin-bottom: 20px;
    text-align: center;
    animation: slideIn 0.3s;
    box-shadow: 0 8px 24px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.05);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== TABLE ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background: #f0faf6;
    font-weight: 600;
    color: #0a0f0f;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid #e8f0ee;
}

tr:hover {
    background: #f0faf6;
}

.small-text {
    font-size: 0.85em;
    color: #516667;
}

/* ===== FOOTER ===== */
footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e8f0ee;
    text-align: center;
    color: #516667;
    font-size: 0.9em;
}

footer a {
    color: #0f3d3e;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

footer a:hover {
    color: #1f6e5c;
}

/* ===== MEDIA QUERIES ===== */
@media (max-width: 1024px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .container {
        padding: 15px;
        border-radius: 16px;
    }

    h1 {
        font-size: 1.5em;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    input[type="number"],
    input[type="text"] {
        padding: 12px;
        font-size: 16px;
    }

    .increment-btn {
        display: flex;
        width: 36px;
        font-size: 1em;
    }

    .increment-btn.step-5 {
        font-size: 0.8em;
    }

    .btn-group {
        gap: 2px;
    }

    .result-box {
        padding: 15px;
        margin: 15px 0;
    }

    .result-box h2 {
        font-size: 1em;
    }

    .button-group {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    button {
        padding: 14px;
        font-size: 1em;
    }

    .success-message {
        padding: 12px;
        font-size: 0.95em;
    }

    footer {
        margin-top: 30px;
        padding-top: 15px;
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.3em;
    }
}
