/* Базовые сбросы стилей */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Настройки резинового body */
body.app-body {
    background-color: #f4f5f7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Хедер на всю ширину */
.app-header {
    background-color: #564ba3;
    color: white;
    padding: 18px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    width: 100%;
}

/* Главная обертка контента */
.app-main {
    flex: 1;
    width: 100%;
    max-width: 1200px; 
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* Важно: отступ снизу, чтобы плавающие кнопки не перекрывали контент при полной прокрутке */
    padding-bottom: 100px; 
}

/* Карточка таймера */
.timer-card {
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.timer-setup-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4b5563;
    font-size: 14px;
}

.timer-input {
    width: 64px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 4px 8px;
    text-align: center;
    font-weight: 600;
    color: black;
    outline: none;
}

.timer-input:focus {
    border-color: #564ba3;
}

.timer-big-number {
    font-size: clamp(3rem, 8vw, 4.5rem); 
    font-weight: 700;
    color: #564ba3;
    letter-spacing: 1px;
    line-height: 1;
}

.timer-ms {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    color: #8c82d9;
    font-weight: 500;
}

/* Сетка для карточек секций */
.sections-grid {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 16px;
}

/* Карточки секций весов */
.section-card {
    background-color: #241a53;
    color: white;
    border-radius: 14px;
    display: flex;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    min-height: 115px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.section-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
}

/* Левые цветные плашки */
.section-badge {
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 1.5px;
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    padding: 8px 0;
    text-transform: uppercase;
}

.bg-green { background-color: #489547; }
.bg-blue { background-color: #1c75bc; }
.bg-purple { background-color: #92278f; }

.section-content {
    flex: 1;
    padding: 14px 20px;
}

.weight-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    gap: 10px;
}

.weight-block-start {
    position: relative;
    padding-top: 14px;
    display: flex;
    flex-direction: column;
}

.input-red {
    background-color: #d03d25;
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    padding: 2px 6px;
    width: 60px;
    text-align: center;
    border: none;
    outline: none;
    position: absolute;
    top: -8px;
    left: 0;
}

.weight-number {
    font-size: clamp(20px, 4vw, 26px);
    font-weight: 700;
    margin-top: 10px;
}

.weight-label {
    font-size: 10px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.weight-block-end {
    border: 1px solid #4b5563;
    border-radius: 8px;
    padding: 8px;
    background-color: #2c225b;
    text-align: center;
    width: 40%;
    max-width: 140px;
}

.input-transparent {
    background: transparent;
    color: white;
    font-weight: 700;
    text-align: center;
    width: 100%;
    border: none;
    outline: none;
    font-size: clamp(16px, 3.5vw, 20px);
}

.stats-block {
    text-align: right;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-percent {
    color: #39cb39;
    font-size: clamp(16px, 4vw, 22px);
    font-weight: 700;
}

.stat-label {
    font-size: 10px;
    color: #9ca3af;
    text-transform: uppercase;
}

/* Блок коэффициентов */
.coef-card {
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.coef-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.coef-inputs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.coef-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.coef-item label {
    font-size: 11px;
    color: #6b7280;
}

.coef-input {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    width: 100%;
}

.coef-input:focus {
    border-color: #564ba3;
}

/* Блок истории */
.history-card {
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.history-title {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-list {
    max-height: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    border-left: 4px solid #564ba3;
    gap: 10px;
    flex-wrap: wrap;
}

.history-empty {
    font-size: 13px;
    color: #9ca3af;
    text-align: center;
    padding: 14px 0;
}

/* НОВЫЙ СТИЛЬ: Плавающий подвал на всю ширину экрана */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(243, 244, 246, 0.95); /* Полупрозрачный фон, чтобы видеть контент под ним */
    backdrop-filter: blur(8px); /* Красивый эффект размытия заднего плана */
    border-top: 1px solid #e5e7eb;
    padding: 14px 16px;
    z-index: 999; /* Чтобы кнопки всегда были поверх карточек */
}

/* Центровщик для кнопок, повторяющий максимальную ширину контента */
.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 16px;
    width: 100%;
}

.btn {
    flex: 1;
    font-weight: 700;
    padding: 14px 0;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.btn:active {
    transform: scale(0.97);
}

.btn-gray {
    background-color: #e5e7eb;
    color: #374151;
}

.btn-main {
    background-color: #564ba3;
    color: white;
}

/* Скрытие стрелочек ввода чисел */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

/* Адаптивный медиа-запрос для больших экранов */
@media (min-width: 768px) {
    .sections-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .section-card {
        min-height: 140px;
    }
    
    .weight-row {
        flex-direction: column;
        align-items: center;
        justify-content: space-around;
        gap: 14px;
    }
    
    .weight-block-end {
        width: 100%;
    }
    
    .stats-block {
        text-align: center;
    }
}
