/* 
   Profile Page Styles - Стили страницы "Мои параметры"
   Файл: assets/css/main/profile-page.css
   
   НАЗНАЧЕНИЕ:
   - Стили для блоков замеров
   - Поля ввода и кнопки
   - Подсказки
*/

/* ========== КОНТЕЙНЕР СТРАНИЦЫ ========== */
.profile-page-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ========== ШАПКА СТРАНИЦЫ "МОИ ЗАМЕРЫ" ========== */
.measurements-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 20px;
    /* box-shadow: 0 8px 25px rgba(139, 92, 246, 0.10); */
    position: relative;
    overflow: hidden;
}

.dark-theme .measurements-header {
    background: rgba(30, 30, 46, 0.75);
    /* box-shadow: 0 8px 25px rgba(139, 92, 246, 0.20); */
}

/* Градиентная рамка в фиолетовой палитре страницы профиля */
.measurements-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    padding: 1px;
    background: linear-gradient(135deg, #c084fc, #a78bfa, #8b5cf6);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: subtract;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: subtract;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.dark-theme .measurements-header::before {
    opacity: 0.7;
}

.measurements-header > * {
    position: relative;
    z-index: 1;
}

.measurements-title {
    font-size: 1.8em;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.5px;
    color: #7c3aed; /* фиолетовый в стиле страницы замеров */
    text-align: center;
}

.dark-theme .measurements-title {
    color: #c4b5fd;
}

.measurements-subtitle {
    font-size: 0.95em;
    color: #64748b;
    font-weight: 500;
    margin: 8px 0 0 0;
    text-align: center;
}

.dark-theme .measurements-subtitle {
    color: #a0a0c0;
}

/* Отступ для блока с графиками */
#charts-block-container {
    margin-top: 0;
}

/* ========== БЛОК ЗАМЕРОВ ========== */
.measurement-block {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    /* box-shadow: 0 8px 25px rgba(59, 130, 246, 0.06); */
    transition: all 0.3s ease;
}

/* Уменьшаем padding когда все свернуто */
.measurement-block:has(.measurement-grid.hidden):not(:has(.info-panel:not(.hidden))) {
    padding-bottom: 20px;
}

.dark-theme .measurement-block {
    background: rgba(30, 30, 46, 0.75);
    /* box-shadow: 0 8px 25px rgba(139, 92, 246, 0.15); */
}

/* Градиентная рамка */
.measurement-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    padding: 1px;
    background: linear-gradient(135deg, #c084fc, #a78bfa, #8b5cf6);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: subtract;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: subtract;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.dark-theme .measurement-block::before {
    opacity: 0.7;
}

.measurement-block > * {
    position: relative;
    z-index: 1;
}

/* ========== ШАПКА БЛОКА С ЗАГОЛОВКОМ И КНОПКОЙ ========== */
.measurement-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    position: relative;
}

/* Когда таблица скрыта, уменьшаем отступ снизу у заголовка */
.measurement-grid.hidden + .info-panel.hidden ~ * .measurement-header,
.measurement-block:has(.measurement-grid.hidden):not(:has(.info-panel:not(.hidden))) .measurement-header {
    margin-bottom: 4px;
}

.measurement-title {
    font-size: 1.2em;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    white-space: nowrap;
}

.dark-theme .measurement-title {
    color: #ffffff;
}

/* ========== СЕТКА ПОЛЕЙ 4+3 (ГОРИЗОНТАЛЬНАЯ) ========== */
.measurement-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.measurement-grid.hidden {
    display: none;
}

.measurement-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Первые 4 поля (ОГ, ОТ, ОБ, ОШ) - по 3 колонки каждое */
.measurement-field:nth-child(1),
.measurement-field:nth-child(2),
.measurement-field:nth-child(3),
.measurement-field:nth-child(4) {
    grid-column: span 3;
}

/* Последние 3 поля (Возраст, Рост, Вес) - по 4 колонки каждое */
.measurement-field:nth-child(5),
.measurement-field:nth-child(6),
.measurement-field:nth-child(7) {
    grid-column: span 4;
}

.field-label {
    display: block;
    text-align: center;
    font-size: 0.9em;
    font-weight: 600;
    color: #64748b;
}

.dark-theme .field-label {
    color: #b3b3cc;
}


/* ========== КНОПКА ИНФОРМАЦИИ (ПРОФИЛЬ) ========== */
.profile-info-button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
    font-size: 1.2em;
    font-style: normal;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
    font-weight: 700;
}

.profile-info-button:hover {
    background: rgba(139, 92, 246, 0.2);
    transform: scale(1.1);
    /* box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); */
}

.profile-info-button:active {
    transform: scale(0.95);
    outline: none;
    border: none;
}

.profile-info-button:focus {
    outline: none;
    border: none;
}

.dark-theme .profile-info-button {
    background: rgba(255, 255, 255, 0.1);
    color: #c4b5fd;
}

.dark-theme .profile-info-button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ddd6fe;
}

/* ========== КНОПКА РАСКРЫТЬ/СВЕРНУТЬ ========== */
.toggle-table-button {
    position: absolute;
    right: 0;
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.toggle-table-button:hover {
    background: rgba(139, 92, 246, 0.2);
    transform: scale(1.05);
}

.toggle-table-button:active {
    transform: scale(0.98);
}

.dark-theme .toggle-table-button {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
}

.dark-theme .toggle-table-button:hover {
    background: rgba(139, 92, 246, 0.25);
}

/* ========== ПОЛЯ ВВОДА ========== */
.field-input {
    width: 70%;
    margin: 0 auto;
    padding: 6px 8px;
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    font-size: 0.85em;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.9);
    color: #1e293b;
    text-align: center;
    transition: all 0.3s ease;
    caret-color: #7c3aed; /* Фиолетовый курсор для светлой темы */
}

/* Убираем стрелочки у number input */
.field-input[type="number"]::-webkit-inner-spin-button,
.field-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.field-input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.dark-theme .field-input {
    background: rgba(42, 42, 62, 0.9);
    color: #ffffff;
    border-color: rgba(139, 92, 246, 0.3);
    caret-color: #c4b5fd; /* Светло-фиолетовый курсор для темной темы */
}

.field-input:focus {
    outline: none;
    border-color: #8b5cf6;
    /* box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1); */
}

.field-input::placeholder {
    color: #94a3b8;
    font-size: 0.9em;
}

.dark-theme .field-input::placeholder {
    color: #64748b;
}

/* ========== СТРОКА С ДАТОЙ И КНОПКАМИ ========== */
.measurement-actions {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-top: 16px;
}

.measurement-actions.hidden {
    display: none;
}

.date-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.date-input-wrapper .field-label {
    text-align: left;
}

.date-input {
    width: 90px !important;
    text-align: center !important;
    margin: 0 !important;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
}

.action-button {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    font-size: 0.9em;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.action-button:active {
    transform: scale(0.97);
}

.save-button {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #ffffff;
}

.save-button:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.dark-theme .save-button {
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
}

.dark-theme .save-button:hover {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.reset-button {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.reset-button:hover {
    background: rgba(139, 92, 246, 0.2);
}

.dark-theme .reset-button {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
}

.dark-theme .reset-button:hover {
    background: rgba(139, 92, 246, 0.25);
}

/* ========== ИНФОРМАЦИОННАЯ ПАНЕЛЬ ========== */
.info-panel {
    margin-top: 16px;
    padding: 16px;
    background: rgba(139, 92, 246, 0.08);
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.15);
    animation: slideDown 0.3s ease;
}

.dark-theme .info-panel {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.25);
}

.info-panel.hidden {
    display: none;
}

.info-content p {
    font-size: 0.9em;
    color: #475569;
    line-height: 1.6;
    margin: 0 0 10px 0;
}

.info-content p:last-child {
    margin-bottom: 0;
}

.dark-theme .info-content p {
    color: #cbd5e1;
}

.info-content p strong {
    color: #1e293b;
    font-weight: 700;
}

.dark-theme .info-content p strong {
    color: #ffffff;
}

.info-note {
    color: #8b5cf6 !important;
    font-weight: 600;
    margin-top: 12px !important;
    padding-top: 12px;
    border-top: 1px solid rgba(139, 92, 246, 0.2);
}

.dark-theme .info-note {
    color: #c4b5fd !important;
}

.info-close {
    font-size: 0.8em !important;
    color: #94a3b8 !important;
    font-style: italic;
    margin-top: 8px !important;
}

.dark-theme .info-close {
    color: #64748b !important;
}

.info-expand-hint {
    color: #8b5cf6 !important;
    font-weight: 600;
    padding-bottom: 12px;
    margin-bottom: 12px !important;
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.dark-theme .info-expand-hint {
    color: #c4b5fd !important;
}

.info-expand-hint.hidden {
    display: none;
}

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

/* ========== МОДАЛЬНОЕ ОКНО ПОДТВЕРЖДЕНИЯ ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 24px;
    max-width: 320px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: scaleIn 0.2s ease;
}

.dark-theme .modal-content {
    background: rgba(30, 30, 46, 0.95);
}

.modal-text {
    font-size: 1em;
    color: #1e293b;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.dark-theme .modal-text {
    color: #ffffff;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-button {
    flex: 1;
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    font-size: 0.95em;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-button:active {
    transform: scale(0.97);
}

.modal-cancel {
    background: rgba(100, 116, 139, 0.15);
    color: #64748b;
}

.modal-cancel:hover {
    background: rgba(100, 116, 139, 0.25);
}

.dark-theme .modal-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #b3b3cc;
}

.modal-confirm {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
}

.modal-confirm:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 480px) {
    .measurements-header {
        padding: 16px;
    }

    .measurements-title {
        font-size: 1.5em;
    }

    .measurement-block {
        padding: 16px;
    }

    .measurement-header {
        gap: 8px;
    }

    .measurement-title {
        font-size: 1.05em;
    }

    .measurement-grid {
        gap: 8px;
    }

    .measurement-field {
        gap: 5px;
    }

    .field-input {
        width: 85%;
        padding: 7px 9px;
        font-size: 0.85em;
    }

    .field-label {
        font-size: 0.85em;
    }

    .profile-info-button {
        width: 26px;
        height: 26px;
        font-size: 1.15em;
    }

    .measurement-actions {
        flex-wrap: wrap;
        gap: 12px;
    }

    .date-input-wrapper {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .date-input {
        width: 85px !important;
    }

    .action-buttons {
        width: 100%;
        justify-content: stretch;
    }

    .action-button {
        flex: 1;
        padding: 10px 12px;
        font-size: 0.85em;
    }
}


@media (max-width: 320px) {
    .measurements-header {
        padding: 16px;
    }

    .measurements-title {
        font-size: 1.3em;
    }

    .measurement-block {
        padding: 14px;
    }

    .measurement-title {
        font-size: 1em;
    }

    .measurement-grid {
        gap: 6px;
    }

    .measurement-field {
        gap: 4px;
    }

    .field-input {
        width: 90%;
        padding: 7px 8px;
        font-size: 0.9em;
    }

    .profile-info-button {
        width: 24px;
        height: 24px;
        font-size: 1.05em;
    }

    .measurement-actions {
        gap: 10px;
    }

    .date-input {
        width: 75px !important;
        font-size: 0.85em;
    }

    .action-button {
        padding: 9px 10px;
        font-size: 0.8em;
    }
}

/* ========== БЛОК КАЛЬКУЛЯТОРА КАЛОРИЙ ========== */
.calories-block.hidden {
    display: none;
}

.calories-calculator-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.calculator-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calculator-field .field-label {
    text-align: left;
}

/* Select стили */
.field-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-radius: 10px;
    font-size: 0.9em;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.9);
    color: #1e293b;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b5cf6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.field-select:focus {
    outline: none;
    border-color: #8b5cf6;
}

.dark-theme .field-select {
    background-color: rgba(42, 42, 62, 0.9);
    color: #ffffff;
    border-color: rgba(139, 92, 246, 0.3);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23c4b5fd' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

.dark-theme .field-select option {
    background-color: #2a2a3e;
    color: #ffffff;
}

/* Кнопка расчета */
.calculator-actions {
    margin-top: 16px;
    display: flex;
    justify-content: center;
}

.calculator-actions .action-button {
    min-width: 160px;
}

/* ========== РЕЗУЛЬТАТЫ РАСЧЕТА ========== */
.calculator-results.hidden {
    display: none;
}

.results-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.3), transparent);
    margin: 20px 0;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: rgba(139, 92, 246, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.1);
}

.dark-theme .result-item {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.2);
}

.result-item.result-target {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(124, 58, 237, 0.15));
    border-color: rgba(139, 92, 246, 0.3);
}

.dark-theme .result-item.result-target {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(124, 58, 237, 0.2));
}

.result-label {
    font-size: 0.75em;
    color: #64748b;
    text-align: center;
    margin-bottom: 4px;
}

.dark-theme .result-label {
    color: #a0a0c0;
}

.result-value {
    font-size: 1.4em;
    font-weight: 700;
    color: #1e293b;
}

.dark-theme .result-value {
    color: #ffffff;
}

.result-value-highlight {
    color: #7c3aed;
}

.dark-theme .result-value-highlight {
    color: #c4b5fd;
}

.result-unit {
    font-size: 0.7em;
    color: #94a3b8;
    margin-top: 2px;
}

.dark-theme .result-unit {
    color: #64748b;
}

/* ========== БЖУ СЕТКА ========== */
.macros-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.macro-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: rgba(139, 92, 246, 0.08);
    border-radius: 12px;
}

.dark-theme .macro-item {
    background: rgba(139, 92, 246, 0.12);
}

.macro-label {
    font-size: 0.8em;
    font-weight: 600;
    color: #8b5cf6;
    margin-bottom: 4px;
}

.dark-theme .macro-label {
    color: #c4b5fd;
}

.macro-value {
    font-size: 1em;
    font-weight: 600;
    color: #1e293b;
}

.dark-theme .macro-value {
    color: #ffffff;
}

/* ========== АДАПТИВНОСТЬ КАЛЬКУЛЯТОРА ========== */
@media (max-width: 480px) {
    .results-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .result-item {
        flex-direction: row;
        justify-content: space-between;
        padding: 10px 14px;
    }

    .result-label {
        text-align: left;
        margin-bottom: 0;
    }

    .result-value {
        font-size: 1.2em;
    }

    .result-unit {
        display: none;
    }

    .macros-grid {
        gap: 8px;
    }

    .macro-item {
        padding: 10px 6px;
    }

    .macro-label {
        font-size: 0.75em;
    }

    .macro-value {
        font-size: 0.9em;
    }
}

@media (max-width: 320px) {
    .field-select {
        font-size: 0.85em;
        padding: 8px 10px;
    }

    .calculator-actions .action-button {
        min-width: 140px;
    }
}
