body { font-family: Arial, sans-serif; margin: 0; background-color: #f4f4f4; color: #333; }

/* Navbar Styles */
.top-navbar {
    background-color: #333;
    color: #fff;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.navbar-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    color: #e0e0e0;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s;
    font-size: 16px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-link:hover {
    color: #fff;
}

.home-link {
    font-size: 1.2em;
    color: #fff;
}

#username-display {
    color: cyan;
}

.desktop-links {
    display: flex;
    gap: 20px;
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    background-color: #444;
    padding: 10px 0;
}

.mobile-menu.open {
    display: block;
}

.mobile-link {
    display: block;
    color: #fff;
    text-decoration: none;
    padding: 10px 20px;
    border-bottom: 1px solid #555;
}

.mobile-link:last-child {
    border-bottom: none;
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.hamburger span {
    width: 30px;
    height: 3px;
    background: #fff;
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: #fff;
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 4px;
    margin-top: 10px;
}

.dropdown-menu a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.dropdown-menu a:hover {
    background-color: #f1f1f1;
}

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

/* Media Queries */
@media (max-width: 768px) {
    .desktop-links {
        display: none;
    }
    
    .hamburger {
        display: flex;
    }
}
/* Dropdown arrow rotation */
.dropdown.open .arrow {
    transform: rotate(180deg);
}
.arrow {
    display: inline-block;
    transition: transform 0.2s;
    font-size: 0.8em;
}

/* Ensure dropdown menu doesn't overflow for long emails */
.dropdown-menu {
    max-width: 250px;
    overflow-wrap: break-word;
}

.container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.main-content { display: flex; margin-top: 20px; }
#left-column-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1; /* Takes 1 part of the available space */
    padding-right: 20px;
    border-right: 1px solid #eee;
}
.customer-list-panel { flex: 1; } /* Allow customer list to grow within the column */
.invoice-detail-panel { flex: 2; padding-left: 20px; } /* Takes 2 parts of the available space */
input[type="text"], input[type="email"], input[type="tel"] {
    width: calc(100% - 22px); /* Full width on mobile */
    padding: 10px; 
    margin: 5px 0; 
    border: 1px solid #ddd; 
    font-family: "JetBrains Mono", "Fira Code", "Source Code Pro", Consolas, monospace;
    border-radius: 4px;
}

/* Container for input and clear icon */
.input-with-clear {
    position: relative;
    display: inline-block; /* Or block, depending on desired layout */
    width: calc(100% - 22px); /* Match input width */
    margin: 5px 0;
}

.input-with-clear input[type="text"] {
    width: 100%;
    padding-right: 30px; /* Make space for the clear icon */
    box-sizing: border-box; /* Include padding in width */
    margin: 0; /* Remove margin from input itself */
}

.clear-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #aaa;
    font-weight: bold;
    font-size: 0.9em;
    display: none; /* Hidden by default */
}

.clear-icon:hover {
    color: #777;
}


@media (min-width: 768px) { /* Apply for screens wider than 768px (desktop) */
    input[type="text"], input[type="email"], input[type="tel"] {
        max-width: 200px; /* Max-width on desktop */
    }
    .input-with-clear {
        max-width: 200px; /* Match input max-width on desktop */
    }
}
a { text-decoration: none; }
pre { 
    font-family: "JetBrains Mono", "Fira Code", "Source Code Pro", Consolas, monospace;
    margin: 0px;
}
button { padding: 10px 15px; background-color: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer; }
button:hover { background-color: #0056b3; }
.results { margin-top: 20px; border-top: 1px solid #eee; padding-top: 20px; }
.customer-card { border: 1px solid #ccc; padding: 15px; margin-bottom: 10px; border-radius: 5px; cursor: pointer; }
.customer-card:hover { background-color: #f0f0f0; }
.customer-card.selected { background-color: #e0f7fa; border-color: #007bff; }
.product-item { border: 1px solid #ccc; padding: 10px; margin-bottom: 5px; border-radius: 5px; cursor: pointer; }
.product-item:hover { background-color: #f0f0f0; }
.product-item.selected { background-color: #e0faf7; border-color: #00ff7b; }
.invoice-card { border: 1px solid #eee; padding: 10px; margin-bottom: 10px; border-radius: 3px; }
.line-item { margin-left: 40px; font-size: 0.9em; }


.product-list-panel { flex: 0; } /* Product list takes only necessary space */
#product-list {
    margin-bottom: 20px;
}

#product-list ul {
    list-style-type: none;
}

/* Collapsible Section Styles */
.collapsible-section {
    border: 1px solid #ddd;
    margin-bottom: 10px;
    border-radius: 5px;
}

.collapsible-header {
    background-color: #f1f1f1;
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
}

.collapsible-header h2 {
    margin: 0;
    font-size: 1.1em;
}

.toggle-icon {
    font-size: 1.2em;
    font-weight: bold;
}

.collapsible-content {
    padding: 10px 15px;
    display: block; /* Default to visible on desktop */
}

/* Mobile-specific styles */
@media (max-width: 767px) {
    .main-content {
        flex-direction: column;
    }

    #left-column-wrapper {
        padding-right: 0;
        border-right: none;
    }

    .invoice-detail-panel {
        padding-left: 0;
        margin-top: 20px; /* Space between selectors and invoices */
    }

    .collapsible-content {
        display: none; /* Hidden by default on mobile */
    }

    .collapsible-section.expanded .collapsible-content {
        display: block; /* Show when expanded */
    }

    .collapsible-section.expanded .toggle-icon::before {
        content: "-";
    }

    .collapsible-section:not(.expanded) .toggle-icon::before {
        content: "+";
    }

    /* Ensure product and customer lists take full width on mobile */
    #product-list-section,
    #customer-list-section {
        width: 100%;
    }
}

