/* CSS Reset and Variables */
:root {
    --primary-color: #007aff;
    /* Cleaner iOS-like blue */
    --secondary-color: #5ac8fa;
    --success-color: #34c759;
    --bg-color: #f2f2f7;
    --card-bg: #ffffff;
    --text-primary: #1c1c1e;
    --text-secondary: #8e8e93;
    --border-radius: 16px;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.08);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* Brand Colors */
    --brand-ozempic: #0072CE;
    --brand-wegovy: #5C7F72;
    --brand-mounjaro: #662d91;

    /* Medical Aqua Palette */
    --med-aqua-light: #e0f7fa;
    --med-aqua-mid: #b2ebf2;
    --med-blue-soft: #e3f2fd;
    --med-blue-pure: #2196f3;
}

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

html {
    font-size: 80%;
    /* Global 20% reduction */
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

body {
    font-family: var(--font-family);
    /* Organic Sequential Background */
    background: linear-gradient(135deg, #dceefc, #dff5e8, #fcf0e4, #f1eefc);
    background-size: 300% 300%;
    animation: organicSeq 25s ease infinite;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    line-height: 1.5;
}

@keyframes organicSeq {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Layout */
.container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
    margin-top: 10px;
    /* Reduced from 40px */
    margin-bottom: 60px;
    z-index: 10;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

.logo-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0, 122, 255, 0.2));
}

h1 {
    font-weight: 700;
    letter-spacing: -0.5px;
    font-size: 1.8rem;
    color: #000;
}

header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Aquamorphic Card */
.main-card {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow:
        0 8px 32px 0 rgba(31, 38, 135, 0.10),
        inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.main-card:hover {
    box-shadow:
        0 8px 32px 0 rgba(31, 38, 135, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

/* Section Styling */
.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.form-group {
    margin-bottom: 30px;
    position: relative;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* Inputs & Selects */
.input-wrapper {
    position: relative;
}

/* Translucent Inputs & Selects */
select,
input[type="number"] {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.8);
    /* increased opacity for better reliability */
    /* Removed backdrop-filter to fix mobile interaction issues */
    font-family: inherit;
    font-size: 16px;
    /* Explicit 16px to prevent iOS zoom */
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
    appearance: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

select:focus,
input:focus {
    background: rgba(255, 255, 255, 0.85);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

.custom-select-wrapper::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 6px;
    height: 6px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    pointer-events: none;
}

/* Brand Image Display */
.brand-image-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    min-height: 120px;
    /* Reserve space */
    align-items: center;
}

.brand-img {
    max-width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: contain;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    border-radius: 8px;
    /* subtle shadow for the product image */
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.1));
}

.brand-img.active {
    opacity: 1;
    transform: translateY(0);
}

/* Tooltip */
.tooltip-icon {
    background: #e5e5ea;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: help;
    color: var(--text-secondary);
    border: none;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: none;
    background: var(--primary-color);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:hover {
    background-color: #0062cc;
    /* Darker blue */
}

/* Result Section */
#result-section {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #e5e5ea;
    display: none;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.clicks-display {
    font-size: 4.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 5px;
    letter-spacing: -2px;
    text-align: center;
    /* Centering */
}

.clicks-label {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-weight: 500;
    text-align: center;
    /* Centering */
}

/* Center the 'clicks' unit text */
.clicks-unit-text {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Pen Demo - Redesigned to be cleaner */
.pen-demo-container {
    margin-top: 30px;
    background: #f9f9f9;
    border: 1px solid #e5e5ea;
    border-radius: 20px;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pen-visual {
    width: 220px;
    height: 220px;
    position: relative;
    margin-bottom: 20px;
}

.pen-dial-outer {
    width: 180px;
    height: 180px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 20px;
    left: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Add tick marks via conic gradient to make it look technical */
.pen-dial-outer::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg,
            transparent 0deg 4deg,
            #ddd 4deg 5deg);
    mask: radial-gradient(transparent 60%, black 61%);
    -webkit-mask: radial-gradient(transparent 60%, black 61%);
}

.pen-knob {
    width: 110px;
    height: 110px;
    background: #f2f2f7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

.pen-window {
    min-width: 60px;
    padding: 5px 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pen-marker {
    position: absolute;
    top: 0;
    width: 4px;
    height: 12px;
    background: var(--primary-color);
    z-index: 5;
    border-radius: 2px;
}

.pen-controls {
    display: flex;
    gap: 12px;
    width: 100%;
}

.btn-secondary {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    background: white;
    border: 1px solid #e5e5ea;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    touch-action: manipulation;
    /* Disables double-tap to zoom */
}

.btn-secondary:hover {
    background: #f2f2f7;
}

/* Footer */
footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: auto;
    padding: 20px;
    width: 100%;
}

.extra-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
    font-size: 0.85rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    /* Darker overlay for better focus */
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #c7c7cc;
    line-height: 1;
}

.close-modal:hover {
    color: var(--text-primary);
}

/* Duration Badge */
.duration-badge {
    background: var(--med-blue-soft);
    color: #0d47a1;
    padding: 12px 20px;
    border-radius: 50px;
    display: table;
    /* Centers with margin auto */
    margin: 0 auto 25px auto;
    font-weight: 500;
    font-size: 0.95rem;
    border: 1px solid rgba(33, 150, 243, 0.2);
    box-shadow: 0 4px 10px rgba(33, 150, 243, 0.1);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Wizard Styles */
.wizard-step {
    display: none;
    animation: fadeInStep 0.5s ease;
}

.wizard-step.active {
    display: block;
}

@keyframes fadeInStep {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.step-header {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    gap: 15px;
}

.step-badge {
    background: var(--med-blue-soft);
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 5px 10px;
    border-radius: 8px;
}

.step-header h2 {
    font-size: 1.2rem;
    margin: 0;
    color: var(--text-primary);
}

.btn-back {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.btn-back:hover {
    color: var(--primary-color);
}

/* Medical Spinner */
.spinner-medical {
    width: 50px;
    height: 50px;
    border: 4px solid var(--med-blue-soft);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}