/* style.css */

/* General Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-y: scroll; /* Always show scrollbar to prevent layout shift */
}

/* Site Header */
.site-header {
    background-color: #28a745;
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between; /* Distribute items horizontally */
    align-items: center; /* Vertically align items */
    position: sticky; /* Make the header sticky */
    top: 0; /* Stick it to the top of the viewport */
    z-index: 1000; /* Ensure it stays on top of other content */
}


.site-header h1 {
    margin: 0;
    font-size: 1.75rem;
    flex-grow: 1; /* Allow title to take available space */
    text-align: left; /* Align title to the left */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px; /* Optional: Constrain header width */
    margin: 0 auto; /* Center header content */
    width: 100%; /* Ensure it takes full width of its parent */
    /* max-width: 1200px; /* Removed to allow more flexibility */
    /* margin: 0 auto; /* No longer needed with width: 100% and parent padding */
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1.5rem; /* Space between items */
    font-size: 1rem;
    font-weight: 500;
    color: white;
}

.credit-info {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.header-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.header-link:hover {
    opacity: 0.8;
}

.profile-menu {
    position: relative; /* For dropdown positioning */
}

/* Dropdown Content (Hidden by Default) */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #ffffff;
    min-width: 140px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    border-radius: 8px;
    z-index: 1;
    right: 0;
    top: 100%;
    margin-top: 10px;
}

/* Links inside the dropdown */
.dropdown-content a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-weight: normal;
    border-radius: 8px;
    transition: background-color 0.2s;
}

/* Separator in the dropdown */
.dropdown-separator {
    height: 1px;
    margin: 8px 0;
    background-color: #e9ecef;
}

.main-content {
    flex-grow: 1;
    padding: 0 1rem; /* Add horizontal padding for smaller screens */
}

/* Dashboard Layout */
.dashboard-container {
    padding: 2rem;
    width: 100%;    
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

.tab-nav {
    display: flex;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 2rem;
}

.tab-link {
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    color: #495057;
    font-weight: 600;
    font-size: 1.1rem;
    border: 2px solid transparent;
    border-bottom: none;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.tab-link:hover {
    color: #28a745;
}

.tab-link.active {
    color: #28a745;
    border-color: #dee2e6 #dee2e6 #fff;
    border-radius: 6px 6px 0 0;
}


.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}
.dashboard-section {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    box-sizing: border-box;
}
.card1 {
    background-color: #fdfdfd;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-section-large {
    /* This class is no longer needed for width control */
}

.dashboard-section h2 {
    margin-top: 0;
    font-size: 1.5rem;
}

.section-header h2 {
    margin-bottom: 0;
}

/* Card layout for calculation section */
.card {
    background-color: #fdfdfd;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #343a40;
}

.input-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;

}

.input-group-inline {
    flex: 1;
    min-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.input-group-inline label {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #495057;
}

.nutrient-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    text-align: center;
    font-size: 1.1rem;
    box-sizing: border-box;
}

.nutrient-input:focus {
    border-color: #1877f2;
    outline: none;
    box-shadow: 0 0 0 2px #e7f3ff;
}

/* Results Card Styles */
.results-card {
    margin-top: 2rem;
    border-top: 3px solid #28a745;
}

.total-cost-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #28a745;
    margin: 0 0 1.5rem 0;
}

.sub-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: #343a40;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.result-input {
    background-color: #f8f9fa;
    border-color: #e9ecef;
    color: #495057;
    font-weight: 500;
}

.result-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.result-list li {
    background-color: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

/* Fertilizer Card Styles */
#fertilizer-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.fertilizer-card {
    background-color: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: opacity 0.3s, box-shadow 0.3s;
}

.fertilizer-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.fertilizer-card.disabled {
    opacity: 0.5;
    background-color: #f8f9fa;
}

.fertilizer-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.fertilizer-name {
    margin: 0;
    font-size: 1.1rem;
    color: #343a40;
}

.fertilizer-card-body {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
}

.param-group {
    flex: 1;
}

.param-group label {
    display: block;
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.param-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
}

.fertilizer-card-footer {
    display: flex;
    justify-content: space-around;
    background-color: #f8f9fa;
    padding: 0.75rem;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.nutrient-profile {
    font-size: 0.85rem;
    color: #495057;
    font-weight: 500;
}

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #28a745;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Form Container */
.form-container {
    background-color: #ffffff;
    padding: 1.5rem 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;    
    margin: 2rem auto; /* Provide consistent vertical spacing */
}

/* Form Heading */
.form-container h1, .form-container h2 {
    margin-bottom: 1.25rem;
    color: #1c1e21;
    font-size: 2rem;
}

/* Input Group for labels and inputs */
.input-group {
    margin-bottom: 1rem;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #606770;
    font-weight: 600;
}

.input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box; /* Ensures padding doesn't affect width */
}

.error-message {
    color: #dc3545; /* A standard red for errors */
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: none; /* Hide by default */
    text-align: left;
}

input.invalid {
    border-color: #dc3545 !important;
}

input.invalid:focus {
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25) !important;
}

.input-group input:focus {
    border-color: #1877f2;
    outline: none;
    box-shadow: 0 0 0 2px #e7f3ff;
}

/* Primary Button (Login, Sign Up, etc.) */
.btn {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 6px;
    background-color: #28a745; /* Green for agriculture theme */
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-secondary {
    background-color: #6c757d;
    margin-top: 1.5rem;
    width: auto;
    padding: 0.75rem 1.5rem;
}
.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background-color: #dc3545; /* Red for sign out */
    color: white;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #218838;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-small:hover {
    background-color: #c82333;
}

/* Links within the form */
.form-links {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-links a {
    color: #1877f2;
    text-decoration: none;
    font-size: 0.9rem;
}

.form-links a:hover {
    text-decoration: underline;
}

/* Helper text for OTP page */
.info-text {
    color: #606770;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

/* User detail text on buy-credit page */
.user-detail-text {
    margin: 0.25rem 0 0 0;
    font-size: 1rem;
    color: #333;
}

/* Server Message Styles */
.server-message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
    display: none; /* Hidden by default */
}
.server-message.error {
    background-color: #f8d7da; /* Light red background */
    color: #721c24; /* Dark red text */
}
.server-message.success {
    background-color: #d4edda; /* Light green background */
    color: #155724; /* Dark green text */
}

/* Show the dropdown menu (used with JavaScript) */
.show {
    display: block;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

/* Landing Page Styles */
.landing-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    box-sizing: border-box;
    color: #333;
}

.landing-section {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

.landing-section h1, .landing-section h2, .landing-section h3 {
    color: #1c1e21;
    border-bottom: 2px solid #f0f2f5;
    padding-bottom: 0.5rem;
    margin-top: 0;
}

.landing-section h1 {
    font-size: 2.2rem;
    border: none;
}

.landing-section h2 {
    font-size: 1.8rem;
}

.landing-section h3 {
    font-size: 1.3rem;
    border-bottom: 1px solid #e9ecef;
}

.landing-section p, .landing-section ul {
    line-height: 1.6;
    font-size: 1.05rem;
}

.landing-section ul {
    padding-left: 20px;
}

.landing-section ul ul {
    margin-top: 0.5rem;
}

.subtitle {
    font-size: 1.2rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 2rem;
}

.nutrient-list {
    list-style-type: none;
    padding-left: 0;
}

.cta-section {
    text-align: center;
}

.btn-header-signup {
    padding: 8px 16px;
    font-size: 0.9rem;
    width: auto;
}

/* Table Styles for Landing Page */
.landing-section table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    background-color: #fff;
}

.landing-section th,
.landing-section td {
    border: 1px solid #e9ecef;
    padding: 12px 15px;
    text-align: left;
}

.landing-section th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
}

.landing-section tbody tr:nth-child(even) {
    background-color: #fcfcfc;
}

.landing-section tbody tr:hover {
    background-color: #f0f2f5;
}

.landing-section .total-row td {
    font-weight: bold;
    background-color: #e9f7ef; /* Light green for total */
    color: #28a745;
}

.landing-section .highlight-row td {
    font-weight: bold;
    background-color: #d4edda; /* Even lighter green for highlight */
    color: #155724;
}

.landing-section .note-text {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* Inline Nutrient List for Landing Page */
.nutrient-inline-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem; /* Row and column gap */
    background-color: #f8f9fa;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    justify-content: center;
    margin: 1.5rem 0;
    border: 1px solid #e9ecef;
}

.nutrient-inline-list span {
    font-size: 0.95rem;
    color: #343a40;
}

/* New styles for help.html */
.help-container {
    max-width: 900px; /* Slightly smaller than landing for focused content */
    margin: 0 auto;
    padding: 2rem;
    box-sizing: border-box;
    color: #333;
}

.help-section {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

.help-section h1, .help-section h2, .help-section h3 {
    color: #1c1e21;
    border-bottom: 2px solid #f0f2f5;
    padding-bottom: 0.5rem;
    margin-top: 0;
}

.help-section h1 {
    font-size: 2.2rem;
    border: none;
    margin-bottom: 1.5rem;
}

.help-section h2 {
    font-size: 1.8rem;
    margin-top: 2rem;
}

.help-section p, .help-section ul {
    line-height: 1.7;
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

.help-section ul {
    list-style-type: disc;
    padding-left: 1.5rem;
}

.help-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.tip-text {
    background-color: #fff3cd; /* Light yellow background */
    color: #856404; /* Dark yellow text */
    padding: 0.75rem 1rem;
    border-left: 4px solid #ffeeba;
    border-radius: 4px;
    margin-top: 1.5rem;
    font-size: 0.95rem;
}

/* Site Footer Info */
.site-footer-info {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
    font-size: 0.9rem;
    border-top: 1px solid #e9ecef;
    margin-top: auto; /* Pushes footer to bottom of flex container */
}

.site-footer-info p {
    margin: 0.3rem 0;
}

.site-footer-info a {
    color: #495057;
    text-decoration: none;
}
.footer-legal-links {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}
.site-footer-info a:hover {
    text-decoration: underline;
}

/* --- Responsive Design Media Queries --- */

/* For tablets and mobile phones (<= 768px) */
@media (max-width: 768px) {
    /* Reduce header padding and font size */
    .site-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .site-header h1 {
        font-size: 1.25rem;
    }

    .user-info {
        flex-wrap: wrap; /* Allow items to wrap */
        gap: 0.5rem 1rem; /* Adjust gap for wrapped items */
        font-size: 0.9rem;
        width: 100%;
    }

    /* Adjust main content padding */
    .dashboard-container,
    .landing-container,
    .help-container {
        padding: 1rem;
    }

    .main-content {
        padding: 0; /* Remove padding as containers will have their own */
    }

    .dashboard-section,
    .landing-section,
    .help-section {
        padding: 1.5rem;
    }

    /* Stack nutrient inputs vertically */
    .input-row {
        flex-direction: column;
        gap: 1.5rem;
    }

    /* Switch fertilizer list to a single column */
    #fertilizer-list-container {
        grid-template-columns: 1fr;
    }

    /* Reduce padding on form containers for small screens */
    .form-container {
        padding: 1rem 1rem;
        margin: 1rem auto; /* Center it horizontally, with vertical margin */
    }
}
