/* Import Google Fonts for a modern, professional look */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Reset default styles for consistency */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

/* Body styling with a light, clean background */
body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Container for the two-column layout */
.container {
    display: flex;
    min-height: 100vh;
    padding: 45px;
    gap: 50px;
    background: linear-gradient(135deg, #e6f0fa 0%, #ffffff 100%);
    box-sizing: border-box;
}

/* Left side (form) styling */
/* Left side (form) styling */
.left-side {
    flex: 1;
    background-color: #ffffff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

/* Title/Logo styling */
.title {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    max-width: 330px;
    height: auto;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.35);
}

/* Form styling */
#solarWizardForm {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#solarWizardForm h2 {
    font-size: 1.5rem;
    color: #1a73e8;
    margin-bottom: 10px;
    border-bottom: 2px solid #1a73e8;
    padding-bottom: 5px;
    margin-top: 20px;
}

#solarWizardForm p {
    font-size: 1rem;
    color: #555;
    margin-bottom: 5px;
}

#solarWizardForm input,
#solarWizardForm select,
#solarWizardForm textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    color: #333;
    background-color: #f9f9f9;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#solarWizardForm input:focus,
#solarWizardForm select:focus,
#solarWizardForm textarea:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 8px rgba(26, 115, 232, 0.2);
}

#solarWizardForm textarea {
    resize: vertical;
    min-height: 80px;
}

/* Button styling */
#solarWizardForm button,
#outputPage button,
.modal-content button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

#solarWizardForm button {
    background-color: #1a73e8;
    color: #ffffff;
}

#solarWizardForm button:hover {
    background-color: #1557b0;
    transform: translateY(-2px);
}

#solarWizardForm button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* Specific button for generating overview */
button[onclick="generateOverview()"] {
    background-color: #34c759;
}

button[onclick="generateOverview()"]:hover {
    background-color: #28a745;
}

/* Right side (output) styling */
#outputPage {
    flex: 1;
    background-color: #ffffff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
    display: none;
}

#outputPage h2 {
    font-size: 1.5rem;
    color: #1a73e8;
    margin-bottom: 15px;
    margin-top: 25px;
    border-bottom: 2px solid #1a73e8;
    padding-bottom: 5px;
}

#outputPage p {
    font-size: 1rem;
    color: #555;
    margin-bottom: 10px;
}

#outputPage span {
    font-weight: 500;
    color: #333;
}

/* Generate PDF button */
#outputPage #generatePDF {
    background-color: #ff9500;
    color: #ffffff;
    margin-top: 20px;
    width: 100%;
}

#outputPage #generatePDF:hover {
    background-color: #e68a00;
    transform: translateY(-2px);
}

#outputPage #generatePDF:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* Modal styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: #ffffff;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh; /* Limit the height to 80% of the viewport height */
    overflow-y: auto; /* Enable vertical scrolling if content overflows */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease;
    /* Hide scrollbar for Webkit browsers (Chrome, Safari) */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on touch devices */
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -ms-overflow-style: none; /* Hide scrollbar for IE/Edge */
}

.modal-content::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Webkit browsers */
}

/* Prevent background scrolling when modal is open */
body.modal-open {
    overflow: hidden;
}

/* Ensure the body doesn't scroll when the modal is open */
body.modal-open {
    overflow: hidden;
}

.modal-content h3 {
    font-size: 1.5rem;
    color: #1a73e8;
    margin-bottom: 15px;
}

.modal-content p {
    font-size: 1rem;
    color: #555;
    margin-bottom: 10px;
}

.modal-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.modal-content li {
    font-size: 1rem;
    color: #555;
}

.modal-content input,
.modal-content select {
    width: 100%;
    padding: 10px 15px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background-color: #f9f9f9;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.modal-content input:focus,
.modal-content select:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 8px rgba(26, 115, 232, 0.2);
}

.modal-content button {
    background-color: #1a73e8;
    color: #ffffff;
    padding: 12px 25px; /* Slightly larger padding for bigger buttons */
    margin: 5px; /* Space around each button */
    width: 100%; /* Full width for better alignment */
    max-width: 200px; /* Limit the width for aesthetics */
    box-sizing: border-box; /* Ensure padding doesn't affect width */
}

/* Container for buttons to center them */
.modal-content .button-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px; /* Space between buttons */
    margin-top: 20px; /* Space above the buttons */
}

.modal-content button:hover {
    background-color: #1557b0;
    transform: translateY(-2px);
}

.modal:hover {
    background-color: rgba(0, 0, 0, 0.6); /* Slightly darker on hover */
}

.close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #ff3b30;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        padding: 45px;
        margin-bottom: 50px;
    }

    .left-side,
    #outputPage {
        padding: 15px;
        border-radius: 10px;
        margin-bottom: 50px;
    }

    .title {
        margin-bottom: 20px;
    }

    .logo {
        max-width: 150px;
    }

    #solarWizardForm h2,
    #outputPage h2 {
        font-size: 1.3rem;
    }

    #solarWizardForm p,
    #outputPage p,
    .modal-content p,
    .modal-content li {
        font-size: 0.95rem;
    }

    #solarWizardForm button,
    #outputPage button,
    .modal-content button {
        padding: 10px 15px;
        font-size: 0.95rem;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }
}

/* Center and reduce the size of the left side when outputPage is not visible */
.left-side {
    max-width: 500px; /* Reduced width */
    margin: 0 auto; /* Center horizontally */
    flex: none; /* Override the flex: 1 to prevent it from stretching */
}

/* Ensure the container centers the left-side when outputPage is hidden */
.container {
    justify-content: center; /* Center the content when there's only one child */
    background: linear-gradient(135deg, #e6f0fa 0%, #ffffff 100%);
}

/* When outputPage is visible, revert to the two-column layout */
.container:has(#outputPage[style*="display: block"]) {
    justify-content: space-between; /* Revert to two-column layout */
}

.container:has(#outputPage[style*="display: block"]) .left-side {
    flex: 1; /* Restore the flex behavior for two-column layout */
    max-width: none; /* Remove the max-width restriction */
    margin: 0; /* Remove centering */
}

/* Style for the help links */
.help-link {
    display: inline-block;
    font-size: 0.8rem;
    color: #1a73e8;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.3s ease;
    margin-top: 20px; /* Minimal space above the link */
}

/* Reduce spacing for the <p> tag containing the help link */
p:has(.help-link) {
    margin-top: -20px; /* Pull the link closer to the input above */
    margin-bottom: 15px; /* Maintain some space below for the next element */
}

.help-link:hover {
    color: #1557b0;
}

/* Toggle switch */
.toggle-container {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.switch {
position: relative;
display: inline-block;
width: 50px;
height: 26px;
}

.switch input {
opacity: 0;
width: 0;
height: 0;
}

.slider {
position: absolute;
top: 0; left: 0;
right: 0; bottom: 0;
background-color: #ccc;
transition: .4s;
border-radius: 26px;
}

.slider:before {
position: absolute;
content: "";
height: 20px; width: 20px;
left: 3px; bottom: 3px;
background-color: white;
transition: .4s;
border-radius: 50%;
}

input:checked + .slider {
background-color: #1a73e8;
}

input:checked + .slider:before {
transform: translateX(24px);
}

/* Adjust toggle container spacing */
.toggle-container {
    margin-bottom: 30px; /* Increase space between toggle and form header (was 20px) */
}

/* Manual Entry Form Styling */
#manualEntryForm {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Increase gap between form elements (was 15px) for better breathing room */
    padding: 0 10px; /* Add slight horizontal padding to align with Solar Wizard form */
}

/* Header Styling */
#manualEntryForm h2 {
    font-size: 1.5rem;
    color: #1a73e8;
    margin-bottom: 20px; /* Increase space below header (was 10px) */
    margin-top: 15px;
    border-bottom: 2px solid #1a73e8;
    padding-bottom: 5px;
    text-transform: uppercase;
}

/* Labels and Inputs */
#manualEntryForm p {
    font-size: 1rem;
    color: #555;
    margin-bottom: 0; /* Remove margin-bottom since gap handles spacing */
    display: flex;
    flex-direction: column; /* Stack label and input vertically */
    gap: 5px; /* Add a small gap between label and input for better readability */
}

#manualEntryForm input {
    width: 100%;
    padding: 12px 15px; /* Slightly increase padding for a more comfortable input field (was 10px 15px) */
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    color: #333;
    background-color: #f9f9f9;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#manualEntryForm input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 8px rgba(26, 115, 232, 0.2);
}

/* Button Styling */
#manualEntryForm button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    background-color: #ff9500;
    color: #ffffff;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-top: 20px; /* Add space above the button to separate it from the last input */
    align-self: center; /* Center the button horizontally */
    width: 100%; /* Make the button full-width for consistency */
    max-width: 200px; /* Limit the width for a cleaner look */
}

#manualEntryForm button:hover {
    background-color: #e68a00;
    transform: translateY(-2px);
}

#manualEntryForm button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* Add subtle divider for visual separation (optional) */
#manualEntryForm::before {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    background: #e6e6e6;
    margin: 20px 0; /* Add space above and below the divider */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #manualEntryForm {
        gap: 15px; /* Slightly reduce gap on smaller screens */
        padding: 0 5px; /* Reduce padding on smaller screens */
    }

    #manualEntryForm h2 {
        font-size: 1.3rem; /* Match Solar Wizard form's responsive header size */
        margin-bottom: 15px;
        margin-top: 20px;
    }

    #manualEntryForm p {
        font-size: 0.95rem; /* Match Solar Wizard form's responsive label size */
    }

    #manualEntryForm input {
        padding: 10px 12px; /* Slightly reduce padding on smaller screens */
        font-size: 0.95rem;
    }

    #manualEntryForm button {
        padding: 10px 15px;
        font-size: 0.95rem;
        max-width: 180px; /* Slightly smaller button on mobile */
    }

    .toggle-container {
        margin-bottom: 20px; /* Reduce space on smaller screens */
    }
}