@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');

/* Universal box-sizing for consistent layout */
* {
    box-sizing: border-box;
}

:root {
    /* Light Mode Colors (Default) */
    --background-color: #f0f0f0;
    --text-color: rgba(26, 26, 26, 0.9); /* 90% black */
    --secondary-text-color: rgba(26, 26, 26, 0.7); /* 70% black */
    --container-bg: transparent;
    --form-bg: transparent;
    --form-border: none;
    --accent-color: #007bff;
    --error-color: #dc3545;
}

body.dark-mode {
    /* Dark Mode Colors */
    --background-color: #0a0a0a;
    --text-color: rgba(224, 224, 224, 0.9); /* 90% white */
    --secondary-text-color: rgba(176, 176, 176, 0.7); /* 70% white */
    --container-bg: transparent;
    --form-bg: transparent;
    --form-border: none;
    --accent-color: #00A6E4;
    --error-color: #dc3545;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%; /* Ensure html and body take full viewport height */
    overflow-x: hidden; /* Prevents horizontal scrolling/bouncing across the entire page */
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh; /* Fallback for browsers not supporting height: 100% well */
    display: flex; /* Use flexbox to center the calculator-container */
    justify-content: center;
    align-items: center; /* Default: Center vertically for desktop */
    transition: background-color 0.3s, color 0.3s; /* Smooth transition for theme change */
}

/* This class is primarily for preventing main page scrolling when a modal *would* be open on an overlay */
body.modal-open {
    overflow: hidden !important; /* Force hide overflow to prevent main page scrolling */
    position: fixed !important; /* Prevents scroll jump on iOS and other mobile browsers */
    width: 100% !important; /* Ensures fixed position doesn't shrink content */
    height: 100% !important; /* Ensures fixed position covers full height */
    top: 0 !important; /* Ensures fixed position starts from the very top */
    left: 0 !important; /* Ensures fixed position starts from the very left */
}

/* Calculator Container Styles (now the main container for photographyratescalculator.html) */
.calculator-container {
    background-color: var(--container-bg); /* Use transparent background */
    padding: 0; /* Removed padding from here, it will be on scrollable content */
    border-radius: 8px; /* Added some rounded corners back for content box */
    box-shadow: none; /* No shadow */
    
    /* Default (Desktop) Styles */
    width: 90%;
    max-width: 500px; /* Constrain width on desktop */
    height: auto; /* Allow height to adjust to content on desktop */
    margin: 20px auto; /* Center with some margin on desktop */

    text-align: center;
    position: relative; /* For positioning the close button and absolute result */
    display: flex; /* Use flexbox to stack header, scrollable content, and result */
    flex-direction: column; /* Stack them vertically */
    overflow-x: hidden; /* Prevents horizontal overflow within the container */
}

body.dark-mode .calculator-container {
    box-shadow: none; /* No shadow in dark mode either */
}

/* New: Styles for the scrollable form content */
.modal-scroll-content {
    flex-grow: 1; /* Allows this section to take up available space */
    overflow-y: auto; /* Enables vertical scrolling for the form fields */
    padding: 20px; /* Padding for the form content */
    padding-bottom: 90px; /* Condensed space for the absolutely positioned result section */
}

/* Close Button and Navigation Links Styling */
.calculator-nav {
    display: flex;
    justify-content: space-between; /* Adjusted to space-between to push items to ends */
    align-items: center; /* Vertically align all items */
    padding: 10px 20px; /* Padding for the nav area */
    background-color: var(--container-bg); /* Use transparent background */
    border-bottom: none; /* No border */
    position: relative; /* For z-index if needed */
    z-index: 15; /* Ensure nav is above other content */
}

.close-button {
    background: none;
    border: none;
    font-size: 40px; /* Increased font size */
    color: var(--text-color);
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 0; /* Remove default button padding */
    line-height: 1; /* Adjust line height for better alignment */
}

.close-button:hover {
    color: var(--accent-color); /* Hover color */
}

/* --- Brand Link Styles --- */
.brand-link {
    text-decoration: none;
    /* Use flexbox to correctly align the images inside */
    display: flex;
    align-items: center;
    height: 50px; /* Keep height fixed to prevent layout shift */
    /* Remove width so the link container resizes to the image's natural width */
}

.brand-link:hover {
    opacity: 0.8; /* Simple hover effect for the image */
}

/* Base styles for both logos */
.brand-logo-light,
.brand-logo-dark {
    height: 100%; /* Make the image fill the height of its container */
    width: auto; /* Maintain aspect ratio */
    /* Remove absolute positioning to prevent overlap */
}

/* Hide the dark logo by default */
.brand-logo-dark {
    display: none;
}

/* In dark mode, hide the light logo and show the dark logo */
body.dark-mode .brand-logo-light {
    display: none;
}
body.dark-mode .brand-logo-dark {
    display: block;
}

/* --- Theme Toggle Switch Styles --- */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    flex-direction: column; /* Stack switch and labels vertically */
    /* Adjust padding to be more condensed */
    padding: 0 10px;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 40px; /* Reduced width */
    height: 20px; /* Reduced height */
}

/* Hide default HTML checkbox */
.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--secondary-text-color);
    transition: 0.4s;
}

.slider:before {
    position: absolute;
    content: '';
    height: 16px; /* Reduced height */
    width: 16px; /* Reduced width */
    left: 2px;
    bottom: 2px;
    background-color: var(--background-color);
    transition: 0.4s;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(20px); /* Adjust to new size */
}

/* Rounded sliders */
.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

.theme-labels {
    display: flex;
    justify-content: center; /* Center the label */
    width: 100%;
    margin-top: 5px;
    font-size: 10px; /* Very small text */
    color: var(--secondary-text-color);
    white-space: nowrap;
    position: relative; /* Needed for absolute positioning of labels */
    height: 12px; /* Set a height to prevent layout shift */
}

/* Hide the night mode label by default in light mode */
.theme-labels .night-mode-label {
    display: none;
}
/* Show the night mode label when in light mode */
.theme-labels .light-mode-label {
    display: block;
}

/* In dark mode, hide the light mode label and show the night mode label */
body.dark-mode .theme-labels .light-mode-label {
    display: none;
}
body.dark-mode .theme-labels .night-mode-label {
    display: block;
}


/* Existing styles for form elements */
h1 {
    color: var(--text-color);
    margin: 0 auto; /* Added auto margins to center it */
    padding-top: 0;
    flex-grow: 1; /* Allow h1 to take available space */
    text-align: center;
    font-size: x-large;
    font-weight: 400; /* Removed bold font-weight as requested */
}

.form-group {
    margin-bottom: 15px; /* Reduced margin to condense spacing */
    text-align: left;
}

/* Updated selector to include input[type="text"] */
.form-group select,
.form-group input[type="number"],
.form-group input[type="text"] {
    width: 100%; /* Changed to 100% */
    padding: 10px; /* Adjusted padding */
    border: var(--form-border); /* No border */
    border-radius: 4px;
    font-size: 16px;
    background-color: var(--form-bg); /* Use transparent background */
    color: var(--text-color);
}

.form-group span {
    font-size: 14px; /* Increased font size */
    color: var(--secondary-text-color);
    margin-top: 5px;
    display: block;
}

/* Styles for the checkbox and its label within add-ons */
.form-group label:has(input[type="checkbox"]) {
    display: flex; /* Use flexbox to keep checkbox and text on same line */
    align-items: center; /* Vertically center checkbox with text */
    margin-bottom: 5px; /* Add a small margin between options */
}

/* Removed conflicting display rule for the checkbox itself */
.form-group input[type="checkbox"] {
    margin-right: 8px; /* Space between checkbox and text */
    flex-shrink: 0; /* Prevent checkbox from shrinking */
}


/* Styles for the result section (now absolutely positioned) */
.result {
    position: absolute; /* Changed from sticky to absolute */
    bottom: 0; /* Sticks it to the bottom of the calculator-container */
    left: 0;
    width: 100%;
    background-color: var(--container-bg); /* Use transparent background */
    padding: 10px 20px; /* Adjusted padding to be smaller */
    text-align: center;
    border-top: var(--form-border); /* No separator line */
    z-index: 10; /* Ensures it stays on top of scrolling content */
    box-shadow: none; /* No shadow */
    margin-bottom: 0; /* Removed margin-bottom */
}

body.dark-mode .result {
    box-shadow: none; /* No shadow in dark mode either */
}

.result h2 {
    /* This H2 will be removed from HTML, so its styles will no longer apply */
    display: none; /* Hide the H2 to effectively remove "Estimated Total" */
}

#totalPrice {
    font-weight: bold;
    font-size: 50px; /* Increased font size */
    color: var(--text-color);
    display: inline-block; /* Changed to inline-block to allow TTD on same line */
    margin-top: 2px; /* Adjusted margin */
}

/* New style for the currency unit (TTD) */
.currency-unit {
    font-weight: bold;
    font-size: 50px; /* Match the total price font size */
    color: var(--text-color); /* Match the total price color */
    margin-left: 8px; /* Small space between price and TTD */
    display: inline-block; /* Ensure it stays inline with totalPrice */
}


.error-message {
    color: var(--error-color);
    font-size: 14px;
    margin-top: 10px;
    display: block;
    font-weight: bold;
}

/* Media Queries for Mobile-Specific Styles */
@media (max-width: 768px) { /* Adjust breakpoint as needed for your definition of mobile */
    body {
        align-items: flex-start; /* Align calculator to the top on mobile */
    }

    .calculator-container {
        width: 100%; /* Edge-to-edge on mobile */
        max-width: none; /* No max-width on mobile */
        height: 100vh; /* Full viewport height on mobile */
        margin: 0; /* No margins on mobile */
        border-radius: 0; /* Remove border radius for edge-to-edge look */
        box-shadow: none; /* No shadow on mobile for clean edge-to-edge */
    }

    /* Adjust padding for h1 and close button if needed for smaller screens */
    h1 {
        padding-top: 30px; /* Give more space from the very top edge on mobile */
    }

    .close-button {
        top: 20px; /* Adjust close button position for mobile */
        right: 20px;
    }
}
/* Classes from your provided HTML that are now correctly styled */
.header-calculator {
    /* All styles moved to h1 directly or adjusted for flex container */
    font-size: x-large; /* Keep font size */
    margin-top: 0; /* Resetting to 0 to prevent heading cutoff */
}
.space-50px {
    margin-bottom: 20px; /* Reduced margin-bottom to prevent overlap with total */
}