/* Root variables for consistent theming */
:root {
    --primary-color: #4a90e2; /* Primary blue color */
    --secondary-color: #50e3c2; /* Secondary teal color */
    --accent-color: #f5a623; /* Accent orange color */
    --background-color: #f0f4f8; /* Light background color */
    --text-color: #333; /* Main text color */
    --light-text-color: #666; /* Secondary text color */
    --success-color: #28a745; /* Green for success messages */
    --error-color: #dc3545; /* Red for error messages */
}

/* Basic body styling */
body {
    font-family: 'Open Sans', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Heading styles */
h1, h2, h3 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
}

/* Main title styling with hover effect */
.main-title {
    text-align: center;
    font-size: 3.5em;
    font-weight: bold;
    margin: 40px 0;
    padding: 20px;
    background: var(--primary-color);
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    letter-spacing: 2px;
    display: inline-block;
    transition: all 0.3s ease;
}

/* Highlight class for accent-colored text */
.main-title .highlight {
    color: var(--accent-color);
}

/* Hover effect for main title */
.main-title:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

/* Container for the main content */
.container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    max-width: 1000px;
    margin: 20px auto;
    overflow-x: auto;
    animation: fadeIn 0.5s ease; /* Fade-in animation */
}

/* Fade-in animation keyframes */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Section heading styling */
h2 {
    text-align: center;
    color: var(--primary-color);
    font-size: 2em;
    margin-bottom: 30px;
}

/* Form layout using CSS Grid */
form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Form group styling for input fields */
.form-group {
    display: flex;
    flex-direction: column;
}

/* Label styling with icons */
label {
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--light-text-color);
}

/* Icon spacing within labels */
label i {
    margin-right: 8px;
}

/* Input and select field styling */
input, select {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--secondary-color);
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

/* Focus state for input and select fields */
input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Number input alignment */
input[type="number"] {
    text-align: right;
}

/* Specific width adjustments for input fields */
#age, #investmentDuration, #targetAge, #roi {
    width: 80px;
}

#sex {
    width: 120px;
}

#policyType, #healthInsurance {
    width: 200px;
}

#sumAssured, #investmentAmount {
    width: 150px;
}

/* Button group styling */
.button-group {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

/* Button styling */
button {
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    border: none;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Calculate button styling */
button.calculate {
    background: var(--primary-color);
}

/* Reset button styling */
button.reset {
    background: var(--secondary-color);
}

/* Hover effect for buttons */
button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

/* Projection section styling */
#projection {
    margin-top: 40px;
}

/* Table styling */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 0.9em;
}

/* Table header and cell styling */
th, td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: right;
}

/* Table header styling */
th {
    background-color: var(--primary-color);
    color: white;
}

/* Alternate row background color */
tr:nth-child(even) {
    background-color: #f8f8f8;
}

/* Highlight class for important values */
.highlight {
    font-weight: bold;
    color: var(--accent-color);
}

/* Table container styling */
.table-responsive {
    overflow-x: auto; /* Enable horizontal scrolling */
    margin-top: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Table styling */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    min-width: 800px; /* Ensure the table has a minimum width */
}

/* Table header and cell styling */
th, td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: right;
}

/* Table header styling */
th {
    background-color: var(--primary-color);
    color: white;
}

/* Alternate row background color */
tr:nth-child(even) {
    background-color: #f8f8f8;
}

/* Highlight class for important values */
.highlight {
    font-weight: bold;
    color: var(--accent-color);
}

/* Chart container styling */
.chart-container {
    margin-top: 40px;
    max-width: 100%;
    height: 400px;
}

/* Warning message styling */
.warning {
    color: var(--error-color);
    font-weight: bold;
    margin-top: 5px;
    font-size: 0.9em;
}

/* Success message styling */
.success {
    color: var(--success-color);
}

/* Summary section styling */
.summary {
    background-color: #f0f8ff;
    border-radius: 10px;
    padding: 20px;
    margin-top: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Summary heading styling */
.summary h3 {
    margin-top: 0;
    color: var(--primary-color);
}

/* Summary paragraph styling */
.summary p {
    margin: 10px 0;
}

/* Value styling in summary */
.summary .value {
    font-weight: bold;
    color: var(--accent-color);
}

/* Coverage info styling */
.summary .coverage-info {
    background-color: #e9f5ff;
    border-left: 4px solid var(--primary-color);
    padding: 10px 15px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Coverage period styling */
.summary .coverage-period {
    font-weight: bold;
    color: var(--primary-color);
}

/* Info box styling */
.info-box {
    margin-top: 30px;
    padding: 20px;
    background-color: #fff9e6;
    border-left: 5px solid var(--accent-color);
    border-radius: 5px;
}

/* Print button styling */
.print-button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 20px 0;
    cursor: pointer;
    border-radius: 25px;
    transition: all 0.3s ease;
}

/* Hover effect for print button */
.print-button:hover {
    background: #e69100;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Notes section styling */
.notes {
    background-color: #f8f8f8;
    border-left: 4px solid var(--accent-color);
    padding: 15px;
    margin-top: 20px;
    border-radius: 4px;
}

/* Notes heading styling */
.notes h4 {
    margin-top: 0;
    color: var(--primary-color);
}

/* Notes list styling */
.notes ul {
    padding-left: 20px;
    margin-bottom: 0;
}

/* Notes list item styling */
.notes li {
    margin-bottom: 10px;
}

/* Remove margin from last list item */
.notes li:last-child {
    margin-bottom: 0;
}

/* Form section styling */
.form-section {
    margin-top: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 10px;
    border: 1px solid #ddd;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    .main-title {
        font-size: 2.5em;
        margin: 20px 0;
        padding: 15px;
    }

    h2 {
        font-size: 1.5em;
    }

    form {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    table {
        font-size: 0.8em;
    }

    th, td {
        padding: 8px;
    }

    .container {
        padding: 15px;
        margin: 10px;
    }
}

/* Print-specific styles */
@media print {
    body {
        background: none;
    }

    .container {
        box-shadow: none;
    }

    .print-button {
        display: none;
    }
}