/* Base colors */
:root {
    --hmt-primary: #0071e3;
    --hmt-primary-hover: #0077ED;
    --hmt-light-blue: #f5f9fc;
    --hmt-border: #e2e8f0;
}

/* User stats styles */
.hmt-user-stats {
    background: var(--hmt-light-blue);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.hmt-user-stats h3 {
    margin: 0 0 0.5rem 0;
    color: var(--hmt-primary);
    font-size: 1.25rem;
}

.hmt-user-stats p {
    margin: 0;
    font-size: 1.1rem;
    color: #374151;
}

/* Form styles */
.hmt-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Modal styles */
.hmt-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.hmt-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.hmt-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    animation: hmt-modal-enter 0.2s ease-out;
}

@media (max-width: 640px) {
    .hmt-modal-content {
        max-width: 100%;
        width: calc(100% - 2rem);
        margin: auto;
    }
}

@keyframes hmt-modal-enter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.hmt-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

@media (max-width: 640px) {
    .hmt-modal-header {
        padding: 1rem 1.25rem;
    }
}

.hmt-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

@media (max-width: 640px) {
    .hmt-modal-header h3 {
        font-size: 1.125rem;
    }
}

.hmt-modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.hmt-modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.hmt-modal-body {
    padding: 1.5rem;
}

@media (max-width: 640px) {
    .hmt-modal-body {
        padding: 1.25rem;
    }
}

.hmt-modal-date {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0 0 1rem 0;
    font-weight: 500;
}

.hmt-modal-field {
    margin-bottom: 1rem;
}

.hmt-modal-field label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.hmt-modal-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hmt-modal-input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    min-height: 44px;
}

@media (max-width: 640px) {
    .hmt-modal-input {
        font-size: 16px;
        padding: 0.75rem 1rem;
    }
}

.hmt-modal-input:focus {
    outline: none;
    border-color: var(--hmt-primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.hmt-modal-unit {
    font-weight: 600;
    color: #6b7280;
    font-size: 0.875rem;
    min-width: 30px;
}

.hmt-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .hmt-modal-footer {
        padding: 1rem 1.25rem;
        flex-direction: column;
        align-items: stretch;
    }
}

.hmt-modal-actions {
    display: flex;
    gap: 0.75rem;
}

@media (max-width: 640px) {
    .hmt-modal-actions {
        width: 100%;
        flex-direction: column;
    }
}

.hmt-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .hmt-btn {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
}

.hmt-btn-primary {
    background: var(--hmt-primary);
    color: white;
}

.hmt-btn-primary:hover {
    background: var(--hmt-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.hmt-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.hmt-btn-secondary:hover {
    background: #e5e7eb;
}

.hmt-btn-danger {
    background: #fee2e2;
    color: #dc2626;
}

.hmt-btn-danger:hover {
    background: #fecaca;
}

.hmt-btn-icon {
    font-size: 1rem;
}

/* Profile form layout */
.hmt-profile { margin-top: 1.5rem; }
.hmt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 1.5rem;
    margin-bottom: 1rem;
}
.hmt-field { display: flex; flex-direction: column; gap: 0.4rem; }
.hmt-label { font-weight: 500; color: #111827; }
.hmt-checkbox label { display: flex; align-items: center; gap: 0.5rem; color: #374151; }
.hmt-actions { display: flex; align-items: center; gap: 1rem; margin-top: 0.75rem; }
.hmt-profile-message { min-height: 1.25rem; }

.hmt-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--hmt-border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
}

.hmt-input:focus {
    outline: none;
    border-color: var(--hmt-primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

/* Value input with unit */
.hmt-input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.hmt-value-input {
    font-size: 1.25rem;
    font-weight: 600;
    padding-right: 3rem;
    text-align: center;
    background-color: #fff;
    border: 2px solid var(--hmt-border);
}

.hmt-value-input:focus {
    border-color: var(--hmt-primary);
    background-color: #f0f7ff;
}

.hmt-value-input::placeholder {
    color: #cbd5e1;
    font-weight: 400;
}

.hmt-input-unit {
    position: absolute;
    right: 1rem;
    color: #64748b;
    font-weight: 500;
    font-size: 0.9rem;
    pointer-events: none;
}

.hmt-button {
    background: var(--hmt-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.hmt-button:hover {
    background: var(--hmt-primary-hover);
    transform: translateY(-1px);
}

.hmt-button:active {
    transform: translateY(0);
}

/* Add to existing CSS */
.hmt-chart-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.hmt-period-selector {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid var(--hmt-border);
    border-radius: 8px;
    background-color: #f8fafc;
    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='%2364748b' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
}

.hmt-period-selector:hover {
    border-color: #cbd5e1;
    background-color: #f1f5f9;
}

.hmt-period-selector:focus {
    outline: none;
    border-color: var(--hmt-primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

/* BMI meter styles */
.bmi-meter-container {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 12px;
}

.bmi-meter {
    position: relative;
    height: 60px;
    background: #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.bmi-gradient {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right,
        #3b82f6 0%,      /* blue for underweight */
        #3b82f6 13.2%,   /* blue until 18.5 */
        #22c55e 13.2%,   /* green at 18.5 */
        #22c55e 47.4%,   /* green until 25 */
        #fbbf24 47.4%,   /* yellow at 25 */
        #f59e0b 63.2%,   /* darker yellow */
        #ea580c 73.7%,   /* orange */
        #dc2626 100%     /* red */
    );
    opacity: 0.3;
}

.bmi-scale {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: flex-end;
    padding: 0.5rem;
}

.scale-marker {
    position: absolute;
    bottom: 0;
    transform: translateX(-50%);
    text-align: center;
}

.scale-marker span {
    display: block;
    font-size: 0.75rem;
    color: #475569;
    margin-bottom: 0.25rem;
}

.scale-marker::before {
    content: '';
    display: block;
    width: 2px;
    height: 10px;
    background: #475569;
    margin: 0 auto;
}

.scale-marker.underweight { left: 0%; }
.scale-marker.normal-start { left: 13.2%; }
.scale-marker.normal-end { left: 47.4%; }
.scale-marker.overweight { left: 73.7%; }
.scale-marker.obese { left: 100%; }

.bmi-pointer {
    position: absolute;
    top: 0;
    width: 3px;
    height: 100%;
    background: #1e293b;
    transition: left 0.3s ease;
}

.bmi-text {
    text-align: center;
    font-weight: 500;
    padding: 0.5rem;
    border-radius: 20px;
    color: white;
    background-color: #475569;
}

.bmi-text.underweight { background-color: #3b82f6; }
.bmi-text.normal { background-color: #22c55e; }
.bmi-text.slightly-overweight { background-color: #fbbf24; }
.bmi-text.moderately-overweight { background-color: #f59e0b; }
.bmi-text.very-overweight { background-color: #ea580c; }
.bmi-text.severely-overweight { background-color: #dc2626; }

.bmi-range-info {
    margin-top: 1rem;
    text-align: center;
    color: #475569;
    font-size: 0.95rem;
    padding: 0.75rem;
    background: #f1f5f9;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.bmi-range-info div {
    margin-bottom: 0.5rem;
}

.bmi-range-info div:last-child {
    margin-bottom: 0;
}

/* Message styles */
.hmt-message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    font-weight: 500;
}

.hmt-message-success {
    background-color: #dcfce7;
    color: #166534;
}

.hmt-message-error {
    background-color: #fee2e2;
    color: #991b1b;
}

.hmt-message-info {
    background-color: var(--hmt-light-blue);
    color: var(--hmt-primary);
}

/* Chart container */
.hmt-chart-container {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin: 1.5rem 0;
}

/* Chart Period Row */
.hmt-chart-period-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

/* Chart Tabs - Modern Underline Style */
.hmt-chart-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0;
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.hmt-chart-tabs::-webkit-scrollbar {
    display: none;
}

.hmt-chart-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    background: none;
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.hmt-chart-tab:hover {
    color: var(--hmt-primary);
}

.hmt-chart-tab.is-active {
    color: var(--hmt-primary);
    border-bottom-color: var(--hmt-primary);
    font-weight: 600;
}

.hmt-tab-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.hmt-tab-label {
    font-weight: inherit;
}

/* Chart wrapper */
.hmt-chart-wrapper {
    position: relative;
    min-height: 250px;
}

/* Empty state */
.hmt-chart-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #9ca3af;
    text-align: center;
    padding: 2rem;
}

.hmt-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.hmt-chart-empty-state p {
    margin: 0;
    font-size: 1rem;
}

/* Responsive chart */
@media (max-width: 600px) {
    .hmt-chart-period-row {
        justify-content: center;
        margin-bottom: 0.5rem;
    }
    
    .hmt-period-selector {
        width: 100%;
        text-align: center;
    }
    
    .hmt-chart-tabs {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hmt-chart-tab {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .hmt-tab-icon {
        font-size: 1rem;
    }
    
    .hmt-tab-label {
        display: none;
    }
    
    .hmt-chart-wrapper {
        min-height: 220px;
    }
}

/* Make chart canvas fill container */
.hmt-chart {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Responsive tweaks */
@media (max-width: 768px) {
    .hmt-chart-container { padding: 14px; }
}

@media (max-width: 480px) {
    .hmt-chart-container { padding: 12px; }
}

.hmt-delete-measurement {
    display: block;
    width: 100%;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 4px;
    pointer-events: auto;
}

.hmt-delete-measurement:hover {
    background-color: #c82333;
}

/* Streak Card Styles */
.hmt-streak-card {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border: 1px solid #fed7aa;
}

.hmt-streak-fire {
    font-size: 1.2em;
    margin-right: 0.25rem;
}

.hmt-stat-sub {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.hmt-text-success {
    color: #16a34a !important;
    font-weight: 600;
}

/* Trend Stats Styles */
.hmt-trend-stats {
    margin-top: 1rem;
}

.hmt-trend-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.hmt-trend-value {
    font-size: 1.25rem !important;
}

.hmt-trend-value.is-down {
    color: #16a34a;
}

.hmt-trend-value.is-up {
    color: #dc2626;
}

.hmt-trend-arrow {
    font-size: 1.1em;
    margin-right: 0.25rem;
}

/* Goal Section Styles */
.hmt-goal-section {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.hmt-goal-empty {
    text-align: center;
    padding: 1rem;
}

.hmt-goal-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.hmt-goal-empty p {
    color: #6b7280;
    margin: 0.5rem 0 1rem;
}

.hmt-goal-display {
    padding: 0.5rem 0;
}

.hmt-goal-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.hmt-goal-header .hmt-goal-icon {
    font-size: 1.5rem;
    margin-bottom: 0;
}

.hmt-goal-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #111827;
    flex: 1;
}

.hmt-goal-edit-btn {
    background: none;
    border: none;
    color: var(--hmt-primary);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}

.hmt-goal-edit-btn:hover {
    text-decoration: underline;
}

.hmt-goal-progress {
    text-align: center;
}

.hmt-goal-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.hmt-goal-current {
    color: #6b7280;
}

.hmt-goal-arrow {
    color: #9ca3af;
}

.hmt-goal-target {
    color: var(--hmt-primary);
    font-weight: 600;
}

.hmt-goal-remaining {
    font-size: 1rem;
    color: #374151;
    font-weight: 500;
}

.hmt-goal-estimate {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.hmt-goal-reached {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-radius: 8px;
    color: #166534;
    font-weight: 600;
}

.hmt-goal-celebration {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.hmt-goal-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.hmt-goal-input {
    font-size: 1.25rem;
    padding: 0.875rem 1rem;
    text-align: center;
    font-weight: 500;
}

.hmt-goal-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    justify-content: center;
}

.hmt-goal-buttons .hmt-button {
    flex: 1;
    max-width: 150px;
}

.hmt-goal-actions {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    padding-bottom: 0;
}

.hmt-button-secondary {
    background: #e5e7eb;
    color: #374151;
}

.hmt-button-secondary:hover {
    background: #d1d5db;
}

/* Form column helpers */
.hmt-form-col-8 {
    flex: 2;
}

.hmt-form-col-4 {
    flex: 1;
}

/* Responsive adjustments for new elements */
@media (max-width: 768px) {
    .hmt-trend-stats {
        flex-wrap: wrap;
    }
    
    .hmt-trend-card {
        min-width: calc(50% - 0.5rem);
    }
    
    .hmt-goal-numbers {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .hmt-goal-form .hmt-form-row {
        flex-direction: column;
    }
    
    .hmt-goal-actions {
        flex-direction: row;
        justify-content: flex-start;
        margin-top: 0.5rem;
    }
}