:root {
    --profileMaxWidth: 95vw;
    --calcMaxWidth: 95vw;
    --primaryColor: #0073aa;
    --secondaryColor: #005177;
    --bgLight: #f9f9f9;
    --bgWhite: #fff;
    --textDark: #333;
    --fontSizeLarge: 2rem;
    --fontSizeMedium: 1.6rem;
    --fontSizeSmall: 1.4rem;
    --fontSizeSmaller: 1.2rem;
    --fontSizeSmallest: 1rem;
    --textGray: #555;
    --fieldColumnWidth: 150px; /* Fixed width for label column */
}

*, *::before, *::after {
    box-sizing: border-box;
}

h1 {
    text-align: center;
}

/* Campaigns */
#campaign-head {
    width: 900px;
    max-width: var(--calcMaxWidth);
    margin: 0 auto;
    background: #f0f8ff; 
    border-radius: 5px;
    margin-bottom: 20px;
    margin-top: 1rem;
    border-radius: 5px;
    background: #ffffff;
    color: black;
    padding: 20px;
    box-sizing: border-box;
}

/* Profile Section */
#profile-container {
    width: 100%;
    max-width: var(--profileMaxWidth);
    margin: 0 auto;
    margin-top: 1rem;
    border-radius: 5px;
    background: #ffffff;
    color: black;
    padding: 20px;
    box-sizing: border-box;
    text-align: center;
}

#profile-container form,
#profile-form {
    display: grid;
    grid-template-columns: 1fr; /* Force single column layout */
    width: 70% !important; /* Use !important to override any conflicting styles */
    margin: 0 auto;
    box-sizing: border-box;
}

/* Remove place-content which can cause width issues */
#profile-form > div {
    width: 100%;
    margin-block: .4rem;
    box-sizing: border-box;
    text-align: left;
}

#profile-container input {
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 3px;
    box-sizing: border-box;
}

#profile-container button {
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    border: none;
    border-radius: 3px;
    background: var(--primaryColor);
    color: #fff;
    cursor: pointer;
    box-sizing: border-box;
}

#profile-container button:hover {
    background: var(--secondaryColor);
}

#profile-message {
    color: green;
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
}

/* Price Calculator Container */
#price-calculator {
    margin: 20px auto;
    max-width: var(--calcMaxWidth);
    background: var(--bgLight);
    padding: 20px;
    border-radius: 5px;
}
#price-calculator h2 {
    font-size: var(--fontSizeLarge);
    margin-bottom: 15px;
    color: var(--textDark);
}

/* Feature Type Block */
.feature-type {
    margin-bottom: 5rem;
    padding-bottom: 10px;
    border-bottom: 2px solid #ddd;
}
.feature-type h3 {
    font-size: var(--fontSizeMedium);
    margin-bottom: 5px;
    color: var(--primaryColor);
}
.feature-type p {
    font-size: var(--fontSizeSmall);
    color: var(--textGray);
    margin-bottom: 10px;
}

/* Instance Block (each duplicate instance) */
.instances-container {
    color: black;
    margin-left: 10px;
}
.feature {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bgWhite);
    border: 1px solid #ddd;
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Header for each instance */
.instance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: var(--fontSizeSmaller);
    font-weight: bold;
}
.delete-instance {
    background: var(--secondaryColor);
    border: none;
    padding: 4px 8px;
    color: #fff;
    border-radius: 3px;
    cursor: pointer;
}
.delete-instance:hover {
    background: var(--primaryColor);
}

/* Select dropdown */
.feature select {
    padding: 8px;
    font-size: var(--fontSizeSmall);
    width: 100%;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

/* Feature-level fields container */
.feature-fields {
    display: none;
    padding: 15px;
    margin: 15px 0;
    background: #f6f6f6;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

/* Feature fields title */
.feature-fields-title {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: var(--fontSizeMedium);
    color: var(--primaryColor);
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 5px;
}

/* Feature-level fields should have a slightly different background to distinguish them */
.feature-level-field {
    padding: 10px;
    border-radius: 3px;
    margin-bottom: 8px;
}

/* Style the feature fields on the invoice too */
.feature-field-item {
    font-size: var(--fontSizeSmaller);
    color: #555;
    padding: 2px 0;
}

/* Add a subtle separator between feature name and feature fields in invoice */
td .feature-fields-list {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dotted #eee;
    font-size: var(--fontSizeSmaller);
}

/* Option Details */
.option-details {
    padding: 15px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 3px;
    margin-top: 10px;
}

/* Standard paragraph styles in option details */
.option-details p {
    margin: 10px 0;
    font-size: var(--fontSizeSmaller);
    display: grid;
    grid-template-columns: var(--fieldColumnWidth) 1fr;
    gap: 10px;
    align-items: start;
}

.option-details p strong {
    font-weight: bold;
}

/* Grid-based Layout for Form Fields */
.price-option-selector,
.user-field,
.quantity-input {
    display: grid;
    grid-template-columns: var(--fieldColumnWidth) 1fr;
    gap: 10px;
    margin: 10px 0;
    padding: 5px 0 10px;
    border-bottom: 1px solid #f0f0f0;
    width: 100%;
    align-items: start;
}

/* Make label a grid container */
.price-option-selector label,
.user-field label,
.quantity-input label {
    display: contents; /* Let children participate in parent grid */
    color: black;
}

/* Style for label text */
.price-option-selector strong,
.user-field strong,
.quantity-input strong {
    grid-column: 1;
    font-weight: bold;
    padding-top: 6px; /* Vertical alignment with inputs */
}

/* Style all form inputs consistently */
.price-option-selector select,
.user-field select,
.user-field input[type="text"],
.user-field input[type="number"],
.user-field input[type="date"],
.user-field textarea,
.quantity-input input {
    grid-column: 2;
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: var(--fontSizeSmall);
    background-color: #fff;
}

/* Special case for quantity input */
.quantity-input input {
    width: 80px;
    justify-self: start; /* Align to left of grid cell */
}

/* Textarea styling */
.user-field textarea {
    min-height: 80px;
    font-family: inherit;
    resize: vertical;
}

/* Focus styles for all input types */
.price-option-selector select:focus,
.user-field select:focus,
.user-field input:focus,
.user-field textarea:focus,
.quantity-input input:focus {
    outline: none;
    border-color: var(--primaryColor);
    box-shadow: 0 0 0 1px var(--primaryColor);
}

/* Dropdown field styles */
.price-option-selector select,
.user-field select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    padding-right: 30px;
}

/* Styling for user-display values */
.user-display-value {
    display: inline-block;
    padding: 0;
    margin: 0;
    font-weight: normal;
}

/* Style the container when it has display fields */
.user-field {
    padding: .5rem;
    padding-left: 0; 
}

.user-field strong {
    padding-top: 0;
}

/* Hide the price paragraph when price options are shown */
.option-details:has(.price-option-selector) p:has(strong:contains("Price:")) {
    display: none;
}

/* Fallback for browsers that don't support :has() */
.option-details .price-option-selector ~ p:nth-of-type(2) {
    display: none;
}

/* Addons */
.addons {
    margin-top: 15px;
    padding: 12px;
    background: #f7f7f7;
    border-radius: 4px;
}
.addons h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: var(--fontSizeMedium);
    color: var(--primaryColor);
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 5px;
}

.addon-item {
  display: flex;
  align-items: flex-start; /* Align items to top when text wraps */
  margin-bottom: 12px; /* More space between items */
  padding: 4px 0;
  min-height: 24px; /* Minimum height, can expand */
  cursor: default; /* Important - no pointer cursor on the entire container */
}

.addon-checkbox {
  flex: 0 0 16px; /* Fixed width */
  height: 16px;
  width: 16px;
  margin: 0;
  margin-right: 12px; /* Consistent spacing */
  margin-top: 2px; /* Slight offset to align with first line of text */
  padding: 0;
  cursor: pointer; /* Cursor only on the checkbox itself */
}

.addon-text {
  color: black;
  flex: 1;
  margin: 0;
  padding: 0;
  line-height: 1.4; /* Allow normal line spacing for wrapped text */
  word-wrap: break-word; /* Force long words to break */
  white-space: normal; /* Allow text to wrap */
  cursor: default; /* Explicitly not clickable */
}

/* Add New Feature Button */
.add-new-feature {
    background: var(--primaryColor);
    color: #fff;
    border: none;
    padding: 8px 12px;
    margin: 10px 0;
    cursor: pointer;
    border-radius: 3px;
    float: right;
    margin-top: 1rem;
}

/* Max addons message */
.max-addons-message {
    color: #216900;
    font-size: var(--fontSizeSmaller);
    margin-top: 8px;
    font-weight: bold;
    animation: pulse 1.5s infinite;
}

.addon-group {
    color: black;
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* Discount info */
.quantity-discounts {
    color: black;
    position: relative;
    margin-top: 12px; 
    padding: 8px;
    background-color: #f8f8f8;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.quantity-discounts:before {
    content: '💰';
    position: absolute;
    right: 10px;
    top: 8px;
    font-size: var(--fontSizeLarge);
}

.add-new-feature:hover {
    background: var(--secondaryColor);
}

/* Invoice Container */
#invoice-container {
    margin: 20px auto;
    max-width: var(--calcMaxWidth);
    background: var(--bgLight);
    padding: 20px;
    border-radius: 5px;
}
#invoice-container h2 {
    font-size: var(--fontSizeLarge);
    margin-bottom: 15px;
    color: var(--textDark);
}

/* Invoice Table - 2 Column Layout */
.invoice-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    margin-bottom: 15px;
    color: black;
}

.invoice-table th,
.invoice-table td {
    border: 1px solid #ccc;
    padding: 12px;
    vertical-align: top;
    text-align: left;
}

.invoice-table thead {
    background-color: #eee;
}

.invoice-table tfoot td {
    background-color: #eee;
    font-weight: bold;
}

/* Price column alignment */
.invoice-table th:nth-child(2),
.invoice-table td:nth-child(2) {
    text-align: right;
    width: 150px;
}

/* Main item styling */
.item-main {
    line-height: 1.4;
}

.feature-name {
    font-weight: bold;
    color: var(--primaryColor);
    font-size: var(--fontSizeSmall);
    margin-bottom: 4px;
}

.option-details {
    font-size: var(--fontSizeSmaller);
    color: #333;
}

.option-name {
    font-weight: 500;
    margin-bottom: 3px;
}

.option-detail-line {
    font-size: var(--fontSizeSmaller);
    color: #666;
    margin-left: 8px;
    margin-bottom: 2px;
    line-height: 1.3;
}

/* Legacy classes for backward compatibility */
.quantity-display,
.interval-display,
.user-fields-display {
    font-size: var(--fontSizeSmaller);
    color: #666;
    font-style: italic;
}

.interval-display {
    color: var(--secondaryColor);
    font-weight: 500;
}

/* Addon row styling */
.addon-row td {
    color: #666;
    padding-left: 24px;
    border-top: none;
    padding-top: 6px;
    padding-bottom: 6px;
}

.addon-item-name {
    font-size: var(--fontSizeSmaller);
    position: relative;
}

.addon-item-name::before {
    content: "└ ";
    color: #ccc;
    font-weight: bold;
    margin-right: 4px;
}

/* Discount row styling */
.discount-row td {
    color: #216900;
    padding-left: 24px;
    border-top: none;
    padding-top: 6px;
    padding-bottom: 6px;
    font-size: var(--fontSizeSmaller);
    font-weight: bold;
}

.discount-item-name {
    position: relative;
}

.discount-item-name::before {
    content: "└ ";
    color: #216900;
    font-weight: bold;
    margin-right: 4px;
}

/* Price with discount styling */
.price-with-discount {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.original-price {
    text-decoration: line-through;
    color: #999;
    font-size: var(--fontSizeSmaller);
}

.discounted-price {
    color: #216900;
    font-weight: bold;
    font-size: var(--fontSizeSmall);
}

.discount-note {
    font-size: var(--fontSizeSmallest);
    color: #216900;
    font-style: italic;
}

/* Invoice Total Text */
#invoice-total {
    font-weight: bold;
    text-align: right;
}

/* Ordering */

.order-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.order-confirm-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.order-confirm-content {
    background-color: white;
    color: black;
    padding: 30px;
    border-radius: 5px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.order-confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.loading-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: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.loading-spinner {
    text-align: center;
}

.loading-spinner img {
    width: 50px;
    height: 50px;
}

#subs-loader {
    width: 30px;
    height: auto;
}

.order-confirm-modal button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.order-confirm-modal .confirm-button {
    background-color: #007bff;
    color: white;
}

.order-confirm-modal .cancel-button {
    background-color: #e0e0e0;
    color: #212529;
}

.lock-message {
    z-index: 1;
}

/* Payment */
#payment-element-container {
    margin: 20px 0;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

#payment-form {
    margin-bottom: 15px;
}

#payment-element {
    margin-bottom: 15px;
}

#payment-error {
    color: #216900;
    background-color: #ffeaea;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    display: none;
}

/* Styling for successful payment */
#pay-now.success {
    background-color: #4caf50 !important;
}

/* Disabled button style */
#pay-now:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* "Pay Now" / "Request Estimate" Button */
#pay-now {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 3px;
    background: var(--primaryColor);
    color: #fff;
    font-size: var(--fontSizeMedium);
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 10px;
}
#pay-now:hover {
    background: var(--secondaryColor);
}

/* Invoice table sections */
.invoice-table .section-header td {
    background-color: #f5f5f5;
    padding: 10px;
    font-size: 1.1em;
    border-top: 2px solid #ddd;
}

.invoice-table .section-spacer td {
    height: 20px;
    border: none;
}

.invoice-table .subtotal-row td {
    border-top: 1px solid #eee;
    padding-top: 8px;
}

.invoice-table .total-row td {
    border-top: 2px solid #333;
    padding-top: 12px;
    font-size: 1.1em;
}

/* Recurring indicator */
.recurring-interval {
    color: #666;
    font-size: 0.9em;
    font-style: italic;
    margin-top: 4px;
}

/* Subscription management */

#subscriptions-management {
    margin: 0 auto;
    width: 900px;
    max-width: 90vw;
    margin-bottom: 5vh;
}

.subscriptions-container {
    color: black;
    margin: 20px 0;
}

#manage-subs-btn {
    margin: 0 auto;
    width: 70% !important;
    user-select: none;
}

.subscription-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.subscription-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.subscription-title {
    font-size: 1.2em;
    font-weight: bold;
}

.subscription-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
}

.subscription-status.active {
    background: #d4edda;
    color: #155724;
}

.subscription-status.past_due {
    background: #fff3cd;
    color: #856404;
}

.subscription-status.cancelled {
    background: #f8d7da;
    color: #721c24;
}

.subscription-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.subscription-detail {
    display: flex;
    flex-direction: column;
}

.subscription-detail-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 4px;
}

.subscription-detail-value {
    font-weight: 500;
}

.subscription-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.subscription-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.subscription-actions .btn-primary {
    background: #0073aa;
    color: white;
}

.subscription-actions .btn-primary:hover {
    background: #005a87;
}

.subscription-actions .btn-danger {
    background: #dc3545;
    color: white;
}

.subscription-actions .btn-danger:hover {
    background: #c82333;
}

/* Payment method display */
.payment-method {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-top: 10px;
}

.payment-method-icon {
    width: 40px;
    height: 25px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.payment-method-icon.visa {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCA0MCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjQwIiBoZWlnaHQ9IjI0IiByeD0iNCIgZmlsbD0iIzAwNTFBNSIvPgo8cGF0aCBkPSJNMTYuNSA5TDEzLjUgMTVIMTEuNUwxMy4yIC45QzEzLjMgOC41IDEzLjcgOCAxNC4yIDhIMTUuNUwxOCAxNUgxNkwxNS42IDEzLjVIMTMuOUwxMy41IDEzLjVIMTYuNVpNMTkgOEgyMUwyMiAxNUgyMEwxOSA4WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+');
}

.payment-method-icon.mastercard {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCA0MCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjQwIiBoZWlnaHQ9IjI0IiByeD0iNCIgZmlsbD0iIzAwMCIvPgo8Y2lyY2xlIGN4PSIxNiIgY3k9IjEyIiByPSI3IiBmaWxsPSIjRUIwMDFCIi8+CjxjaXJjbGUgY3g9IjI0IiBjeT0iMTIiIHI9IjciIGZpbGw9IiNGNzkzMDAiLz4KPC9zdmc+');
}

.payment-method-details {
    flex: 1;
}

.payment-method-last4 {
    font-weight: 500;
}

.payment-method-expiry {
    font-size: 0.85em;
    color: #666;
}

/* Update payment modal */
.update-payment-modal {
    color: black;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.update-payment-content,
#cancel-subscription-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
}

#cancel-subscription-content {
    display: grid;
    place-content: center;
    min-height: 30vh;
}

#cancel-subscription-content h3 {
    text-align: center;
}

.update-payment-content {
    position: relative;
    min-height: 90vh;
    max-height: 90vh;
    overflow-y: auto;
}

.update-payment-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
}

#update-payment-element {
    margin-bottom: 20px;
}

.update-payment-actions {
    display: none;
}

.update-payment-actions,
.cancel-actions {
    gap: 10px;
    justify-content: flex-end;
}

.update-payment-actions button,
.cancel-actions button {
    cursor: pointer;
}

.cancel-actions button {
    font-size: 1.1rem;
    padding: 0.5rem;
    border-radius: 5px;
}

.cancel-actions {
    display: flex;
    justify-content: space-evenly;
}

#cancel-modal-loader {
    width: 30px;
    height: auto;
}

#update-modal-loader {
    width: 30px;
    height: auto;
    position: absolute;
    display: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.button-danger {
    background-color: #dc3545;
    color: white;
}
.button-danger:hover {
    background-color: #c82333;
}

.plan-change-section {
    margin: 15px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 4px;
}

.plan-select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.subscription-status.past_due {
    background-color: #dc3545;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* Mixed order warning */
.mixed-order-warning {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 12px;
    border-radius: 4px;
    margin: 20px 0;
}

.mixed-order-warning strong {
    display: block;
    margin-bottom: 5px;
}

/* Tooltip styles */
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px; /* Fixed dimensions */
  border-radius: 50%;
  background-color: #ddd;
  color: #555;
  font-size: var(--fontSizeSmallest);
  font-weight: bold;
  margin: 0 8px 0 8px; /* Even spacing on both sides */
  padding: 0;
  cursor: help; /* Special cursor for tooltip */
  transition: background-color 0.2s ease;
  position: relative;
  top: 0; /* Ensure no vertical offset */
  line-height: 16px; /* Match to height */
}

.tooltip-icon:hover {
  background-color: var(--primaryColor);
  color: white;
}

.tooltip-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.tooltip-overlay.active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

.tooltip-content {
  background-color: white;
  padding: 15px 20px;
  border-radius: 5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-width: 300px;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  touch-action: none; /* Prevent browser default touch actions */
}

.tooltip-overlay.active .tooltip-content {
  transform: translateY(0);
  opacity: 1;
}

.tooltip-title {
  font-weight: bold;
  margin-bottom: 8px;
  color: var(--primaryColor);
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
}

.tooltip-body {
  font-size: var(--fontSizeSmall);
  line-height: 1.4;
  color: #333;
}

/* Anonymous users */

#anonymous-user-form {
    width: 900px;
    max-width: var(--calcMaxWidth);
    margin: 0 auto;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    color: black;
}

#anonymous-user-form h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.anon-field {
    margin-bottom: 12px;
}

.anon-field input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.anon-field input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.anon-signup-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.anon-checkbox-label,
.anon-radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 10px;
    font-size: 14px;
}

.anon-checkbox-label input,
.anon-radio-label input {
    margin-right: 8px;
    width: auto;
}

.anon-radio-group {
    margin-left: 20px;
}

.password-field {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    opacity: 0.7;
}

#username-password-fields {
    margin-left: 20px;
}

#account-required-section {
    margin-top: 20px;
    padding: 15px;
    background-color: #f0f8ff;
    border: 1px solid #007bff;
    border-radius: 6px;
}

.account-required-notice {
    color: #007bff;
    margin-bottom: 15px;
    font-size: 14px;
}

.account-fields .anon-field {
    margin-bottom: 12px;
}

.password-field {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    opacity: 0.7;
}

.account-creation-options {
    margin-top: 15px;
}

.google-signin-option {
    margin-bottom: 20px;
}

.google-signin-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 16px;
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.google-signin-button:hover {
    background-color: #3367d6;
}

.google-signin-button:active {
    background-color: #2d5aa0;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    text-align: center;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ddd;
}

.auth-divider span {
    padding: 0 15px;
    color: #666;
    font-size: 14px;
    background: white;
}

.account-fields {
    transition: all 0.3s ease;
}

.account-fields.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.google-account-status {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #e8f5e8;
    border: 1px solid #4caf50;
    border-radius: 4px;
    margin-bottom: 15px;
}

.google-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: #4caf50;
    color: white;
    border-radius: 50%;
    margin-right: 12px;
    font-size: 14px;
    font-weight: bold;
}

.google-account-status strong {
    color: #2e7d32;
}

/* Account required notice styling */
.account-required-notice {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 20px;
    color: #856404;
    font-size: 14px;
}

/* Ensure consistent spacing for anonymous form fields */
.anon-field {
    margin-bottom: 15px;
}

.anon-field input,
.anon-field select,
.anon-field textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.anon-field input:focus,
.anon-field select:focus,
.anon-field textarea:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

.password-field {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
}

.password-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .auth-divider span {
        padding: 0 10px;
        font-size: 13px;
    }
    
    .google-signin-button {
        font-size: 15px;
        padding: 11px 14px;
    }
    
    .account-required-notice {
        font-size: 13px;
        padding: 10px;
    }
}

@media (min-width: 800px) {
    #profile-container,
    #price-calculator,
    #invoice-container {
        width: 790px;
    }

    #price-calculator,
    #invoice-container {
        margin-top: 1rem;
    }
}

@media (min-width: 1000px) {
    #profile-container,
    #price-calculator,
    #invoice-container {
        width: 900px;
        margin: 0 auto;
    }

    #price-calculator,
    #invoice-container {
        margin-top: 1rem;
    }
}

@media (max-width: 800px) {
    :root {
        --profileMaxWidth: 90vw;
    }
    #campaign-head,
    #price-calculator,
    #invoice-container,
    #anonymous-user-form {
        width: 90vw;
    }
}

@media (max-width: 600px) {
    :root {
        --fieldColumnWidth: 100%;
        --fontSizeLarge:    1.4rem;
        --fontSizeMedium:   1.2rem;
        --fontSizeSmall:    0.9rem;
        --fontSizeSmaller:  0.8rem;
        --fontSizeSmallest: 0.7rem;
    }
    
    /* Stack fields vertically on mobile */
    .price-option-selector,
    .user-field,
    .quantity-input,
    .option-details p {
        grid-template-columns: 1fr;
    }
    
    .price-option-selector strong,
    .user-field strong,
    .quantity-input strong {
        margin-bottom: 5px;
        padding-bottom: 2px;
        border-bottom: 1px dotted #eee;
    }
    
    .price-option-selector select,
    .user-field select,
    .user-field input[type="text"],
    .user-field input[type="number"],
    .user-field input[type="date"],
    .user-field textarea,
    .quantity-input input {
        grid-column: 1;
        width: 100%;
    }
    
    .quantity-input input {
        width: 100%;
    }
    
    /* Invoice table responsive adjustments */
    .invoice-table th,
    .invoice-table td {
        padding: 8px;
    }
    
    .invoice-table th:nth-child(2),
    .invoice-table td:nth-child(2) {
        width: 120px;
    }
    
    .feature-name {
        font-size: var(--fontSizeSmaller);
    }
    
    .option-details {
        font-size: var(--fontSizeSmaller);
    }
    
    .price-with-discount {
        align-items: flex-end;
    }
}