:root {
    --primary-color: #c8102e; /* Strong Red */
    --secondary-color: #333333; /* Dark Gray / Black */
    --background-color: #ffffff;
    --text-color: #333;
    --card-bg: #fff;
    --border-color: #ddd;
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    margin: 0;
    color: var(--text-color);
    background-color: var(--background-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    width: 250px;
    height: auto;
}

nav {
    display: flex;
    align-items: center;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
}

nav ul li {
    margin-left: 25px;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 10px 5px;
    border-radius: 4px;
    transition: color 0.3s;
    position: relative;
    margin: 0 10px;
    background-color: transparent; /* Remove background for underline effect */
}

nav ul li a .arrow-down {
    font-size: 0.7em;
    margin-left: 5px;
    display: inline-block;
    transition: transform 0.3s;
}

nav ul li.dropdown:hover a .arrow-down {
    transform: rotate(180deg);
}

nav ul li a::after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 3px;
    bottom: -5px;
    left: 0;
    background-color: white;
    transform-origin: bottom right;
    transition: transform 0.25s ease-out;
}

nav ul li a:hover, nav ul li a.active {
    color: white;
    background-color: transparent;
}

nav ul li a:hover::after, nav ul li a.active::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--primary-color);
    list-style: none;
    padding: 10px 0;
    margin: 0;
    min-width: 220px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-radius: 0 0 5px 5px;
    z-index: 1001;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu li a {
    color: white;
    padding: 12px 20px;
    display: block;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.dropdown-menu li a:hover {
    background-color: rgba(255,255,255,0.1);
}

.dropdown-menu li a::after {
    content: none; /* No underline effect on dropdown items */
}

.menu-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1010;
}

.menu-toggle .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: white;
    transition: all 0.3s ease-in-out;
}

main {
    padding: 0;
}

#home-hero-container {
    padding: 0;
}

.section-title {
    text-align: center;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin-bottom: 2rem;
    position: relative;
    padding-top: 2rem; /* Add padding to space from hero */
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    margin: 10px auto 0;
}

/* --- Home Page Specific Styles --- */
.hero-section {
    position: relative;
    color: white;
    padding: 6rem 2rem;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 82px); /* 82px is header height */
    box-sizing: border-box;
    overflow: hidden;
    background-image: url('ursa-ag-tractor.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.hero-text {
    position: relative;
    z-index: 2;
}

.hero-text h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-family: 'Roboto Condensed', sans-serif;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}

.hero-text p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-cta {
    font-size: 1.1rem;
    padding: 15px 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.3s, box-shadow 0.3s;
}

.hero-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

/* --- Why Choose Us Section --- */
.why-us-section {
    margin: 4rem 0;
}

.why-us-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.why-us-card {
    text-align: center;
    padding: 1.5rem;
}

.why-us-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
}

.why-us-card h3 {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 1.4rem;
    color: var(--secondary-color);
}

.services-section {
    margin-bottom: 3rem;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.service-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
    border-top: 4px solid var(--primary-color);
    transition: transform 0.3s, box-shadow 0.3s;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.12);
}

.service-card h3 {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-top: 0;
}

.learn-more-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    margin-top: 1rem;
    display: inline-block;
    cursor: pointer;
}

.learn-more-link:hover {
    text-decoration: underline;
}

/* --- Testimonials Section --- */
.testimonials-section {
    margin-bottom: 3rem;
    background-color: #f9f9f9;
    padding: 3rem 0;
}

.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.testimonial-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 5px solid var(--primary-color);
}

.testimonial-card blockquote {
    margin: 0 0 1rem 0;
    font-style: italic;
    color: #555;
    font-size: 1.05rem;
}

.testimonial-card blockquote::before {
    content: '“';
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: bold;
    line-height: 1;
    margin-right: 5px;
}

.testimonial-card cite {
    font-weight: bold;
    color: var(--secondary-color);
    font-style: normal;
}

.featured-inventory {
    margin-bottom: 3rem;
}

#featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* --- End Home Page Styles --- */

section.page {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0,0,0,0.07);
}

.inventory-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

#search-bar {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    box-sizing: border-box;
}

#filter-buttons {
    display: none; /* Replaced by dropdown */
}

.inventory-controls label {
    font-weight: 500;
    margin-right: 10px;
}

.inventory-controls select, .inventory-controls input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

.upload-wrapper {
    align-self: flex-end;
}

@media (min-width: 768px) {
    .upload-wrapper {
        align-self: center;
    }
}

.upload-btn {
    background-color: var(--secondary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.upload-btn:hover {
    background-color: #1a1a1a;
}

#inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Card */
.tractor-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

/* Ensure images are visible and sized correctly */
.tractor-card .card-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 1 !important;
    visibility: visible !important;
}

.image-gallery .main-detail-image,
.thumbnail-image {
    width: 100%;
    height: auto;
    display: block;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Some older themes hid images on desktop via media queries.
   These overrides force them back on. */
@media (min-width: 769px) {
  .tractor-card .card-image-container,
  .tractor-card .card-image-container img {
    display: block !important;
  }
}

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

.tractor-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.tractor-card.sold .card-image-container img {
    transform: scale(1);
}

.tractor-card.sold:hover .card-image-container img {
    transform: scale(1);
}

.card-image-container {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.card-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 5;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out, background-color 0.2s;
}

.tractor-card:hover .card-gallery-nav {
    opacity: 1;
}

.card-gallery-nav:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.card-prev {
    left: 10px;
}

.card-next {
    right: 10px;
}

.tractor-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.tractor-card:hover img {
    transform: scale(1.05);
}

.tractor-details {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.tractor-details h3 {
    margin-top: 0;
    color: var(--primary-color);
    font-family: 'Roboto Condensed', sans-serif;
}

.tractor-details p {
    margin: 0.5rem 0;
}

.tractor-details .price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.tractor-details .description {
    font-size: 0.9rem;
    color: #666;
    margin-top: 1rem;
    line-height: 1.4;
    flex-grow: 1;
}

.tractor-card-actions {
    padding: 0 1rem 1rem;
    margin-top: auto;
    display: flex;
    gap: 0.5rem;
}

.inquire-btn, .edit-btn {
    flex-grow: 1;
    text-align: center;
    padding: 10px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s;
    box-sizing: border-box;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Roboto', sans-serif;
}

.inquire-btn {
    display: block;
    background-color: var(--secondary-color);
    color: white;
}

.inquire-btn:hover {
    background-color: #1a1a1a;
}

.inquire-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    color: #e0e0e0;
}

.edit-btn {
    background-color: #6c757d;
    color: white;
    display: none; /* Hide edit buttons by default */
}

.edit-btn:hover {
    background-color: #5a6268;
}

.delete-btn {
    background-color: #c8102e; /* Use primary red for delete */
    color: white;
    display: none; /* Hide delete buttons by default */
}

.delete-btn:hover {
    background-color: #a00c24;
}

/* Admin-only styles */
.admin-only {
    display: none !important;
}

.admin-view .admin-only {
    display: block !important;
}

.admin-view .tractor-card-actions .edit-btn,
.admin-view .tractor-card-actions .delete-btn {
    display: block !important;
}

.admin-view .detail-actions .edit-btn,
.admin-view .detail-actions .delete-btn {
     display: inline-block !important;
}

/* Contact Page Enhancements */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: flex-start;
}

@media (min-width: 992px) {
    .contact-grid {
        grid-template-columns: 1fr 1.2fr;
    }
}

.contact-form .form-group {
    margin-bottom: 1rem;
}

.contact-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

.contact-form button {
    width: 100%;
    border: none;
}

.form-status {
    margin-top: 1rem;
    text-align: center;
    font-weight: bold;
}

.contact-info, .map-container {
    margin-top: 1.5rem;
}

.map-container iframe {
    width: 100%;
    height: 400px;
    border-radius: 8px;
}

.cta-button {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 12px 25px;
    text-decoration: none;
    border-radius: 5px;
    margin-top: 1rem;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.2s;
}

.cta-button:hover {
    background-color: #a00c24;
    transform: translateY(-2px);
}

.back-button {
    margin-bottom: 2rem;
}

footer {
    background-color: var(--secondary-color);
    color: #ccc;
    padding: 3rem 0 0;
    margin-top: 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding-bottom: 2rem;
    text-align: left;
}

.footer-logo {
    width: 250px;
    margin-bottom: 1rem;
}

.footer-about p {
    font-size: 0.9rem;
    line-height: 1.7;
}

.footer-links h4, .footer-contact h4 {
    color: white;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a, .footer-contact a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover, .footer-contact a:hover {
    color: white;
}

.footer-contact p {
    margin: 0.5rem 0;
}

.footer-bottom {
    border-top: 1px solid #444;
    padding: 1.5rem 0;
    text-align: center;
}

.footer-bottom p {
    margin: 0;
    font-size: 0.9rem;
}

footer p {
    margin: 0.25rem 0;
}

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

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 2rem;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    animation: slideIn 0.4s ease;
}

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

.close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
}

/* Animation for scroll */
[data-animate] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-animate].visible {
    opacity: 1;
    transform: translateY(0);
}

#back-to-top {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    padding: 15px;
    border-radius: 50%;
    font-size: 18px;
    width: 50px;
    height: 50px;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background-color 0.3s, transform 0.3s;
}

#back-to-top:hover {
    background-color: #a00c24;
    transform: scale(1.1);
}

/* Inventory Detail Page Styles */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

@media (min-width: 768px) {
    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.detail-images .main-detail-image {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: block;
}

.image-gallery {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.main-image-wrapper {
    position: relative;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s;
    z-index: 10;
}

.gallery-nav:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.gallery-nav.prev {
    left: 10px;
}

.gallery-nav.next {
    right: 10px;
}

.thumbnail-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.thumbnail-image {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.3s, transform 0.3s;
}

.thumbnail-image:hover {
    transform: scale(1.05);
}

.thumbnail-image.active {
    border-color: var(--primary-color);
}

.detail-specs h2 {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-top: 0;
    line-height: 1.2;
}

.detail-specs .price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin: 0.5rem 0 1.5rem;
}

.detail-specs h3 {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 1.5rem;
    color: var(--secondary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.detail-specs p {
    line-height: 1.7;
    font-size: 1rem;
}

.spec-list {
    list-style: none;
    padding: 0;
}

.spec-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.inquire-btn-detail {
    margin-top: 2rem;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-body img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 5px;
}

.modal-body h2 {
    color: var(--primary-color);
    margin-top: 0;
    font-family: 'Roboto Condensed', sans-serif;
}

.modal-body p {
    margin: 0.25rem 0;
}

.inquire-btn-modal {
    margin-top: 1.5rem;
}

.modal-body .price {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--secondary-color);
}

/* Modal Form Styles */
#upload-modal .form-group {
    margin-bottom: 1rem;
}

#upload-modal label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

#upload-modal input,
#upload-modal textarea,
#upload-modal select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

#upload-modal select:invalid {
    color: #888;
}

#upload-modal .checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#upload-modal .checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

#upload-modal .checkbox-group label {
    margin-bottom: 0;
    font-weight: normal;
}

#upload-form .form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

#upload-form .form-actions .cta-button {
    flex: 1;
    margin-top: 0;
}

/* ===== Mobile Navigation & Layout ===== */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .logo {
        width: 250px; /* Adjust logo size on smaller screens */
        height: auto;
    }

    .menu-toggle {
        display: block;
    }

    nav.nav-open .menu-toggle .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    nav.nav-open .menu-toggle .bar:nth-child(2) {
        opacity: 0;
    }
    nav.nav-open .menu-toggle .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    
    nav ul {
        position: fixed;
        top: 0;
        right: 0;
        width: 70%;
        max-width: 300px;
        height: 100vh;
        background-color: var(--primary-color);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 1rem;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: -5px 0 15px rgba(0,0,0,0.2);
        padding: 2rem 0;
    }

    nav.nav-open ul {
        transform: translateX(0);
    }

    nav ul li {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }

    nav ul li a {
        font-size: 1.5rem;
        display: block;
        padding: 10px 0;
    }

    /* Mobile Dropdown */
    .dropdown:hover .dropdown-menu {
        display: none; /* Disable hover on mobile */
    }

    .dropdown-menu {
        position: static;
        display: none; /* Hide by default, shown by JS */
        background-color: transparent;
        box-shadow: none;
        padding: 0;
        margin-top: 0.5rem;
        border-radius: 0;
        min-width: unset;
        width: 100%;
    }
    
    .dropdown-menu li a {
        font-size: 1.1rem;
        font-weight: 400;
        padding: 8px 0;
        color: rgba(255, 255, 255, 0.85);
    }
    
    nav ul li a .arrow-down {
        transition: transform 0.3s ease;
    }

    .inventory-controls {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Tablet/Desktop adjustments for inventory controls */
@media (min-width: 768px) {
    .inventory-controls {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    #search-bar {
        max-width: 400px;
    }
}

@media (min-width: 480px) {
    .detail-actions {
        flex-direction: row;
    }
    .detail-actions .cta-button {
       flex: 1;
    }
}

.detail-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.detail-actions .cta-button {
    margin-top: 0;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

.detail-actions .edit-btn {
    background-color: #6c757d;
}

.detail-actions .edit-btn:hover {
    background-color: #5a6268;
}

.detail-actions .delete-btn {
    background-color: #c8102e; /* Use primary red for delete */
    color: white;
    display: none; /* Hide delete buttons by default */
}

.detail-actions .delete-btn:hover {
    background-color: #a00c24;
}

#current-images-container {
    margin-bottom: 1rem;
}

#current-images-container h6 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.modal-thumbnail-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.modal-thumbnail {
    width: 70px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

/* New styles for image management */
.file-upload-label {
    display: inline-block;
    cursor: pointer;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: #6c757d;
    border: none;
}
.file-upload-label:hover {
    background-color: #5a6268;
}

#image-management-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px dashed var(--border-color);
    border-radius: 5px;
    min-height: 97px; /* approx height of one thumbnail + padding */
    box-sizing: border-box;
}

#image-management-container:empty::before {
    content: "No images yet. Add some!";
    color: #888;
    align-self: center;
    width: 100%;
    text-align: center;
}

.image-thumb-wrapper {
    position: relative;
    width: 100px;
    height: 75px;
    animation: fadeIn 0.3s ease;
}

.image-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--primary-color);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    font-weight: bold;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform 0.2s, background-color 0.2s;
}

.remove-image-btn:hover {
    transform: scale(1.1);
    background-color: #a00c24;
}

/* ===== Print styles ===== */
@media print {
    body * {
        visibility: hidden;
    }

    #inventory-detail, #inventory-detail * {
        visibility: visible;
    }
    
    #inventory-detail {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 20px;
        margin: 0;
        box-shadow: none;
        border: none;
    }

    .container {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    /* Hide buttons and other non-printable UI */
    #back-to-inventory, .detail-actions {
        display: none !important;
    }

    .detail-grid {
        grid-template-columns: 1fr !important; /* single column for printing */
        gap: .25rem;
    }

    .main-detail-image {
        width: 100%;
        max-width: 200px; /* Limit image size on print */
        height: auto;
        border-radius: 0;
        box-shadow: none;
        page-break-inside: avoid;
    }

    .detail-specs h2 {
        font-size: 18pt;
        color: #000 !important;
        page-break-after: avoid;
    }
    
    .detail-specs .price, .detail-specs h3 {
        font-size: 14pt;
        color: #000 !important;
    }
    
    .detail-specs p, .spec-list li {
        font-size: 12pt;
        color: #000 !important;
    }

    .spec-list {
        page-break-inside: avoid;
    }

    a {
        text-decoration: none;
        color: #000 !important;
    }
}