/**
 * Beregnere (calc.html)
 */
body.portal-calc{--primary-color: #2c3e50;
--secondary-color: #3498db;
--accent-color: #e74c3c;
--marathon-color: #9b59b6;
--extra-day-color: #2ecc71;
--light-color: #ecf0f1;
--dark-color: #2c3e50;
--success-color: #27ae60;
--warning-color: #f39c12;
--border-radius: 8px;
--box-shadow: 0 4px 6px rgba(0,0,0,0.1);
--gradient: linear-gradient(to right, var(--primary-color), var(--secondary-color));}

body.portal-calc, body.portal-calc *{box-sizing:border-box;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;}

body.portal-calc{height:100%;
margin:0;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f8f9fa;
color: #333;
line-height: 1.6;
overflow-x: hidden;}

body.portal-calc header{background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
color: white;
padding: 1.5rem 1rem;
padding-top: max(1.5rem, calc(0.65rem + env(safe-area-inset-top)));
padding-right: max(1rem, calc(0.65rem + env(safe-area-inset-right)));
text-align: center;
border-bottom: 5px solid var(--accent-color);
margin-bottom: 1.5rem;}

body.portal-calc header:has(.theme-toggle--header) .container {
padding-right: 5.25rem;
}

body.portal-calc header h1{font-size: 1.8rem;
margin-bottom: 0.5rem;
color: white;}

body.portal-calc .subtitle{font-size: 1rem;
opacity: 0.9;
margin-bottom: 0.5rem;}

body.portal-calc .container{max-width: 1200px;
margin: 0 auto;
padding: 0 1rem;}

body.portal-calc .app{max-width:500px;
margin:28px auto;
padding:24px;
border-radius:24px;
background: white;
box-shadow: var(--box-shadow);
border:1px solid #e2e8f0;
position: relative;
overflow: hidden;}

@media (min-width: 768px) {
body.portal-calc .app{
max-width: 1000px;
width: 90%;
margin: 40px auto;
padding: 30px;
}

body.portal-calc header{
margin-bottom: 2rem;
padding: 1.5rem;
}

body.portal-calc header h1{
font-size: 2.5rem;
}

body.portal-calc .calculator-inputs{
grid-template-columns: 1fr 1fr;
}

body.portal-calc .tabs{
margin-bottom: 30px;
}

body.portal-calc .calculator-grid{
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 20px;
margin-bottom: 20px;
}

body.portal-calc .card{
margin-bottom: 0;
height: 100%;
}

body.portal-calc .card.large{
grid-column: span 2;
}

body.portal-calc .results-section{
grid-column: span 2;
margin-top: 30px;
}

/* Statistics tab desktop layout - UPDATED to 2 columns */
body.portal-calc .statistics-grid{
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 20px;
}

body.portal-calc .statistics-grid .card{
margin-bottom: 0;
}

body.portal-calc .kadence-section{
grid-column: span 2;
margin-top: 30px;
}

body.portal-calc .efficiency-section{
grid-column: span 2;
margin-top: 30px;
}

/* Training tab desktop layout - UPDATED to 2 columns */
body.portal-calc .training-grid{
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 20px;
}

body.portal-calc .training-grid .card{
margin-bottom: 0;
}

body.portal-calc .zones-section{
grid-column: span 2;
margin-top: 30px;
}

/* Wider inputs and buttons on desktop */
body.portal-calc .row{
gap: 16px;
}

body.portal-calc .controls{
gap: 16px;
}

body.portal-calc .btn{
padding: 16px 24px;
}

/* Wider results */
body.portal-calc .results-grid{
grid-template-columns: repeat(4, 1fr);
gap: 16px;
}

body.portal-calc .stats-grid{
grid-template-columns: repeat(3, 1fr);
gap: 16px;
}

body.portal-calc .kadence-grid{
grid-template-columns: repeat(4, 1fr);
gap: 16px;
}

body.portal-calc .pulse-inputs{
grid-template-columns: repeat(4, 1fr);
gap: 16px;
}

/* Better zone display on desktop */
body.portal-calc .zone-card{
margin-bottom: 15px;
}

body.portal-calc .zone-card:last-child{
margin-bottom: 0;
}

/* Make tabs more prominent */
body.portal-calc .tab{
padding: 14px 24px;
font-size: 16px;
}

/* Wider inputs */
body.portal-calc select, input{
font-size: 15px;
}
}

@media (min-width: 1200px) {
body.portal-calc .app{
max-width: 1200px;
width: 95%;
}

body.portal-calc .calculator-grid{
grid-template-columns: 1fr 1fr;
}

body.portal-calc .card.large{
grid-column: span 2;
}

body.portal-calc .results-section{
grid-column: span 2;
}

body.portal-calc .statistics-grid{
grid-template-columns: repeat(2, 1fr);
}

body.portal-calc .training-grid{
grid-template-columns: repeat(2, 1fr);
}
}

body.portal-calc .app::before{content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 5px;
background: var(--gradient);}

body.portal-calc .app-header{display:flex;
align-items:center;
gap:16px;
margin-bottom: 24px;}

body.portal-calc .logo{width:60px;
height:60px;
border-radius:16px;
position: relative;
overflow: hidden;
flex-shrink: 0;
background: var(--gradient);
padding: 8px;}

body.portal-calc .logo img{width:100%;
height:100%;
border-radius:12px;
object-fit:cover;
filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));}

body.portal-calc h1{font-size:20px;
margin:0 0 4px 0;
color: var(--primary-color);
font-weight: 800;
letter-spacing: -0.02em;}

body.portal-calc p.lead{margin:0;
color:#64748b;
font-size:14px;
line-height: 1.5;}

body.portal-calc .card{background: white;
padding:20px;
border-radius:var(--border-radius);
margin-bottom:16px;
border:1px solid #e2e8f0;
box-shadow: var(--box-shadow);
transition: all 0.3s ease;}

body.portal-calc .card:hover{transform: translateY(-3px);
box-shadow: 0 6px 20px rgba(0,0,0,0.1);}

body.portal-calc .section-title{font-size: 14px;
font-weight: 600;
color: var(--primary-color);
margin-bottom: 16px;
display: flex;
align-items: center;
gap: 8px;}

body.portal-calc .section-title::before{content: '';
width: 4px;
height: 16px;
background: var(--secondary-color);
border-radius: 2px;}

body.portal-calc label{display:block;
font-size:13px;
font-weight: 500;
color:var(--primary-color);
margin-bottom:8px;}

body.portal-calc select, body.portal-calc input, body.portal-calc button{width:100%;
padding:12px 16px;
border-radius:var(--border-radius);
border:1px solid #e2e8f0;
background: white;
color:var(--primary-color);
font-size:14px;
transition: all 0.2s ease;
outline: none;
font-family: inherit;}

body.portal-calc select:focus, body.portal-calc input:focus{border-color: var(--secondary-color);
box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);}

body.portal-calc .row{display:flex;
gap:12px;}

body.portal-calc .row>*{flex:1;}

body.portal-calc .muted{color:#64748b;
font-size:13px;
opacity: 0.9;}

body.portal-calc .results-grid{display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12px;
margin-top: 20px;}

body.portal-calc .result-box{background: linear-gradient(135deg, #f8fafc, #ffffff);
padding:16px;
border-radius:var(--border-radius);
text-align:center;
border: 1px solid #e2e8f0;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
transition: all 0.3s ease;}

body.portal-calc .result-box:hover{transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.08);}

body.portal-calc .big{font-size:24px;
font-weight:800;
color: var(--secondary-color);
margin-top: 4px;
line-height: 1.2;}

body.portal-calc .small{font-size: 12px;
color: #64748b;
margin-top: 4px;}

body.portal-calc .controls{display:flex;
gap:12px;
margin-top:24px;}

body.portal-calc .btn{cursor:pointer;
border:none;
padding:14px 24px;
border-radius:var(--border-radius);
font-weight: 600;
font-size: 14px;
transition: all 0.3s ease;
flex: 1;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;}

body.portal-calc .btn.primary{background: var(--secondary-color);
color: white;
box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);}

body.portal-calc .btn.primary:hover{transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
background: #2980b9;}

body.portal-calc .btn.secondary{background: white;
border: 1px solid #e2e8f0;
color: var(--primary-color);
box-shadow: 0 2px 4px rgba(0,0,0,0.05);}

body.portal-calc .btn.secondary:hover{background: #f8fafc;
border-color: var(--secondary-color);
transform: translateY(-2px);}

body.portal-calc footer{font-size:12px;
color:#64748b;
text-align:center;
margin-top:28px;
padding-top: 20px;
border-top: 1px solid #e2e8f0;
opacity: 0.7;}

body.portal-calc .toggle{display:flex;
gap:8px;
background: #f1f5f9;
padding: 4px;
border-radius: 12px;}

body.portal-calc .chip{padding:12px 16px;
border-radius:10px;
background: transparent;
border: none;
cursor:pointer;
font-size: 13px;
transition: all 0.2s ease;
flex: 1;
text-align: center;
font-weight: 500;
color: #64748b;}

body.portal-calc .chip.active{background: white;
color: var(--secondary-color);
font-weight: 600;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);}

body.portal-calc .chip:hover:not(.active){background: rgba(255,255,255,0.5);
color: var(--primary-color);}

body.portal-calc .stats-grid{display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12px;
margin-top: 16px;}

body.portal-calc .stat-box{background: linear-gradient(135deg, #f8fafc, #ffffff);
padding: 12px;
border-radius: 10px;
text-align: center;
border: 1px solid #e2e8f0;
transition: all 0.3s ease;}

body.portal-calc .stat-box:hover{transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.08);}

body.portal-calc .stat-value{font-size: 18px;
font-weight: 700;
color: var(--secondary-color);}

body.portal-calc .stat-label{font-size: 11px;
color: #64748b;
margin-top: 4px;
text-transform: uppercase;
letter-spacing: 0.5px;}

body.portal-calc .kadence-grid{display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12px;
margin-top: 16px;}

body.portal-calc .kadence-box{background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
padding: 16px;
border-radius: var(--border-radius);
border: 1px solid #bae6fd;
text-align: center;
transition: all 0.3s ease;}

body.portal-calc .kadence-box:hover{transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.08);}

body.portal-calc .kadence-value{font-size: 20px;
font-weight: 800;
color: #0ea5e9;
margin: 8px 0 4px 0;}

body.portal-calc .kadence-label{font-size: 11px;
color: #64748b;
text-transform: uppercase;
letter-spacing: 0.5px;}

body.portal-calc .tabs{display: flex;
border-bottom: 1px solid #e2e8f0;
margin-bottom: 20px;
gap: 8px;}

body.portal-calc .tab{padding: 12px 20px;
border: none;
background: none;
color: #64748b;
font-weight: 500;
font-size: 14px;
cursor: pointer;
position: relative;
border-radius: 8px 8px 0 0;
transition: all 0.2s ease;}

body.portal-calc .tab:hover{color: var(--secondary-color);
background: rgba(52, 152, 219, 0.05);}

body.portal-calc .tab.active{color: var(--secondary-color);
font-weight: 600;}

body.portal-calc .tab.active::after{content: '';
position: absolute;
bottom: -1px;
left: 0;
right: 0;
height: 2px;
background: var(--secondary-color);}

body.portal-calc .tab-content{display: none;}

body.portal-calc .tab-content.active{display: block;}

body.portal-calc .calories{background: linear-gradient(135deg, #e8f4fc, #d4eaf7);
border-color: #bae6fd;}

body.portal-calc .calories .big{color: #3498db;}

body.portal-calc .zone-indicator{display: flex;
justify-content: space-between;
margin-top: 12px;
font-size: 11px;
color: #64748b;}

body.portal-calc .zone{width: 20%;
text-align: center;
transition: all 0.2s ease;}

body.portal-calc .zone.active{color: var(--secondary-color);
font-weight: 600;
transform: scale(1.1);}

body.portal-calc .info-tooltip{position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
width: 16px;
height: 16px;
background: #e2e8f0;
border-radius: 50%;
font-size: 11px;
cursor: help;
margin-left: 4px;}

body.portal-calc .info-tooltip{cursor: pointer;
border: none;
background: #e2e8f0;}

body.portal-calc .info-tooltip::after{content: attr(data-tooltip);
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
background: var(--primary-color);
color: white;
padding: 8px 12px;
border-radius: 6px;
font-size: 12px;
white-space: normal;
max-width: 220px;
text-align: center;
z-index: 1000;
margin-bottom: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
display: none;
pointer-events: none;}

body.portal-calc .info-tooltip.open::after, body.portal-calc .info-tooltip:hover::after{display: block;}

body.portal-calc .info-tooltip.open::before, body.portal-calc .info-tooltip:hover::before{content: '';
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
border: 4px solid transparent;
border-top-color: var(--primary-color);
margin-bottom: -4px;}

body.portal-calc .field-hint{display: none;
font-size: 12px;
color: #64748b;
margin-top: 4px;
line-height: 1.4;}

body.portal-calc .field-hint--visible{
display: block;
font-size: 0.82rem;
line-height: 1.45;
color: #64748b;
margin-top: 0.5rem;
}

body.portal-calc .vo2-context{
margin: 0.75rem 0 0;
padding: 0.75rem 0.9rem;
font-size: 0.85rem;
line-height: 1.5;
color: #475569;
background: #f1f5f9;
border-radius: 8px;
border-left: 3px solid var(--secondary-color, #3498db);
}

body.portal-calc .stat-box--vo2 .stat-label{
font-size: 10px;
line-height: 1.3;
}

body.portal-calc .stat-help--vo2{
margin: 0.65rem 0 0;
font-size: 0.82rem;
line-height: 1.45;
color: #64748b;
}

body.portal-calc .form-error{display: none;
margin-top: 12px;
padding: 12px 14px;
border-radius: var(--border-radius);
background: #fef2f2;
border: 1px solid #fecaca;
color: #b91c1c;
font-size: 14px;
line-height: 1.4;}

body.portal-calc .form-error.visible{display: block;}

body.portal-calc .cadence-guide{margin-top: 20px;
padding: 16px;
background: #f0f9ff;
border-radius: var(--border-radius);
border: 1px solid #bae6fd;
font-size: 13px;}

body.portal-calc .cadence-guide h4{margin: 0 0 8px 0;
color: #0ea5e9;
font-size: 14px;}

body.portal-calc .cadence-guide ul{margin: 8px 0;
padding-left: 20px;}

body.portal-calc .cadence-guide li{margin: 4px 0;}

body.portal-calc .intensity-indicator{height: 8px;
background: #e2e8f0;
border-radius: 4px;
margin-top: 8px;
overflow: hidden;}

body.portal-calc .intensity-bar{height: 100%;
background: var(--secondary-color);
width: 0%;
transition: width 0.5s ease;
border-radius: 4px;}

body.portal-calc .zone-card{background: linear-gradient(135deg, #f8fafc, #ffffff);
padding: 16px;
border-radius: var(--border-radius);
border: 1px solid #e2e8f0;
margin-bottom: 12px;
transition: all 0.3s ease;}

body.portal-calc .zone-card:hover{transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.1);}

body.portal-calc .zone-header{display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;}

body.portal-calc .zone-name{font-weight: 600;
font-size: 14px;
color: var(--secondary-color);}

body.portal-calc .zone-percentage{font-size: 12px;
color: #64748b;
background: #e2e8f0;
padding: 2px 8px;
border-radius: 10px;}

body.portal-calc .zone-pulse{font-size: 16px;
font-weight: 700;
color: var(--primary-color);
margin-bottom: 4px;}

body.portal-calc .zone-description{font-size: 12px;
color: #64748b;
line-height: 1.4;}

body.portal-calc .zone-color-bar{height: 4px;
border-radius: 2px;
margin-top: 8px;}

body.portal-calc .zone-1{background: #d4edda;}

body.portal-calc .zone-2{background: #c3e6cb;}

body.portal-calc .zone-3{background: #ffeaa7;}

body.portal-calc .zone-4{background: #f8d7da;}

body.portal-calc .zone-5{background: #f5c6cb;}

body.portal-calc .pulse-inputs{display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12px;
margin-bottom: 16px;}

body.portal-calc .status-box{background: linear-gradient(135deg, #e8f4fc, #d4eaf7);
border: 1px solid #bae6fd;
padding: 20px;
border-radius: var(--border-radius);
text-align: center;
margin-top: 20px;}

body.portal-calc .section-spacing{margin-top: 30px;}

@media (max-width: 768px) {
body.portal-calc .field-hint{
display: block;
}

body.portal-calc .info-tooltip{
display: none;
}

body.portal-calc .tabs{
flex-wrap: nowrap;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
gap: 6px;
padding-bottom: 4px;
margin-bottom: 16px;
}

body.portal-calc .tabs::-webkit-scrollbar{
display: none;
}

body.portal-calc .tab{
flex: 0 0 auto;
white-space: nowrap;
font-size: 13px;
padding: 10px 14px;
min-height: 44px;
}

body.portal-calc .tab.active::after{
display: block;
}

body.portal-calc .chip,
body.portal-calc .btn{
min-height: 48px;
}

body.portal-calc #race-splits.card.large,
body.portal-calc #race-splits .card{
padding: 1rem;
margin-left: 0;
margin-right: 0;
}
}

@media (max-width: 480px) {
body.portal-calc .app{
margin:16px;
padding:20px;
border-radius:20px;
}

body.portal-calc .results-grid{
grid-template-columns: 1fr;
}

body.portal-calc .stats-grid,
body.portal-calc .kadence-grid{
grid-template-columns: repeat(2, 1fr);
}

body.portal-calc .app-header{
flex-direction: column;
text-align: center;
gap: 12px;
}

body.portal-calc .logo{
width: 80px;
height: 80px;
}

body.portal-calc .btn{
padding: 12px 16px;
font-size: 13px;
}

body.portal-calc .tabs{
flex-direction: column;
border-bottom: none;
gap: 4px;
}

body.portal-calc .tab{
border-radius: 8px;
border: 1px solid #e2e8f0;
}

body.portal-calc .tab.active{
border-color: var(--secondary-color);
}

body.portal-calc .tab.active::after{
display: none;
}

body.portal-calc .pulse-inputs{
grid-template-columns: 1fr;
}
}

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

body.portal-calc .results-grid{animation: fadeIn 0.4s ease;}

body.portal-calc .result-box.highlight{animation: pulse 1s ease;}

@keyframes pulse{0% { transform: scale(1); }
50% { transform: scale(1.02); }
100% { transform: scale(1); }}

body.portal-calc button:focus-visible, body.portal-calc select:focus-visible, body.portal-calc input:focus-visible{outline: 2px solid var(--secondary-color);
outline-offset: 2px;}

body.portal-calc .efficiency-calculation{background: linear-gradient(135deg, #f8f9fa, #e9ecef);
padding: 15px;
border-radius: var(--border-radius);
margin-top: 15px;
font-size: 13px;
border-left: 4px solid var(--secondary-color);}

body.portal-calc .efficiency-calculation h5{margin: 0 0 8px 0;
color: var(--primary-color);
font-size: 14px;}

body.portal-calc .efficiency-calculation ul{margin: 8px 0;
padding-left: 20px;}

body.portal-calc .efficiency-calculation li{margin: 4px 0;
color: #666;}

body.portal-calc .card + .section-title{margin-top: 30px;}