body {
    font-family: system-ui, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
}

.navbar {
    background-color: #007cba;
    color: white;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 60px;
}

.nav-brand {
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-decoration: none;
    transition: opacity 0.2s;
}

.nav-brand:hover {
    opacity: 0.8;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-user {
    color: #e0e0e0;
    font-size: 14px;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
}

.main-content {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

/* Form Styling */
form {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 600px;
}

input, select, button {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box; /* Ensure padding stays inside the container */
}

button {
    background-color: #007cba;
    color: white;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #005a87;
}

label {
    display: block;
    margin-top: 15px;
    font-weight: 500;
}

/* Auth forms specific styling */
.auth-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 20px;
}

.auth-container form {
    margin: 0;
}

.error {
    color: #d32f2f;
    background-color: #ffebee;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.success {
    color: #2e7d32;
    background-color: #e8f5e8;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

/* Form group styling */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    margin: 0;
}

/* Textarea styling */
textarea {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
}

/* Enhanced form styling for project details */
.form-group textarea {
    min-height: 80px;
}

.form-group select {
    background-color: white;
    cursor: pointer;
}

.form-group input[type="number"] {
    -moz-appearance: textfield;
}

.form-group input[type="number"]::-webkit-outer-spin-button,
.form-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Auth links styling */
.auth-links {
    text-align: center;
    margin: 20px 0;
}

.auth-links a {
    color: #007cba;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Guest option styling */
.guest-option {
    margin-top: 20px;
}

.guest-option hr {
    margin: 20px 0;
    border: none;
    border-top: 1px solid #ddd;
}

.guest-option p {
    text-align: center;
    margin-bottom: 10px;
    font-weight: 500;
}

.guest-button {
    display: block;
    text-align: center;
    padding: 12px;
    background: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
    width: 100%; /* Match login button width */
    margin: 8px 0;
    font-size: 16px;
    border: none;
    box-sizing: border-box;
}

.guest-button:hover {
    background: #545b62;
}

/* BOM Table Styling */
.bom-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: #fff;
    font-size: 15px;
}

.bom-table th, .bom-table td {
    border: 1px solid #ddd;
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}

.bom-table th {
    background: #f7f7f7;
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

.bom-table td {
    font-size: 15px;
}

.bom-table .modifier-icon {
    font-size: 18px;
    color: #007cba;
    transition: color 0.2s;
}

.bom-table .modifier-icon:hover {
    color: #005a87;
}

/* Modifier menu */
#modifier-menu-template ul {
    margin: 0;
    padding: 0;
}

#modifier-menu-template li {
    padding: 0;
    margin: 0;
}

#modifier-menu-template a {
    display: block;
    padding: 8px 24px 8px 16px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
    transition: background 0.15s;
}

#modifier-menu-template a:hover {
    background: #f0f0f0;
}

.project-info-bom-container {
    max-width: 900px;
    margin: 40px auto;
    background: none;
    padding: 0 0 40px 0;
}

/* Make the project info form full width to match the BOM table */
.project-info-bom-container form {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Product Picker Overlay */
.product-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-overlay-content {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    max-width: 1100px;
    width: 95vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    position: relative;
    text-align: center;
}

.product-overlay-close {
    position: absolute;
    top: 18px;
    right: 24px;
    font-size: 2rem;
    color: #888;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.2s;
    z-index: 10;
}

.product-overlay-close:hover {
    color: #d32f2f;
}

.product-overlay-content h2 {
    margin-bottom: 28px;
    font-size: 2rem;
    color: #007cba;
    font-weight: 600;
}

/* Product Grid Styling */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 32px 24px;
    justify-items: center;
}

.product-card {
    background: #f8fafd;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    padding: 16px;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
    width: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.product-card:hover {
    box-shadow: 0 4px 16px rgba(0,124,186,0.18);
    transform: translateY(-4px) scale(1.03);
    background: #e6f3fa;
}

.product-card img {
    width: 140px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 12px;
    background: #eee;
}

.product-label {
    font-size: 1rem;
    color: #222;
    font-weight: 500;
    text-align: center;
}

/* add-method overlay */
.method-overlay{
    position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:2100;
    display:flex;align-items:center;justify-content:center;
}
.method-dialog{
    background:#fff;border-radius:10px;padding:24px 32px;text-align:center;
    box-shadow:0 6px 24px rgba(0,0,0,.18);min-width:260px;
}
.method-dialog h3{margin-top:0;color:#007cba;font-size:1.4rem;}
.method-btn{
    display:inline-block;margin:12px 10px 0;padding:10px 24px;
    border:none;border-radius:4px;font-size:1rem;cursor:pointer;
    background:#007cba;color:#fff;transition:background .2s;
}
.method-btn:hover{background:#005a87;}

/* Manual Input Overlay */
.manual-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.65);
    z-index: 2200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.manual-dialog {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    max-width: 600px;
    width: 90vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    text-align: center;
}

.manual-dialog h3 {
    margin-bottom: 20px;
    font-size: 1.8rem;
    color: #007cba;
    font-weight: 600;
}

.manual-dialog form label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
}

.manual-dialog form input, .manual-dialog form select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.manual-dialog form button {
    background-color: #007cba;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

.manual-dialog form button:hover {
    background-color: #005a87;
}

/* Overlay Close Button */
.overlay-close {
    position: absolute;
    top: 18px;
    right: 24px;
    font-size: 2rem;
    color: #888;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.2s;
    z-index: 10;
}

.overlay-close:hover {
    color: #d32f2f;
}

/* Takeoff Overlay */
.takeoff-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 2300;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.takeoff-dialog {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    max-width: 95%;
    width: 95%;
    height: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;          /* anchor children */
}

.takeoff-controls {
    position: absolute;
    left: 32px;
    bottom: 24px;
    display: flex;
    gap: 14px;
}

.takeoff-controls button {
    min-width: 140px;   /* keep wide enough */
}

/* grow tracing window further down */
.tracing-window {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

.tracing-window h2 {
    font-size: 1.8rem;
    color: #007cba;
    margin-bottom: 10px;
}

.tracing-area {
    flex: 1 1 auto;                           /* stretch */
    min-height: 500px;                        /* fallback height */
    background: #eee;
    border: 2px dashed #007cba;
    position: relative;                       /* to overlay measurements */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #666;
}

/* measurements panel bottom-right overlay */
#measurements {
    position: absolute;
    right: 20px;
    bottom: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    padding: 14px 18px;
    width: 210px;
    text-align: left;
}

#measurements h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    color: #007cba;
}

#measurements p {
    margin: 4px 0;
    font-size: 0.95rem;
}