/* Weight Tracking
 * Dashboard weight card, entry modal, trends page, trends modal,
 * collapsible card, mobile responsive.
 */
/* ============== WEIGHT TRACKING STYLES ============== */

.weight-tracking-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.weight-tracking-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.weight-tracking-card .card-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.weight-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.current-weight {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.weight-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.weight-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.weight-change {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.weight-change.increase {
    color: #dc3545;
}

.weight-change.decrease {
    color: #28a745;
}

.weight-change.neutral {
    color: var(--text-secondary);
}

.total-change {
    margin-bottom: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.total-change small {
    color: var(--text-secondary);
}

.goal-progress {
    margin-bottom: 1rem;
}

.goal-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.goal-info small {
    color: var(--text-secondary);
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

/* Weight Entry Modal */
.weight-input-container {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

#weightEntryModal .weight-input-container input {
    flex: 1 1 0;
    min-width: 0;
    width: 0;
}

#weightEntryModal .weight-input-container select {
    flex: 0 0 auto;
    width: auto !important;
    min-width: 70px;
    max-width: 80px;
}

#weightEntryModal .form-group input,
#weightEntryModal .form-group select,
#weightEntryModal .form-group textarea {
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    min-height: 48px;
    box-sizing: border-box;
    background: var(--card-background, white);
}

#weightEntryModal .form-group input:focus,
#weightEntryModal .form-group select:focus,
#weightEntryModal .form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

@media (max-width: 768px) {
    #weightEntryModal .form-group input,
    #weightEntryModal .form-group select,
    #weightEntryModal .form-group textarea {
        font-size: 16px; /* Prevent iOS zoom */
        min-height: 50px;
        padding: 1rem 1.25rem;
        border-radius: 12px;
    }

    #weightEntryModal .weight-input-container {
        gap: 0.75rem;
    }

    #weightEntryModal .weight-input-container select {
        max-width: 85px;
    }
}

#weightNotes {
    min-height: 80px;
    resize: vertical;
}

/* Weight Trends Page */
.weight-trends-container {
    padding: 1.5rem;
}

.weight-trends-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.weight-chart-container {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.weight-chart {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
}

.weight-entries-list {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.weight-entry-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.weight-entry-item:last-child {
    border-bottom: none;
}

.weight-entry-item:hover {
    background: rgba(99, 102, 241, 0.05);
}

.weight-entry-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.weight-entry-value {
    font-weight: 600;
    color: var(--text-primary);
}

.weight-entry-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.weight-entry-notes {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 0.25rem;
}

.weight-entry-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-icon.btn-danger:hover {
    background: #dc3545;
    color: white;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .weight-tracking-card {
        padding: 1rem;
    }
    
    .weight-tracking-card .card-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .weight-stats {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .weight-trends-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .weight-entry-item {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        text-align: center;
    }
    
    .weight-entry-actions {
        justify-content: center;
    }
    
    .card-actions {
        justify-content: center;
    }
}

/* Collapsible Weight Tracking Styles */
.collapsible-card {
    margin-bottom: 2rem;
}

.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background-color 0.2s;
}

.collapsible-header:hover {
    background-color: #f8f9fa;
}

.header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.weight-summary {
    font-size: 0.9rem;
    color: #666;
    font-weight: normal;
}

.collapse-icon {
    font-size: 1.2rem;
    color: #667eea;
    transition: transform 0.2s;
}

.collapsible-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Weight Trends Modal Styles */
.weight-trends-modal .modal-content {
    max-width: 900px;
    width: 90vw;
    max-height: 90vh;
}

.trends-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.5rem;
}

.trends-tabs .tab-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    font-weight: 500;
}

.trends-tabs .tab-btn.active {
    background: #667eea;
    color: white;
}

.trends-tabs .tab-btn:hover:not(.active) {
    background: #f0f0f0;
}

.trends-content {
    position: relative;
}

.trends-content .tab-content {
    display: none;
}

.trends-content .tab-content.active {
    display: block;
}

.chart-container {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.chart-container canvas {
    max-width: 100%;
    height: auto;
}

.trend-stats {
    margin-top: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
}

.stat-value.increase {
    color: #dc3545;
}

.stat-value.decrease {
    color: #28a745;
}

.weight-history {
    max-height: 400px;
    overflow-y: auto;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.entry-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.entry-weight {
    font-weight: bold;
    font-size: 1.1rem;
    color: #333;
}

.entry-date {
    font-size: 0.9rem;
    color: #666;
}

.entry-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.entry-notes {
    color: #667eea;
    font-size: 1.1rem;
    cursor: help;
}

/* Weight Trends Modal Overrides */
.weight-trends-modal .trend-filters {
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 8px;
}

.weight-trends-modal .trend-stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.weight-trends-modal .chart-container canvas {
    display: block;
    max-width: 100%;
}

.weight-trends-modal .modal-header > div {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .weight-trends-modal .trend-stat-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    .weight-trends-modal .trend-stat {
        padding: 0.5rem;
    }
    .weight-trends-modal .trend-stat value {
        font-size: 1.1rem;
    }
}

.dashboard-weight-section {
    margin-top: 2rem;
}

/* Mobile responsiveness for weight tracking */
@media (max-width: 768px) {
    .header-right {
        gap: 0.5rem;
    }
    
    .weight-summary {
        font-size: 0.8rem;
    }
    
    .weight-trends-modal .modal-content {
        width: 95vw;
        margin: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.5rem;
    }
    
    .stat-item {
        padding: 0.75rem;
    }
    
    .history-entry {
        padding: 0.75rem;
    }
    
    .entry-actions {
        gap: 0.25rem;
    }
    
    .chart-container {
        padding: 0.75rem;
    }
}

