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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1d29 0%, #2d3748 100%);
    min-height: 100vh;
    padding: 20px;
    color: #e2e8f0;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(45, 55, 72, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    overflow: hidden;
    border: 1px solid rgba(56, 178, 172, 0.2);
}

.header {
    background: linear-gradient(135deg, #2d3748, #4a5568);
    color: #e2e8f0;
    text-align: center;
    padding: 30px 20px;
    position: relative;
    overflow: hidden;
    border-bottom: 2px solid #38b2ac;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(56, 178, 172, 0.1), transparent);
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
    color: #38b2ac;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
    color: #cbd5e0;
}

.form-container {
    padding: 40px;
    background: #2d3748;
}

.form-grid {
    display: grid;
    gap: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

label {
    font-weight: 600;
    color: #a0aec0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="number"],
select,
textarea {
    padding: 15px;
    border: 2px solid #4a5568;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #1a202c;
    color: #e2e8f0;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #38b2ac;
    box-shadow: 0 0 0 3px rgba(56, 178, 172, 0.2);
    transform: translateY(-2px);
    background: #2d3748;
}

input[type="text"]::placeholder,
textarea::placeholder {
    color: #718096;
}

select option {
    background: #2d3748;
    color: #e2e8f0;
}

.height-weight-group {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.height-weight-group input[type="number"] {
    flex: 2;
}

.height-weight-group select {
    flex: 1;
    min-width: 80px;
}

textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* Range slider styling */
input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #4a5568;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #38b2ac;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(56, 178, 172, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #38b2ac;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(56, 178, 172, 0.3);
}

.submit-container {
    text-align: center;
    margin-top: 30px;
}

button {
    background: linear-gradient(135deg, #38b2ac, #319795);
    color: white;
    padding: 18px 40px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(56, 178, 172, 0.3);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(56, 178, 172, 0.4);
    background: linear-gradient(135deg, #319795, #2c7a7b);
}

button:active {
    transform: translateY(-1px);
}

button:disabled {
    background: #4a5568;
    cursor: not-allowed;
    box-shadow: none;
}

button:disabled:hover {
    transform: none;
    box-shadow: none;
}

.summary-section {
    background: #1a202c;
    padding: 30px 40px;
    border-top: 2px solid #38b2ac;
}

.summary-title {
    font-size: 1.5rem;
    color: #38b2ac;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 300;
}

#summaryText {
    background-color: white; /* Default white background */
    color: black; /* Default black text */
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #ddd; /* Light border */
    white-space: pre-wrap;
    min-height: 100px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

#summaryText h1,
#summaryText h2,
#summaryText h3 {
    color: #333; /* Darker text for headings */
}

#summaryText pre {
    background: #f4f4f4; /* Light background for code blocks */
    color: #333;
    border: 1px solid #eee;
}

#summaryText code {
    color: #c7254e; /* Code text color */
    background-color: #f9f2f4; /* Light background for inline code */
}

#summaryText :not(pre)>code {
    background: #f9f2f4;
    color: #c7254e;
}

#summaryText table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

#summaryText th,
#summaryText td {
    border: 1px solid #ddd;
    padding: 8px;
    color: black;
}

#summaryText th {
    background-color: #f4f4f4;
}

#summaryText blockquote {
    border-left: 4px solid #ccc;
    color: #555;
}

.fitness-level-container {
    position: relative;
}

.fitness-level-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.8rem;
    color: #a0aec0;
}

/* Fullscreen loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 32, 44, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #e2e8f0;
    font-size: 1.5rem;
    z-index: 1000;
    text-align: center;
    padding: 20px;
}

.loading-overlay p {
    margin: 0;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.loading-spinner {
    border: 8px solid rgba(56, 178, 172, 0.3);
    border-radius: 50%;
    border-top: 8px solid #38b2ac;
    width: 60px;
    height: 60px;
    animation: spin 2s linear infinite;
    margin-bottom: 20px;
}

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

/* Download button style */
#downloadPdf {
    background: linear-gradient(135deg, #38b2ac, #319795);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(56, 178, 172, 0.3);
    margin-top: 20px;
}

#downloadPdf:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(56, 178, 172, 0.4);
    background: linear-gradient(135deg, #319795, #2c7a7b);
}

#downloadPdf:active {
    transform: translateY(-1px);
}

/* Responsive Design - Mobile First Approach */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        margin: 0;
        border-radius: 15px;
        max-width: 100%;
    }

    .header {
        padding: 25px 20px;
    }

    .form-container {
        padding: 25px 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .height-weight-group {
        flex-direction: column;
        gap: 15px;
    }

    .height-weight-group input[type="number"],
    .height-weight-group select {
        flex: none;
    }

    button {
        width: 100%;
        padding: 15px 20px;
        font-size: 1rem;
    }

    .summary-section {
        padding: 25px 20px;
    }

    #summaryText {
        font-size: 0.8rem;
        padding: 20px;
    }
}

/* iPhone 12 and similar devices (390px width) */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .header {
        padding: 20px 15px;
    }

    .form-container {
        padding: 20px 15px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    input[type="text"],
    input[type="number"],
    select,
    textarea {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    label {
        font-size: 0.8rem;
    }

    .form-grid {
        gap: 20px;
    }

    button {
        padding: 14px 20px;
        font-size: 0.9rem;
    }

    .summary-section {
        padding: 20px 15px;
    }

    .summary-title {
        font-size: 1.3rem;
    }

    #summaryText {
        font-size: 0.75rem;
        padding: 15px;
        line-height: 1.5;
    }

    .fitness-level-labels {
        font-size: 0.7rem;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    h1 {
        font-size: 1.6rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .form-container {
        padding: 15px 10px;
    }

    .summary-section {
        padding: 15px 10px;
    }

    input[type="text"],
    input[type="number"],
    select,
    textarea {
        padding: 10px;
    }

    button {
        padding: 12px 15px;
        font-size: 0.85rem;
    }
}

/* Landscape orientation for mobile devices */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        padding: 15px 20px;
    }

    h1 {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .form-container {
        padding: 20px;
    }

    .form-grid {
        gap: 15px;
    }

    .summary-section {
        padding: 20px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    input[type="text"],
    input[type="number"],
    select,
    textarea {
        border-width: 1px;
    }
}

/* Focus improvements for accessibility */
input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: 2px solid #38b2ac;
    outline-offset: 2px;
}

/* Improved touch targets for mobile */
@media (max-width: 768px) {
    input[type="text"],
    input[type="number"],
    select,
    textarea,
    button {
        min-height: 44px; /* Apple's recommended minimum touch target */
    }
    
    input[type="range"] {
        height: 44px;
        padding: 18px 0;
    }
}

/* New class for PDF content wrapper */
.pdf-content-wrapper {
    width: 210mm; /* A4 width */
    min-height: 297mm; /* A4 height */
    padding: 20mm; /* Margins */
    margin: 0 auto;
    background-color: white;
    color: black;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 12pt;
    line-height: 1.5;
}

.pdf-content-wrapper h1 {
    font-size: 24pt;
    margin-bottom: 15pt;
    text-align: center;
    color: #333;
}

.pdf-content-wrapper h2 {
    font-size: 18pt;
    margin-top: 20pt;
    margin-bottom: 10pt;
    color: #555;
}

.pdf-content-wrapper h3 {
    font-size: 14pt;
    margin-top: 15pt;
    margin-bottom: 8pt;
    color: #777;
}

.pdf-content-wrapper ul, .pdf-content-wrapper ol {
    margin-left: 20pt;
    margin-bottom: 10pt;
}

.pdf-content-wrapper li {
    margin-bottom: 5pt;
}

.pdf-content-wrapper p {
    margin-bottom: 10pt;
}

/* CSS for page breaks */
.page-break {
    page-break-before: always;
}



body {
    font-family: Barlow, sans-serif;
    line-height: 1.6;
    padding: 20px;
    margin: 0;
}

pre {
    background: #2d2d2d;
    border-radius: 4px;
    margin: 0.5em 0;
}

code {
    font-family: 'Fira Code', Consolas, Monaco, monospace;
}

:not(pre)>code {
    background: #f0f0f0;
    padding: 2px 4px;
    border-radius: 3px;
    color: #e83e8c;
}

img {
    max-width: 100%;
}

table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

th,
td {
    border: 1px solid #ddd;
    padding: 8px;
}

th {
    background-color: #f4f4f4;
}

blockquote {
    border-left: 4px solid #ddd;
    padding-left: 1em;
    margin-left: 0;
    color: #666;
}

h1 {
    font-size: 2.2em;
    color: #f1f1f1;
    border-bottom: 2px solid #c0c0c0;
    padding-bottom: 0.5rem;
    margin: 1.5rem 0;
}

h2 {
    font-size: 1.8em;
    color: #cfcfcf;
    margin: 1.5rem 0;
}

h3 {
    font-size: 1.4em;
    color: #455a64;
}
