body {
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.main-content {
    /* max-width: 1200px;
    margin: 20px auto;
    padding: 20px; */
    background-color: var(--surface-color);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

/* Header Styling */
.app-header {
    text-align: center;
    padding-bottom: 20px;
    /* border-bottom: 1px solid var(--border-color); */
    margin-bottom: 30px;
    z-index: unset;
}

.app-header .logo {
    max-width: 180px; /* Adjust as needed */
    height: auto;
    margin-bottom: 15px;
}

.app-header h1 {
    color: var(--heading-color);
    font-size: 2.2em;
    margin: 0;
}

/* Tools Section Styling (CSS Grid for clean arrangement) */
.tools-section {
    padding: 20px 0;
    text-align: center; /* Fallback for older browsers / general alignment */
    overflow-y: scroll;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Responsive grid */
    gap: 30px; /* Space between grid items */
    justify-items: center; /* Center items horizontally in their grid area */
    align-items: start; /* Align items to the start of their grid area vertically */
    padding: 20px;
    height: 50vh;
}

.tool-item {
    background-color: var(--surface-color);
    /* border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px; */
    display: flex; /* Use flexbox for content within the tool item */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08); */
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    width: 100%; /* Ensure it fills its grid cell */
    max-width: 250px; /* Optional: limit max width of each card */
}

.tool-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(157, 255, 157, 0.452);
}

.tool-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%; /* Make button take full width of tool-item */
    color: inherit; /* Inherit text color from parent */
    text-decoration: none; /* Remove underline for link-like behavior */
}

.tool-button img {
    width: 150px; /* Standard size for icons */
    height: 150px;
    object-fit: contain;
    margin-bottom: 15px;
}

.tool-button h3 {
    color: var(--heading-color);
    font-size: 1.3em;
    margin: 0;
    text-align: center;
}

.coming-soon .tool-button h3 {
    font-size: 0.7em;
}

.soon-text {
    font-size: 0.55em;
    color: var(--highlight-brand-orange); /* Use brand orange for "Coming Soon" */
    margin-top: 2px;
    font-weight: bold;
}

.tool-item.coming-soon {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f2f2f2; /* Slightly different background for disabled items */
}

.tool-item.coming-soon .tool-button:hover {
    transform: none; /* Disable hover effect for coming soon items */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08); /* Keep original shadow */
}

.tool-item.coming-soon .tool-button {
    cursor: not-allowed;
}


/* Login Container Styling */
.login-container {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 30px;
    max-width: 400px;
    margin: 50px auto; /* Center it horizontally with some top/bottom margin */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.login-container h2 {
    text-align: center;
    color: var(--heading-color);
    margin-bottom: 25px;
}

.login-container form {
    display: flex;
    flex-direction: column;
}

.login-container label {
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--text-color);
}

.login-container input[type="text"],
.login-container input[type="password"] {
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    color: var(--text-color);
}

.login-container input[type="text"]:focus,
.login-container input[type="password"]:focus {
    border-color: var(--accent-brand-green); /* Highlight on focus */
    outline: none;
    box-shadow: 0 0 0 3px rgba(159, 206, 91, 0.3); /* Soft glow */
}

.login-container button[type="submit"] {
    background-color: var(--primary-brand-dark); /* Primary brand color for login button */
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: background-color 0.2s ease-in-out;
}

.login-container button[type="submit"]:hover {
    background-color: darken(var(--primary-brand-dark), 10%); /* Slightly darker on hover */
    /* Note: darken() is a SASS/LESS function. In pure CSS, you'd use a specific hex code or adjust manually.
       Example: #525557 for #65696c */
    background-color: #525557; /* Manual darker shade for hover */
}

/* --- Modal Styles --- */

/* The Modal (background) */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 500; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed, but we aim to avoid it */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    padding-top: 40px; /* LESS padding-top to bring modal higher */
    font-family: var(--font-family);
}

/* Modal Content/Box */
.modal-content {
    background-color: var(--surface-color);
    /* Adjusted margin: more compact */
    margin: 5% auto 5% auto; /* Reduced bottom margin */
    border: 1px solid var(--border-color);
    /* Reduced max-width for a more compact modal */
    max-width: 400px; /* Reduced from 500px */
    width: 90%; /* Allow it to be wider on smaller screens, but max-width will cap it */
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    /* Added min-height to help prevent collapse if content is too small, though unlikely here */
    min-height: 350px; /* Ensures a consistent minimum height */
    display: flex; /* Use flexbox for internal layout */
    flex-direction: column; /* Stack children vertically */
    justify-content: space-between; /* Distribute space */
}

/* Add Zoom Animation */
.animate {
    -webkit-animation: animatezoom 0.6s;
    animation: animatezoom 0.6s
}

@-webkit-keyframes animatezoom {
    from {-webkit-transform: scale(0)}
    to {-webkit-transform: scale(1)}
}

@keyframes animatezoom {
    from {transform: scale(0)}
    to {transform: scale(1)}
}

/* Close Button */
.close-button {
    position: absolute;
    right: 15px; /* Adjusted closer to edge */
    top: 5px; /* Adjusted closer to top */
    color: #000;
    font-size: 30px; /* Slightly smaller */
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1001; /* Ensure it's above other content */
}

.close-button:hover,
.close-button:focus {
    color: var(--secondary-brand-red);
    text-decoration: none;
    cursor: pointer;
}

/* Image Container */
.img-container {
    text-align: center;
    margin: 8px 0 -30px 0;
    position: relative;
    flex-shrink: 0; /* Prevent it from shrinking */
}

.avatar {
    max-width: 100%; /* Reduced from 150px */
    height: 80px;
    margin: 15px; /* Reduced margin */
    object-fit: cover; /* Ensures image covers area without distortion */
}

/* Container for inputs */
.container {
    padding: 10px 16px; /* Reduced vertical padding */
    flex-grow: 1; /* Allow container to take available space */
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center content vertically */
}

/* Headings within modals */
.modal-content h2 {
    font-size: 1.6em; /* Reduced from 1.8-2em */
    margin-top: 10px; /* Adjusted margin */
    margin-bottom: 20px; /* Adjusted margin */
}

/* Labels */
.container label {
    margin-bottom: 6px; /* Reduced margin */
    font-size: 0.9em; /* Smaller font size */
    font-weight: bold;
    color: var(--text-color);
}

/* Full-width input fields */
.container input[type="text"],
.container input[type="email"],
.container input[type="password"],
.container select,
.container option {
    width: calc(100% - 20px); /* Adjusted width for padding */
    padding: 10px; /* Reduced padding */
    margin: 6px 0; /* Reduced vertical margin */
    display: inline-block;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
    border-radius: 5px;
    font-size: 0.95em; /* Slightly smaller font size */
}

.container input[type="email"]:focus,
.container input[type="text"]:focus,
.container input[type="password"]:focus,
.container select:focus,
.container option:focus {
    border-color: var(--accent-brand-green);
    outline: none;
    box-shadow: 0 0 0 3px rgba(159, 206, 91, 0.3);
}


/* Submit and Cancel Buttons within modals */
.submit-button, .cancel-button, .send-otp-button {
    background-color: var(--primary-brand-dark);
    color: white;
    padding: 10px 15px; /* Reduced padding */
    margin: 6px 0; /* Reduced margin */
    border: none;
    cursor: pointer;
    width: calc(100% - 20px);
    border-radius: 6px; /* Slightly smaller border-radius */
    font-size: 1em; /* Slightly smaller font size */
    font-weight: bold;
    transition: background-color 0.2s ease;
}

.submit-button:hover, .send-otp-button:hover {
    background-color: #525557;
}

.cancel-button {
    width: auto;
    padding: 8px 15px; /* Reduced padding */
    background-color: var(--secondary-brand-red);
    margin-right: 8px; /* Adjusted margin */
}

.cancel-button:hover {
    background-color: #bb232d;
}

.modal-footer {
    background-color: #f1f1f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px; /* Reduced padding */
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    flex-shrink: 0; /* Prevent it from shrinking */
}

.forgot-password {
    text-align: right;
    font-size: 0.85em; /* Smaller font size */
}

.forgot-password a {
    color: var(--primary-brand-dark);
    text-decoration: none;
}

.forgot-password a:hover {
    text-decoration: underline;
    color: var(--accent-brand-green);
}

/* OTP specific styles */
.otp-input {
    margin-top: 8px !important; /* Adjusted margin */
    text-align: center;
    font-size: 1.1em !important; /* Slightly smaller font */
    letter-spacing: 1px; /* Slightly reduced spacing */
}

/* --- Media Queries for Modals --- */
/* Ensure smaller modals adapt well on very small screens too */
@media screen and (max-width: 600px) {
    .modal {
        padding-top: 20px; /* Even less padding for small screens */
    }

    .modal-content {
        margin: 5% auto; /* Keep compact */
        width: 95%; /* Wider on small screens */
        max-width: none; /* Remove max-width constraint for very small screens */
    }

    .close-button {
        font-size: 28px; /* Slightly smaller on tiny screens */
        right: 10px;
        top: 2px;
    }

    .avatar {
        width: 80px; /* Even smaller avatar */
        height: 60px;
    }

    .modal-content h2 {
        font-size: 1.4em;
    }

    .container input[type="text"],
    .container input[type="password"] {
        padding: 8px; /* Even less padding */
        font-size: 0.9em;
    }

    .submit-button, .cancel-button, .send-otp-button {
        padding: 10px 12px;
        font-size: 0.95em;
    }

    .modal-footer {
        flex-direction: column;
        align-items: stretch;
        padding: 8px 10px; /* Reduced footer padding */
    }

    .modal-footer button {
        width: 100%;
        margin-bottom: 8px;
    }

    .forgot-password {
        text-align: center;
        margin-top: 5px;
        font-size: 0.8em;
    }
}

/* --- Media Queries for Responsiveness --- */

/* Extra small devices (phones, 320px and up) */
@media (max-width: 480px) {
    .main-content {
        margin: 10px;
        padding: 15px;
    }

    .app-header .logo {
        max-width: 120px;
    }

    .app-header h1 {
        font-size: 1.5em;
    }

    .tools-grid {
        grid-template-columns: 1fr; /* Single column layout for very small screens */
        gap: 20px;
        padding: 10px;
    }

    .tool-button img {
        width: 70px;
        height: 70px;
    }

    .tool-button h3 {
        font-size: 1.1em;
    }

    .login-container {
        padding: 20px;
        margin: 30px auto;
    }
}

/* Small devices (tablets, 481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .main-content {
        margin: 15px auto;
        padding: 20px;
    }

    .app-header .logo {
        max-width: 150px;
    }

    .app-header h1 {
        font-size: 1.8em;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Two columns for smaller tablets */
        gap: 25px;
    }

    .tool-button img {
        width: 80px;
        height: 80px;
    }

    .tool-button h3 {
        font-size: 1.2em;
    }
}

/* Medium devices (desktops, 769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-content {
        padding: 25px;
    }

    .app-header h1 {
        font-size: 2em;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Three or more columns */
    }
}

/* Large devices (large desktops, 1025px and up) */
/* No specific changes needed here as base styles are optimized for larger screens */