/* ============================================
   ONE REP MAX CALCULATOR - CSS
   Version 1.0
============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

.orm-wrap * { box-sizing: border-box; margin: 0; padding: 0; }

.orm-wrap {
    --blue:        #0D9488;
    --darkblue:    #0F2A3D;
    --cyan:        #14B8A6;
    --amber:       #E8A33D;
    --red:         #E0554F;
    --grad:        #0D9488;
    --grad-soft:   rgba(13,148,136,0.08);
    --white:       #FFFFFF;
    --bg:          #F2F7F6;
    --card-bg:     #FFFFFF;
    --border:      rgba(13,148,136,0.14);
    --text:        #0F2A3D;
    --text-muted:  #5C7A80;
    --shadow-card: 0 32px 80px rgba(15,42,61,0.16), 0 8px 24px rgba(13,148,136,0.10);
    --shadow-btn:  0 12px 32px rgba(13,148,136,0.40);
    --radius-xl:   24px;
    --radius-lg:   16px;
    --radius-md:   12px;
    --radius-sm:   8px;
    font-family: 'Inter', sans-serif;
    position: relative;
    padding: 32px 20px 60px;
    background: var(--bg);
    min-height: 100%;
    color: var(--text);
}

.orm-blob { position: absolute; border-radius: 50%; filter: blur(70px); pointer-events: none; z-index: 0; }
.orm-blob-1 { width: 380px; height: 380px; background: rgba(13,148,136,0.13); top: -100px; left: -100px; }
.orm-blob-2 { width: 320px; height: 320px; background: rgba(15,42,61,0.08); bottom: 0; right: -100px; }

.orm-card { position: relative; z-index: 1; max-width: 860px; margin: 0 auto; }

/* ---- Header ---- */
.orm-header { background: var(--grad); border-radius: var(--radius-xl); padding: 26px 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; position: relative; overflow: hidden; box-shadow: var(--shadow-card); margin-bottom: 20px; }
.orm-header::after { content: ''; position: absolute; width: 260px; height: 260px; background: rgba(255,255,255,0.06); border-radius: 50%; top: -100px; right: -60px; }
.orm-header-left { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; }
.orm-header-icon { width: 50px; height: 50px; background: rgba(255,255,255,0.18); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.25); }
.orm-header-text h1 { color: #fff; font-size: 19px; font-weight: 800; letter-spacing: -0.4px; }
.orm-header-text p { color: rgba(255,255,255,0.78); font-size: 12px; margin-top: 4px; }
.orm-icon-btn { width: 40px; height: 40px; background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.28); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; position: relative; z-index: 1; transition: background 0.2s; }
.orm-icon-btn:hover { background: rgba(255,255,255,0.26); }

/* ---- History panel ---- */
.orm-history-panel { max-height: 0; overflow: hidden; transition: max-height 0.35s ease; background: var(--card-bg); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); }
.orm-history-panel.orm-history-open { max-height: 420px; overflow-y: auto; margin-bottom: 20px; }
.orm-history-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; font-size: 13px; font-weight: 800; color: var(--text); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--card-bg); }
.orm-history-close { background: none; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer; line-height: 1; }
.orm-history-list { padding: 14px 24px 20px; display: flex; flex-direction: column; gap: 10px; }
.orm-history-empty { font-size: 13px; color: var(--text-muted); padding: 20px 0; text-align: center; }
.orm-history-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: 12px 16px; cursor: pointer; }
.orm-history-item:hover { border-color: var(--blue); }
.orm-history-item-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.orm-history-item-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.orm-history-item-btn { border: 1.5px solid var(--border); background: var(--white); color: var(--red); font-family: 'Inter', sans-serif; font-size: 11.5px; font-weight: 700; border-radius: 7px; padding: 6px 11px; cursor: pointer; flex-shrink: 0; }

/* ---- Explainer ---- */
.orm-explainer { background: var(--card-bg); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); border: 1px solid var(--border); margin-bottom: 20px; overflow: hidden; }
.orm-explainer-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; background: var(--grad-soft); border: none; cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--text); font-family: 'Inter', sans-serif; }
.orm-explainer-toggle svg { color: var(--blue); transition: transform 0.25s ease; flex-shrink: 0; }
#orm_explainer_arrow.orm-explainer-arrow-open { transform: rotate(180deg); }
.orm-explainer-body { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; padding: 0 24px; }
.orm-explainer-body.orm-explainer-open { max-height: 420px; padding: 16px 24px; }
.orm-explainer-body p { font-size: 12.5px; color: var(--text-muted); line-height: 1.65; margin-bottom: 10px; }
.orm-explainer-body p:last-child { margin-bottom: 0; }
.orm-explainer-body strong { color: var(--text); }

/* ---- Mode tabs ---- */
.orm-mode-tabs { display: flex; gap: 8px; margin-bottom: 20px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 6px; box-shadow: var(--shadow-card); }
.orm-mode-tab { flex: 1; background: none; border: none; color: var(--text-muted); font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 700; border-radius: var(--radius-md); padding: 12px; cursor: pointer; transition: all 0.15s; }
.orm-mode-tab:hover { color: var(--blue); }
.orm-mode-tab.orm-mode-active { background: var(--grad); color: #fff; }

/* ---- Fields ---- */
.orm-mode-panel { background: var(--card-bg); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); border: 1px solid var(--border); padding: 24px 28px; margin-bottom: 20px; }
.orm-field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.orm-field { margin-bottom: 16px; }
.orm-field:last-child { margin-bottom: 0; }
.orm-field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 7px; text-transform: uppercase; letter-spacing: 0.4px; }
.orm-hint-inline { text-transform: none; font-weight: 500; opacity: 0.75; font-size: 11px; }
.orm-input, .orm-plain-input {
    width: 100%; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    padding: 11px 12px; font-family: 'Inter', sans-serif; font-size: 13.5px; font-weight: 600; color: var(--text);
    background: var(--white); outline: none; transition: border-color 0.2s;
}
.orm-input:focus, .orm-plain-input:focus { border-color: var(--blue); }

.orm-unit-input-wrap { display: flex; gap: 6px; }
.orm-unit-input-wrap .orm-plain-input { flex: 1; min-width: 0; }
.orm-unit-static { display: flex; align-items: center; padding: 0 12px; font-size: 12.5px; font-weight: 700; color: var(--text-muted); background: var(--bg); border-radius: var(--radius-sm); border: 1.5px solid var(--border); flex-shrink: 0; white-space: nowrap; }

/* ---- Segmented toggle ---- */
.orm-toggle-row { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; cursor: default; margin-bottom: 0; }
.orm-toggle-row span:first-child { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.orm-seg-toggle { display: flex; gap: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 5px; width: 100%; }
.orm-seg-btn { flex: 1; background: none; border: none; color: var(--text-muted); font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 700; border-radius: var(--radius-sm); padding: 9px 6px; cursor: pointer; }
.orm-seg-btn:hover { color: var(--blue); }
.orm-seg-btn.orm-seg-active { background: var(--grad); color: #fff; }

/* ---- Result ---- */
.orm-result { background: var(--card-bg); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); border: 1px solid var(--border); padding: 24px 28px; }
.orm-result-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.orm-result-badge { font-size: 13px; font-weight: 800; color: var(--text); }
.orm-input-recap { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.5; }
.orm-input-recap:empty { display: none; margin: 0; }

.orm-due-card { background: var(--grad); border-radius: var(--radius-lg); padding: 22px; text-align: center; margin-bottom: 16px; position: relative; overflow: hidden; }
.orm-due-card::after { content: ''; position: absolute; width: 160px; height: 160px; background: rgba(255,255,255,0.06); border-radius: 50%; top: -70px; right: -50px; }
.orm-due-label { color: rgba(255,255,255,0.8); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; position: relative; }
.orm-due-value { color: #fff; font-size: 36px; font-weight: 900; letter-spacing: -0.5px; margin: 6px 0; position: relative; word-break: break-word; }
.orm-due-sub { color: rgba(255,255,255,0.85); font-size: 12px; font-weight: 500; position: relative; }

.orm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.orm-stats:empty { display: none; margin-bottom: 0; }
.orm-stat-card { background: var(--bg); border-radius: var(--radius-md); padding: 14px; text-align: center; border: 1px solid var(--border); }
.orm-stat-icon { font-size: 16px; margin-bottom: 4px; }
.orm-stat-value { font-size: 15.5px; font-weight: 800; color: var(--text); word-break: break-word; }
.orm-stat-label { font-size: 10.5px; font-weight: 600; color: var(--text-muted); margin-top: 2px; }

/* ---- Formula radio picker ---- */
.orm-formula-radio-grid { display: flex; flex-direction: column; gap: 8px; }
.orm-formula-advanced-only { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.orm-formula-radio { display: flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer; text-transform: none; background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.orm-formula-radio:has(input:checked) { border-color: var(--blue); border-width: 2px; }
.orm-formula-radio input { accent-color: var(--blue); width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }

/* ---- Formulas comparison (Advanced) ---- */
.orm-formulas-card { background: var(--bg); border-radius: var(--radius-md); border: 1px solid var(--border); padding: 16px; margin-bottom: 14px; }
.orm-formulas-title { font-size: 12.5px; font-weight: 800; color: var(--text); margin-bottom: 12px; }
.orm-formulas-list { display: flex; flex-direction: column; gap: 8px; }
.orm-formula-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; }
.orm-formula-row.orm-formula-active { border-color: var(--blue); background: var(--grad-soft); }
.orm-formula-name { font-size: 12.5px; font-weight: 700; color: var(--text); }
.orm-formula-value { font-size: 14px; font-weight: 800; color: var(--blue); white-space: nowrap; }

/* ---- Estimated max reps chart ---- */
.orm-chart-card { background: var(--bg); border-radius: var(--radius-md); border: 1px solid var(--border); padding: 16px; margin-bottom: 14px; }
.orm-chart-title { font-size: 12.5px; font-weight: 800; color: var(--text); margin-bottom: 14px; }
.orm-chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 10px; }
.orm-chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.orm-chart-bar-wrap { flex: 1; display: flex; align-items: flex-end; width: 100%; justify-content: center; }
.orm-chart-bar { width: 60%; min-width: 6px; background: var(--grad); border-radius: 3px 3px 0 0; transition: height 0.3s ease; }
.orm-chart-label { font-size: 9px; font-weight: 700; color: var(--text-muted); margin-top: 6px; white-space: nowrap; }

/* ---- Dual tables (reps + percentages side by side) ---- */
.orm-dual-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.orm-dual-tables .orm-breakdown-card { margin-bottom: 0; }

.orm-breakdown-card { background: var(--bg); border-radius: var(--radius-md); border: 1px solid var(--border); padding: 16px; margin-bottom: 14px; }
.orm-breakdown-title { font-size: 12.5px; font-weight: 800; color: var(--text); margin-bottom: 10px; }
.orm-table-wrap { overflow-x: auto; }
.orm-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.orm-table th { text-align: left; font-weight: 700; color: var(--text-muted); padding: 6px 8px; border-bottom: 1.5px solid var(--border); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; }
.orm-table td { padding: 8px; border-bottom: 1px solid var(--border); color: var(--text); font-weight: 600; white-space: nowrap; }
.orm-table tr:last-child td { border-bottom: none; }
.orm-table tr.orm-table-current td { background: var(--grad-soft); font-weight: 800; color: var(--blue); }

.orm-actions-row { margin-bottom: 10px; }
.orm-save-btn { width: 100%; background: var(--grad); color: #fff; border: none; font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 800; border-radius: var(--radius-md); padding: 14px; cursor: pointer; box-shadow: var(--shadow-btn); }
.orm-export-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.orm-export-btn { background: var(--white); border: 1.5px solid var(--border); color: var(--text); font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 700; border-radius: var(--radius-sm); padding: 11px 6px; cursor: pointer; }
.orm-export-btn:hover { border-color: var(--blue); color: var(--blue); }

.orm-footer-note { font-size: 10.5px; color: var(--text-muted); text-align: center; line-height: 1.5; }

/* ---- Responsive ---- */
@media (max-width: 780px) {
    .orm-field-grid { grid-template-columns: 1fr; }
    .orm-stats { grid-template-columns: 1fr 1fr; }
    .orm-seg-toggle { flex-direction: column; }
    .orm-dual-tables { grid-template-columns: 1fr; }
}
