/**
 * ISAB Rörmätaren - Frontend Styles
 * Version: 1.0.1
 */

.isab-pm-wrapper {
    --isab-pm-primary: #005BAA;
    --isab-pm-primary-dark: #003d73;
    --isab-pm-good: #10b981;
    --isab-pm-warning: #f59e0b;
    --isab-pm-danger: #ef4444;

    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1a1d1e;
    line-height: 1.6;
    box-sizing: border-box;
}

.isab-pm-wrapper *,
.isab-pm-wrapper *::before,
.isab-pm-wrapper *::after {
    box-sizing: border-box;
}

/* Pipe Section */
.isab-pm-section {
    position: relative;
}

.isab-pm-container {
    position: relative;
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Scroll-locked state - no visual change, just prevents body scroll */
body.isab-pm-scroll-locked {
    overflow: hidden !important;
}

.isab-pm-visual-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.isab-pm-pipe-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #64748b;
    margin-bottom: 20px;
}

.isab-pm-canvas-container {
    position: relative;
    width: 300px;
    height: 300px;
}

.isab-pm-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow:
        0 25px 60px rgba(0,0,0,0.12),
        0 10px 20px rgba(0,0,0,0.08);
}

/* Age overlay */
.isab-pm-age-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 10;
}

.isab-pm-age-number {
    font-size: clamp(42px, 10vw, 56px);
    font-weight: 800;
    color: white;
    text-shadow: 0 4px 20px rgba(0,0,0,0.5);
    line-height: 1;
    transition: transform 0.3s ease;
}

.isab-pm-age-unit {
    font-size: 18px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 2px 10px rgba(0,0,0,0.4);
    margin-top: 4px;
}

/* Result button */
.isab-pm-button-wrap {
    margin-top: 30px;
}

.isab-pm-result-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--isab-pm-primary) 0%, var(--isab-pm-primary-dark) 100%);
    color: white;
    font-family: inherit;
    font-weight: 600;
    font-size: 16px;
    padding: 16px 32px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,91,170,0.3);
}

.isab-pm-result-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,91,170,0.4);
}

.isab-pm-result-button:active {
    transform: translateY(0);
}

.isab-pm-result-button svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.isab-pm-result-button:hover svg {
    transform: translateX(4px);
}

/* Progress bar */
.isab-pm-progress-wrap {
    margin-top: 20px;
    text-align: center;
}

.isab-pm-progress-bar {
    width: 200px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto 8px;
}

.isab-pm-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--isab-pm-good) 0%, var(--isab-pm-warning) 50%, var(--isab-pm-danger) 100%);
    border-radius: 2px;
    transition: width 0.1s ease;
}

.isab-pm-progress-label {
    font-size: 11px;
    color: #94a3b8;
}

/* Modal */
.isab-pm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    padding: 20px;
}

.isab-pm-modal.active {
    opacity: 1;
    visibility: visible;
}

.isab-pm-modal-card {
    background: white;
    border-radius: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.4s ease;
    box-shadow: 0 25px 80px rgba(0,0,0,0.25);
}

.isab-pm-modal.active .isab-pm-modal-card {
    transform: translateY(0) scale(1);
}

.isab-pm-modal-header {
    background: linear-gradient(135deg, var(--isab-pm-primary) 0%, var(--isab-pm-primary-dark) 100%);
    padding: 30px;
    text-align: center;
    border-radius: 24px 24px 0 0;
    position: relative;
}

.isab-pm-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.isab-pm-modal-close:hover {
    background: rgba(255,255,255,0.25);
}

.isab-pm-modal-close svg {
    width: 18px;
    height: 18px;
    color: white;
}

.isab-pm-modal-age {
    font-size: 56px;
    font-weight: 800;
    color: white;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.isab-pm-modal-age-label {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
    margin-top: 8px;
}

.isab-pm-modal-status {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 16px;
}

.isab-pm-modal-status.good {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.isab-pm-modal-status.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.isab-pm-modal-status.danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.isab-pm-modal-body {
    padding: 30px;
}

.isab-pm-modal-section {
    margin-bottom: 24px;
}

.isab-pm-modal-section:last-child {
    margin-bottom: 0;
}

.isab-pm-modal-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    margin-bottom: 12px;
}

.isab-pm-modal-text {
    font-size: 15px;
    line-height: 1.7;
    color: #475569;
    margin: 0;
    padding: 0;
}

.isab-pm-modal-services {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.isab-pm-modal-service {
    background: #f1f5f9;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
}

.isab-pm-modal-service.highlight {
    background: linear-gradient(135deg, var(--isab-pm-primary) 0%, #0077cc 100%);
    color: white;
}

/* Modal flow */
.isab-pm-modal-flow {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
}

.isab-pm-modal-flow-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.isab-pm-modal-flow-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.isab-pm-modal-flow-value {
    font-size: 20px;
    font-weight: 700;
}

.isab-pm-modal-flow-value.good { color: var(--isab-pm-good); }
.isab-pm-modal-flow-value.warning { color: var(--isab-pm-warning); }
.isab-pm-modal-flow-value.danger { color: var(--isab-pm-danger); }

.isab-pm-modal-flow-bar {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
}

.isab-pm-modal-flow-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease;
}

/* Modal CTA */
.isab-pm-modal-cta {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.isab-pm-modal-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none !important;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.isab-pm-modal-btn.primary {
    background: linear-gradient(135deg, var(--isab-pm-primary) 0%, var(--isab-pm-primary-dark) 100%);
    color: white !important;
}

.isab-pm-modal-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,91,170,0.3);
}

.isab-pm-modal-btn.secondary {
    background: #f1f5f9;
    color: #334155 !important;
}

.isab-pm-modal-btn.secondary:hover {
    background: #e2e8f0;
}

/* Responsive */
@media (max-width: 500px) {
    .isab-pm-canvas-container {
        width: 240px;
        height: 240px;
    }

    .isab-pm-age-number {
        font-size: 42px;
    }


    .isab-pm-modal-card {
        border-radius: 20px;
    }

    .isab-pm-modal-header {
        padding: 24px;
        border-radius: 20px 20px 0 0;
    }

    .isab-pm-modal-age {
        font-size: 44px;
    }

    .isab-pm-modal-cta {
        flex-direction: column;
    }
}
