/* * Módulo de Medidas - Apple Design System v5.2 (iPhone Fix)
 * Estilos Blindados contra Temas WordPress
 */

:root {
    --ios-blue: #007AFF;
    --ios-green: #34C759;
    --ios-red: #FF3B30;
    --ios-orange: #FF9500;
    --ios-gray: #8E8E93;
    --ios-gray-light: #F2F2F7;
    --ios-card-bg: #FFFFFF;
    --ios-input-bg: #E5E5EA;
    --card-radius: 20px;
    --btn-radius: 14px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.12);
    --font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

.spt-ios-wrapper {
    font-family: var(--font-stack);
    background-color: var(--ios-gray-light);
    color: #1C1C1E;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 20px 120px 20px;
    box-sizing: border-box;
    min-height: 100vh;
}
.spt-ios-wrapper * { box-sizing: border-box; }

/* HEADER */
.spt-ios-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 25px; padding-top: 10px;
}
.spt-ios-header .subtitle {
    font-size: 13px; font-weight: 600; text-transform: uppercase; color: var(--ios-gray);
}
.spt-ios-header h1 {
    font-size: 28px; font-weight: 800; margin: 2px 0 0 0; color: #000;
}
.header-avatar img {
    width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
    border: 2px solid #fff; box-shadow: var(--shadow-sm);
}

/* BENTO GRID */
.spt-bento-grid {
    display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; margin-bottom: 20px;
}
.spt-ios-card {
    background: var(--ios-card-bg); border-radius: var(--card-radius); padding: 16px;
    box-shadow: var(--shadow-sm); display: flex; flex-direction: column; justify-content: space-between;
}
.highlight-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%); border: 1px solid rgba(0,0,0,0.02);
}
.card-header-icon { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.card-header-icon .icon-bg { font-size: 14px; }
.spt-ios-card .label {
    font-size: 11px; font-weight: 700; color: var(--ios-gray); text-transform: uppercase;
}
.value-group { display: flex; align-items: baseline; gap: 2px; }
.big-value { font-size: 26px; font-weight: 800; letter-spacing: -1px; color: #000; }
.mid-value { font-size: 20px; font-weight: 700; color: #000; margin-top: 4px; display: block; }
.unit { font-size: 13px; font-weight: 500; color: var(--ios-gray); }

/* TRENDS */
.trend-indicator {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px;
    border-radius: 12px; font-size: 11px; font-weight: 700; margin-top: 6px;
}
.trend-down { background-color: rgba(52, 199, 89, 0.15); color: #248a3d; }
.trend-up { background-color: rgba(255, 59, 48, 0.15); color: #d70015; }
.spt-badge {
    display: inline-block; padding: 4px 8px; border-radius: 6px;
    font-size: 10px; font-weight: 700; text-transform: uppercase; margin-top: 5px;
}
.spt-badge.gray { background: #F2F2F7; color: var(--ios-gray); }
.spt-badge.green { background: rgba(52, 199, 89, 0.2); color: #248a3d; }
.spt-badge.yellow { background: rgba(255, 149, 0, 0.2); color: #b25000; }
.spt-badge.red { background: rgba(255, 59, 48, 0.2); color: #d70015; }

/* --- METAS (GOALS) - CORREÇÃO NUCLEAR --- */
.goal-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 15px; 
    width: 100%;
}
.goal-title-wrapper { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}
.goal-icon {
    background: var(--ios-orange); 
    color: white; 
    border-radius: 50%;
    width: 28px; 
    height: 28px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 16px;
    flex-shrink: 0;
}
.goal-header h3 { 
    margin: 0; 
    font-size: 17px; 
    font-weight: 700; 
    color: #000;
}

/* Reset total no botão para remover estilo do tema */
.btn-text-action {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--ios-blue) !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    cursor: pointer;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    line-height: normal !important;
    -webkit-appearance: none;
    appearance: none;
    text-transform: none !important;
}
.btn-text-action:hover { opacity: 0.7; background: transparent !important; }

.goal-stats-row {
    display: flex; 
    justify-content: space-between; 
    font-size: 14px; 
    color: var(--ios-gray); 
    margin-bottom: 10px;
    font-weight: 500;
}
.goal-stats-row b { 
    color: #000; 
    font-weight: 700;
}
.spt-progress-container {
    height: 12px; 
    background: #E5E5EA; 
    border-radius: 10px; 
    overflow: hidden; 
    position: relative;
    width: 100%;
}
#goal-progress-bar {
    width: 0%; 
    height: 100%; 
    background: linear-gradient(90deg, var(--ios-orange), #FF3B30);
    transition: width 1s ease; 
    border-radius: 10px;
}
#goal-status-text {
    font-size: 13px; 
    color: var(--ios-gray); 
    margin-top: 10px; 
    text-align: center;
    font-weight: 500;
}
.goal-edit-row { 
    align-items: flex-end; 
    gap: 10px; 
    margin-top: 10px; 
}
.btn-small { 
    padding: 10px 20px !important; 
    font-size: 14px !important; 
    margin: 0 !important;
    height: 44px !important; /* Altura touch friendly */
}

/* CHARTS */
.chart-section { padding: 20px; min-height: 320px; display: flex; flex-direction: column; }
.chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.chart-header h3 { font-size: 18px; font-weight: 700; margin: 0; }
.spt-segmented-control { background-color: #EEEEEF; border-radius: 9px; padding: 2px; display: flex; }
.seg-btn {
    border: none; background: transparent; padding: 6px 12px; font-size: 12px;
    font-weight: 500; border-radius: 7px; cursor: pointer; color: #000; transition: all 0.2s ease;
}
.seg-btn.active { background-color: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.1); font-weight: 600; }
.chart-wrapper { flex-grow: 1; position: relative; width: 100%; height: 200px; }
.chart-filters {
    display: flex; justify-content: center; gap: 10px; margin-top: 20px; padding-top: 15px; border-top: 1px solid #F2F2F7;
}
.filter-btn {
    border: none; background: transparent; color: var(--ios-gray); font-size: 12px;
    font-weight: 600; padding: 6px 14px; border-radius: 15px; cursor: pointer;
}
.filter-btn.active { background-color: var(--ios-blue); color: #fff; }

/* HISTÓRICO */
.spt-history-section { margin-top: 25px; margin-bottom: 90px; }
.section-title {
    font-size: 13px; font-weight: 600; text-transform: uppercase; color: var(--ios-gray); margin-bottom: 8px; margin-left: 16px;
}
.spt-ios-list {
    background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); margin: 0 4px;
}
.history-month-header {
    background-color: #F2F2F7; color: #8E8E93; font-size: 13px; font-weight: 600; text-transform: uppercase;
    padding: 8px 16px; border-bottom: 1px solid #E5E5EA; position: sticky; top: 0;
}
.history-item { border-bottom: 1px solid #E5E5EA; transition: background 0.2s; }
.history-item:last-child { border-bottom: none; }
.history-header {
    padding: 16px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; background: #fff;
}
.history-header:active { background: #F2F2F7; }
.date-main { font-size: 16px; font-weight: 500; color: #000; }
.date-sub { font-size: 12px; color: var(--ios-gray); margin-top: 2px; }
.history-summary { display: flex; align-items: center; gap: 10px; }
.summary-value { font-size: 16px; font-weight: 600; color: #000; min-width: 60px; text-align: right; }
.summary-value.empty { color: var(--ios-gray); font-weight: 400; font-size: 14px; }
.summary-chevron { color: #C7C7CC; font-size: 12px; transition: transform 0.3s ease; }
.history-details { background: #F9F9F9; max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; }
.history-item.open .history-details { max-height: 600px; border-top: 1px solid #E5E5EA; padding: 15px; }
.history-item.open .summary-chevron { transform: rotate(180deg); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed #E5E5EA; }
.detail-row span:first-child { color: var(--ios-gray); }
.detail-row span:last-child { font-weight: 600; color: #000; }
.form-label-small { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--ios-gray); margin: 8px 0 4px 0; }
.load-more-container { padding: 15px; text-align: center; border-top: 1px solid #E5E5EA; }
.btn-load-more { background: transparent; border: none; color: var(--ios-blue); font-size: 15px; font-weight: 600; cursor: pointer; padding: 10px 20px; }

/* MODAL FIX */
.spt-ios-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(5px);
    z-index: 9999; display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 600px) {
    .spt-ios-modal-overlay { align-items: center; }
    .spt-ios-modal-content { border-radius: 20px !important; }
}
.spt-ios-modal-content {
    background: #fff; width: 100%; max-width: 600px;
    border-radius: 20px 20px 0 0; padding: 25px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.2); position: relative; 
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.modal-header h3 { margin: 0; font-size: 20px; font-weight: 700; }
.close-btn {
    background: #F2F2F7; border: none; width: 32px; height: 32px;
    border-radius: 50%; font-size: 20px; color: var(--ios-gray);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* FORM ELEMENTS */
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--ios-gray); margin-bottom: 8px; margin-left: 4px; }
input[type="date"], input[type="number"], textarea {
    width: 100%; background: var(--ios-input-bg); border: none; border-radius: 12px;
    padding: 14px; font-size: 17px; font-family: inherit; color: #000; outline: none; appearance: none;
}
input:focus, textarea:focus { background: #e0e0e6; }
.form-row { display: flex; gap: 15px; margin-bottom: 15px; }
.form-row .form-group { flex: 1; }
.spt-accordion { margin-top: 10px; border-top: 1px solid #F2F2F7; padding-top: 15px; }
.accordion-trigger {
    width: 100%; background: none; border: none; display: flex; justify-content: space-between;
    align-items: center; color: var(--ios-blue); font-size: 15px; font-weight: 600; padding: 10px 0; cursor: pointer;
}
.accordion-content { margin-top: 10px; padding-bottom: 20px; }
.form-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; color: #000; margin: 15px 0 10px 0; }
.modal-footer { margin-top: 10px; }

/* FAB & BTNS */
.spt-fab-container { margin-top: 30px; position: sticky; bottom: 90px; z-index: 10; }
.spt-ios-btn-primary {
    background-color: var(--ios-blue) !important; color: #fff !important; border: none !important; padding: 16px !important;
    border-radius: var(--btn-radius) !important; font-size: 17px !important; font-weight: 600 !important;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: transform 0.1s, background-color 0.2s;
    text-transform: none !important; margin: 0; box-shadow: none;
}
.spt-ios-btn-primary:active { transform: scale(0.98); background-color: #0062cc !important; }
.spt-ios-btn-primary.shadow-lg { box-shadow: 0 8px 20px rgba(0, 122, 255, 0.3) !important; }
.full-width { width: 100%; }

/* NAV */
.spt-app-nav {
    position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px); border-top: 1px solid rgba(0,0,0,0.1); height: 80px;
    display: flex; justify-content: space-around; align-items: center; padding-bottom: 15px; z-index: 1000;
}
.nav-item { text-decoration: none; color: var(--ios-gray); font-size: 10px; display: flex; flex-direction: column; align-items: center; }
.nav-item.active { color: var(--ios-blue); }

/* TOAST */
.spt-ios-toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px);
    background: rgba(0,0,0,0.8); color: #fff; padding: 12px 24px; border-radius: 50px;
    font-size: 14px; font-weight: 600; z-index: 10000; opacity: 0; transition: all 0.4s;
}
.spt-ios-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.spt-ios-toast.success { background: #34C759; }
.spt-ios-toast.error { background: #FF3B30; }