* { box-sizing: border-box; }

body {
	background: beige;
}

/* home page styles */
.link-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.link-grid .link-card {
    display: inline-block;
    width: fit-content;
    padding: 10px 15px;
}

/* login and signup page styles */
.auth-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 2rem;
    border: 1px solid #ddd;
    border-radius: 13px;
    background-color: chocolate;
}
.auth-header {
    text-align: center;
	margin-bottom: 1.5rem;
}
.form-group {
	margin-bottom: 1rem;
}

.form-error {
	color: red; 
	background: #ffeeee; 
	padding: 10px; 
	margin-bottom: 15px; 
	border: 1px solid red; 
	border-radius: 13px;
}

.form-message {
	color: green; 
	background: #85f64fba; 
	padding: 10px; 
	margin-bottom: 15px; 
	border: 1px solid green;
	border-radius: 13px;
	margin-top: 2px;
}

.form-message:empty {
	display: none;
}

/* --- Base Button Styling (.btn) --- */
.btn {
    display: inline-block;
    padding: 0px 3px;
    border-radius: 5px;
    text-decoration: none; /* Removes the default link underline */
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    border: none;
    font-size: 1rem;
}

/* Button click effect */
.btn:active {
    transform: scale(0.98);
}

/* --- Primary Button (.btn-primary) --- */
/* Used for main actions like "Submit" or "Sign Up" */
.btn-primary {
    background-color: #3498db; /* Blue */
    color: #ffffff !important;
}

.btn-primary:hover {
    background-color: #2980b9; /* Darker blue on hover */
}

/* --- Secondary Button (.btn-secondary) --- */
/* Used for alternative actions like "Profile" or "Login" */
.btn-secondary {
    background-color: #ecf0f1; /* Light Gray */
    color: #2c3e50 !important; /* Dark text */
    border: 1px solid #bdc3c7;
}

.btn-secondary:hover {
    background-color: #bdc3c7; /* Darker gray on hover */
}

/* Danger Button Base Styles */
.btn-danger {
    background-color: #dc3545; /* A standard, accessible strong red */
    color: #ffffff;
    border: 1px solid #dc3545;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

/* Hover and Focus States for Accessibility */
.btn-danger:hover, 
.btn-danger:focus {
    background-color: #c82333; /* Slightly darker red on hover */
    border-color: #bd2130;
    color: #ffffff;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5); /* Soft red glow on focus */
}

/* Active (Click) State */
.btn-danger:active {
    background-color: #bd2130; /* Even darker red when actively clicked */
    border-color: #b21f2d;
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); /* Inner shadow to look pressed */
}

/* Optional: Small Danger Button adjustments (since you used btn-sm) */
.btn-danger.btn-sm {
    padding: 1px 4px;
    font-size: 0.875rem;
    border-radius: 5px;
}

/* --- Large Button (.btn-large) --- */
/* Used in your forms for big submit buttons */
.btn-large {
    padding: 15px 30px;
    font-size: 1.1rem;
    width: 100%; /* Makes it stretch across forms */
}

/* Base navbar styles (Mobile First) - Vertical Layout */
.main-nav {
    background-color: khaki;
    padding: 1rem;
    border-bottom: 1px solid #ddd;
	display: flex;
    flex-direction: column;
    align-content: center;
    flex-wrap: wrap;
    align-items: center;
	border-radius: 13px;
	margin: 0 auto;
	box-sizing: border-box;
	width: -webkit-fill-available;
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    display: block; /* Visible on mobile */
}

/* Hidden by default on mobile, shown via JS class 'nav-open' */
.nav-content {
    display: none; 
    flex-direction: column;
    margin-top: 1rem;
}

.nav-content.nav-open {
    display: flex;
	align-items: center;
	font-size: large;
	gap: 18px;
}

.search-container {
    margin: 0;
	position: relative;
}

select#search-by {
    cursor: pointer;
	margin-bottom: 3px;
    padding: 1px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

input#search-bar {
    cursor: pointer;
	border-radius: 5px;
}

#search-results-list {
    position: absolute;       /* Floats the element */
    top: 100%;               /* Positions it directly below the search bar */
    left: 0;
    width: 100%;             /* Matches search bar width */
    min-width: 200px;        /* Ensures it's wide enough to read results */
    background-color: #e4d8d8;
    border-radius: 5px;
    box-shadow: 3px 6px 6px rgba(0, 0, 0, 0.1);; /* Adds depth */
    z-index: 1000;           /* Ensures it sits on top of everything else */
    max-height: 500px;       /* Prevents it from getting too long */
    overflow-y: auto;        /* Adds scrollbar if too many results */
}

/* Hides the box completely when there are no results */
#search-results-list:empty {
    display: none;
}

/* Shows the box as a grid only when it has content */
#search-results-list:not(:empty) {
    display: grid;
	gap: 10px;
	padding: 5px;
}

.nav-links, .nav-auth {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column; /* Vertical list */
    gap: 1rem;
}

/* Highlight for standard navbar links and cart */
.nav-links li a,
.cart-nav-link a,
.nav-auth li a:not(.btn) {
	border: 2px solid transparent;
	padding: 0 0;
}

.nav-links li.active a,
.cart-nav-link.active a,
.nav-auth li.active a:not(.btn) {
    background-color: black; /* A unique highlight color (e.g., green) */
    color: #ffffff !important;
    border-radius: 5px;
	border-color: black;
	padding: 0 0;
}

/* Highlight for auth buttons (Profile, Login, etc.) */
/* Uses an outline so it doesn't override your existing button colors */
.nav-auth li.active a.btn {
    outline: 2px solid black;
    outline-offset: 2px;
}

/* styles for more info and save btn container*/
.headerDiv {
	display: flex; 
	justify-content: space-between;
	align-items: center;
	margin-top: 13px;
	gap: 15px;
}

.backBtn {
	margin-top: 13px;
	padding: 4px;
	border-radius: 7px;
	background: chocolate;
	color: beige;
	cursor: pointer;
}

.backBtn:hover, .backBtn:focus {
	background: black;
	color: burlywood;
}

/* more info button Styles */
button.moreInfo {
	cursor: pointer;
	background: chocolate;
    color: antiquewhite;
	border-radius: 7px;
	padding: 4px;
}

button.moreInfo:hover, button.moreInfo:focus {
	background: black;
	color: burlywood;
}

/* list View Styles */

.two-column-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

/* Save Button Styling */
.btn-save {
    background-color: #e0e0e0;
    color: #333;
    border: 1px solid #ccc;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-weight: bold;
}

.btn-save:hover {
    background-color: #d0d0d0;
}

/* State when the item is saved */
.btn-save.active {
    background-color: #2ecc71; /* Green */
    color: white;
    border-color: #27ae60;
}

.btn-save.active::before {
    content: "✓ ";
}

/* Review Styles */

input#review_title {
    width: 96%;
    margin-top: 2px;
}

textarea#review_comment {
    width: 96%;
}

.review-header {
    display: flex;
    justify-content: space-between;
    flex-direction: row;
}

h5.review-title {
    font-size: medium;
}

span.review-author {
	font-weight: 600;
}

.review-item:not(:first-child) {
      border-top: 2px dotted black;
}

/* PROFILE PAGE STYLES */
#profile-page > div > section > h2 {
    border: 2px dashed black;
    padding: 3px;
}

#contribution-history > h2 {
	border: 2px dashed black;
    padding: 3px;
}

#review-history > h2 {
	border: 2px dashed black;
    padding: 3px;
}

ul.linked-list {
    display: grid;
    gap: 10px;
	max-height: 270px;
    overflow-y: auto;
    outline: 1px dotted black;
    outline-offset: 2px;
}

/* For better visuals on list views */
ul.linked-list.two-column-list {
    margin-bottom: 60px;
}

.contribute-links {
  display: grid;
  gap: 15px;
  padding: 10px 0;

}

.contribute-links a {
    display: inline-block;
    width: fit-content;
    margin: 5px 2px;
}

/* For mobile devices (default single column) */
.contribute-links {
  grid-template-columns: repeat(2, 1fr);
}

/* Glossary styles */
nav.az-jump-nav {
    display: flex;
    flex-direction: column;
    margin-top: 24px;
    align-items: center;
}

ul.pagination {
    display: flex;
    gap: 27px;
    flex-wrap: wrap;
}

.glossary-image {
  max-width: 100%; /* Ensure container doesn't exceed parent's width */
  width: 100%;     /* Take up full available width */
  height: auto;    /* Allow height to adjust based on content */
  box-sizing: border-box; /* Good practice to include, prevents padding/border from increasing total size */
}

.glossary-image img {
  display: block;   /* Ensures image takes up its own line and respects width/height */
  max-width: 100%;  /* Image will not overflow its parent */
  height: auto;     /* Maintains aspect ratio */
  object-fit: contain; /* Or 'cover' or 'scale-down' depending on desired visual */
}

section#edit-glossary-entry {
    border: 2px dotted black;
    padding: 9px;
}

/* --- cart table styles --- */
table.cart-table{
	width: -webkit-fill-available;
	border-collapse: collapse;
    border-spacing: 0;
}

#pending-contributions pre {
	white-space: pre-wrap;
    overflow: auto;
    word-break: auto-phrase;
    max-width: 100%;
}

/* --- new disease page styles --- */
#new-disease-form > fieldset:nth-child(4) input[type=text] {
	width: -webkit-fill-available;
}

/* --- DESKTOP STYLES (Laptop and larger) --- */
@media (min-width: 1058px) {
    .main-nav {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: row;
    }

    /* Hide the mobile header/hamburger on desktop */
    .mobile-nav-header {
        display: none; 
    }

    /* Always show content on desktop */
    .nav-content {
        display: flex !important; /* Override JS toggle */
        flex-direction: row;      /* Horizontal layout */
        align-items: center;
        width: 100%;
        justify-content: space-between;
        margin-top: 0;
		font-size: medium;
    }

    .nav-links {
        flex-direction: row; /* Horizontal links */
        gap: 32px;
    }

    .nav-auth {
        flex-direction: row; /* Horizontal auth buttons */
        gap: 16px;
    }

    .search-container {
        margin: 0;
		width: min-content;
    }
	
	#search-results-list {
		min-width: 300px;
	}
	
	.link-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 equal columns on desktop home page*/
    }
	
	.two-column-list {
        grid-template-columns: 1fr 1fr; /* Two columns on larger screens */
    }
	
	.contribute-links {
		grid-template-columns: repeat(3, 1fr); /* Three equal columns */
    }
	
	/* cart table styles Desktop*/
	table.cart-table th,
	table.cart-table td {
		padding-right: 21px; /* Adjust top/bottom and left/right padding as needed */
	}
}

/* Target screens smaller than 768px (tablets and mobile phones) */
@media screen and (max-width: 768px) {
    
    /* 1. Stack the main search input and 'Add to Recipe' button */
    .ingredient-input-group {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    /* 2. Allow the primary ingredient row to wrap its contents */
    .primary-ingredient-block > div:first-child {
        flex-wrap: wrap !important;
    }

    /* 3. Allow the alternative ingredient row to wrap its contents */
    .alts-container .alt-ingredient-row {
        flex-wrap: wrap !important;
        margin-left: 5px !important; /* Reduce left indent to save screen space */
        padding-left: 10px !important;
    }

    /* 4. Force text inputs to take up the full width of their row */
    .primary-ingredient-block input[type="text"],
    .alt-ingredient-row input[type="text"],
    .alt-ingredient-row input.alt-search {
        flex: 1 1 100% !important;
        margin-bottom: 5px !important;
        width: 100% !important;
    }

    /* 5. Make buttons stretch for easier touch targets on mobile */
    .primary-ingredient-block button,
    .alt-ingredient-row button {
        flex: 1 1 45% !important; /* Keeps buttons side-by-side if they fit, or stacks them */
        margin-top: 5px !important;
    }
    
    /* Make the 'Remove Alternative' button full width to match the inputs above it */
    .alt-ingredient-row .btn-remove-alt {
        flex: 1 1 100% !important; 
    }
	
	#new-remedy-form > fieldset:nth-child(5) {padding: 2px;}
	#new-disease-form > fieldset:nth-child(5) {padding: 2px;}
}

/* --- mobile STYLES --- */
@media (max-width: 600px) {

.nav-links{
	margin-top: 1rem;
}

.nav-auth {
	margin-top: 1rem;
}

/* cart table styles Desktop*/
.cart-table {
    border: 0; /* Remove table borders */
  }

  .cart-table thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px; /* Visually hide the table header */
  }

  .cart-table tr {
    border-bottom: 3px dashed black; /* Separator between "cards" */
    display: block; /* Each row becomes a block element */
    margin-bottom: .625em;
  }

  .cart-table td {
    border-bottom: 1px dotted black; /* Separator between "fields" within a card */
    display: block; /* Each cell becomes a block element */
    text-align: right; /* Align cell content */
    padding-left: 25%; /* Make space for the pseudo-element label */
	padding-bottom: 10px;
	padding-top: 10px;
    position: relative; /* For absolute positioning of the label */
  }

  .cart-table td::before {
    /* Style and position the data labels */
    content: attr(data-label); /* Uses data-label attribute for content */
    position: absolute;
    left: 6px;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    text-align: left;
    font-weight: bold;
  }
	
}

/* ==========================================================================
   Duplicate Marker & Reporting Modal Styles
   ========================================================================== */

.duplicate-marker-container {
    display: inline-flex;
    align-items: center;
    margin: 0 5px;
}

.duplicate-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    font-weight: 600;
    color: #555;
    background: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.duplicate-checkbox-label:hover {
    background: #f0f0f0;
    border-color: #999;
    color: #222;
}

.duplicate-checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: #c62828;
}

.duplicate-checkbox-label.reported {
    background: #ffebee;
    border-color: #ffcdd2;
    color: #c62828;
    cursor: default;
}

.duplicate-checkbox-label.reported input[type="checkbox"] {
    cursor: default;
}

/* Modal Overlay */
.dup-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 15px;
    box-sizing: border-box;
}

/* Modal Content Card */
.dup-modal-content {
    background: #ffffff;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    padding: 24px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    font-family: inherit;
    box-sizing: border-box;
}

.dup-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.dup-modal-header h3 {
    margin: 0;
    font-size: 1.3em;
    color: #333;
}

.dup-modal-close {
    background: none;
    border: none;
    font-size: 1.6em;
    cursor: pointer;
    color: #888;
    line-height: 1;
    padding: 0 5px;
}

.dup-modal-close:hover {
    color: #000;
}

.dup-modal-desc {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 16px;
    line-height: 1.4;
}

.dup-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    max-height: 180px;
    overflow-y: auto;
    z-index: 10000;
}

.dup-autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95em;
    color: #333;
}

.dup-autocomplete-item:hover,
.dup-autocomplete-item.active {
    background: #f5f5f5;
    color: #000;
    font-weight: 500;
}

.dup-toast {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: #333;
    color: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    z-index: 10001;
    font-size: 0.95em;
    transition: opacity 0.3s ease;
}

.dup-toast.success {
    background: #27ae60;
}

.dup-toast.error {
    background: #c62828;
}

/* ==========================================================================
   Signup 6-Digit OTP Verification Modal Styles
   ========================================================================== */

.otp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    padding: 16px;
    box-sizing: border-box;
    animation: otpModalFadeIn 0.25s ease-out forwards;
}

@keyframes otpModalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.otp-modal-card {
    background: #ffffff;
    border-radius: 12px;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.08);
    padding: 32px 26px;
    text-align: center;
    position: relative;
    box-sizing: border-box;
    font-family: inherit;
}

.otp-modal-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #e8f5e9;
    color: #2e7d32;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
}

.otp-modal-title {
    margin: 0 0 8px;
    font-size: 1.45rem;
    font-weight: 700;
    color: #1e293b;
}

.otp-modal-desc {
    margin: 0 0 18px;
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.5;
}

.otp-modal-desc strong {
    color: #0f172a;
    word-break: break-all;
}

.otp-timer-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 22px;
    transition: all 0.2s ease;
}

.otp-timer-highlight {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
}

.otp-timer-badge.warning {
    background: #fff7ed;
    border-color: #fdba74;
    color: #c2410c;
}

.otp-timer-badge.warning .otp-timer-highlight {
    color: #c2410c;
}

.otp-timer-badge.expired {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.otp-timer-badge.expired .otp-timer-highlight {
    color: #b91c1c;
}

.otp-input-container {
    margin-bottom: 20px;
}

.otp-number-input {
    width: 100%;
    max-width: 290px;
    height: 56px;
    margin: 0 auto;
    display: block;
    font-family: 'Courier New', Courier, monospace;
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 10px;
    padding: 4px 12px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
    box-sizing: border-box;
    color: #0f172a;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.otp-number-input:focus {
    border-color: #27ae60;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.15);
}

.otp-number-input::placeholder {
    letter-spacing: 8px;
    color: #94a3b8;
    opacity: 0.6;
}

.otp-alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 16px;
    line-height: 1.4;
    text-align: left;
}

.otp-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.otp-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.otp-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-otp-submit {
    width: 100%;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: #27ae60;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-otp-submit:hover:not(:disabled) {
    background: #219150;
}

.btn-otp-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.otp-footer-links {
    margin-top: 14px;
    font-size: 0.9rem;
    color: #64748b;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.btn-otp-link {
    background: none;
    border: none;
    color: #27ae60;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    text-decoration: underline;
    transition: color 0.15s ease;
}

.btn-otp-link:hover:not(:disabled) {
    color: #1b5e20;
}

.btn-otp-link:disabled {
    color: #94a3b8;
    text-decoration: none;
    cursor: not-allowed;
}

.btn-otp-cancel {
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.88rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.btn-otp-cancel:hover {
    color: #334155;
}