:root {
    --primary-color: #ffbd59;
    --bg-dark: #1a1a1a;
    --font-thin: 100;
    --font-extralight: 200;
    --font-light: 300;
    --font-regular: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;
    --font-black: 900;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    font-weight: var(--font-regular);
}

body {
    min-height: 100vh;
    padding: 20px;
    background-image: linear-gradient(rgba(0, 0, 0, 0.605), rgba(243, 186, 28, 0.591)),
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: rgba(198, 91, 3, 0.608);
    background: -moz-radial-gradient(circle, rgba(198, 91, 3, 0.608) 0%, rgba(204, 192, 192, 0.535) 100%);
    background: -webkit-radial-gradient(circle, #c65b039b 0%, rgba(148, 188, 233, 0.48) 100%);
    background: radial-gradient(circle, rgba(28, 26, 80, 0.82) 0%, rgba(248, 166, 2, 0.17) 100%);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#eeaeca", endColorstr="#94bbe9", GradientType=1);
    );
    backdrop-filter: blur(1px);
}

.container {
    width: 8.5in;
    min-height: auto;
    /* Changed from 11in to auto */
    margin: 0 auto;
    background: rgba(11, 11, 11, 0.5);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.497);
    padding: 40px;
    color: white;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 15px;
    position: relative;
}

.header h1 {
    font-weight: var(--font-black);
    letter-spacing: 20px;
    font-size: 3rem;
    color: white;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    z-index: 2;
    position: absolute;
    right: 0;
    top: -20px;
    backdrop-filter: blur(5px);
    padding: 10px 20px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transform: translateZ(20px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.2),
        0 0 15px rgba(255, 255, 255, 0.1);
}

.header h1:hover {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
}

.logo {
    background: transparent;
    display: flex;
    align-items: left;
    justify-content: left;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
    padding: 10px;
    border-radius: 10px;
    transition: all 0.3s ease;
    z-index: 1;
    position: relative;
    /* Add max-width for screen view */
    max-width: 800px;
}

.logo:hover {
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.4);
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.6));
}

.logo img {
    width: 45%;
    height: 10%;
    object-fit: contain;
}

.invoice-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Creates 3 equal columns */
    gap: 20px;
    margin-bottom: 10px;
    /*gary was here */
}

.input-group {
    margin-bottom: 15px;
}

label {
    font-weight: var(--font-medium);
    font-size: 0.9em;
}

input,
select {
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    margin-top: 5px;
    font-weight: var(--font-light);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

th {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    font-weight: var(--font-semibold);
}

td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.totals {
    margin-left: auto;
    align-items: center;
    width: 200px;
}

.totals div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.discount-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    font-weight: var(--font-bold);
}

#discount {
    width: 60px;
    text-align: center;
    padding-right: 5px;
    vertical-align: middle;
    font-weight: var(--font-bold);
}

.totals span:first-child {
    font-weight: var(--font-medium);
}

#grandTotal {
    font-weight: var(--font-bold);
}

button {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
    margin-right: 10px;
    font-weight: var(--font-semibold);
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffd062;
}

button:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#logoUploadContainer {
    margin-top: 20px;
    display: none;
}

.description-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: var(--font-regular);
    transition: all 0.3s ease;
}

.description-select:focus {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    outline: none;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.description-select option,
.description-select optgroup {
    background: rgba(30, 30, 30, 0.95);
    color: white;
    padding: 10px;
}

.description-select optgroup {
    font-weight: var(--font-semibold);
    color: var(--primary-color);
}

.description-select option {
    font-weight: var(--font-regular);
    padding-left: 20px;
}

/* Manipulate the style and placement for an 8.5"x11" document print */
@media print {
    body {
        padding: 0;
        background: none;
    }
    body::before {
        background: none;
    }

    #backgroundVideo {
        display: none;
    }

    .container {
        width: 100%;
        min-height: 0;
        padding: 15px;
        box-shadow: none;
        background: white;
        color: black;
        backdrop-filter: none;
        border: none;
    }

    .logo {
        max-width: 300px;
        /* Larger size for print */
        padding: 0;
        box-shadow: none;
        filter: none;
    }

    .logo img {
        width: 100%;
        height: auto;
        /* Optional: Improve print quality */
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }


    .header {
        margin-bottom: 10px;
        margin-bottom: 30px;
        align-items: flex-start;
        /* Helps with logo alignment */
    }

    /* Header print styles */
    .header h1 {
        color: black !important;
        /* Force black color */
        text-shadow: none;
        background: none;
        backdrop-filter: none;
        box-shadow: none;
        border: none;
        position: relative;
        right: auto;
        top: auto;
        margin-bottom: 30px;
        align-items: flex-start;
        /* Helps with logo alignment */
    }

    hr {
        margin: 10px 0;
        /* Reduce margin around horizontal lines */
    }

    br {
        display: none;
        /* Remove extra line breaks */
    }

    /* Input and text colors */
    input,
    select,
    .description-select,
    label,
    .totals span,
    .total,
    #subtotal,
    #grandTotal,
    #discount {
        color: black !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Make placeholder text visible in print */
    input::placeholder {
        color: #383838 !important;
        opacity: 1;
    }

    /* Table print styles */
    th {
        background: none;
        border-bottom: 2px solid #000;
        color: black !important;
        font-weight: bold;
    }

    td {
        border-bottom: 1px solid #666;
        color: black !important;
    }

    /* Totals section */
    .totals div {
        color: black !important;
    }

    .totals span:first-child {
        font-weight: bold;
    }

    #grandTotal {
        font-weight: bold;
    }

    /* Hide elements not needed in print */
    button,
    #logoUploadContainer {
        display: none;
    }

    /* Ensure proper page breaks */
    table {
        page-break-inside: avoid;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    /* Page margins */
    @page {
        margin: 0.25cm;
    }

    /* Force black text everywhere */
    * {
        color: black !important;
        print-color-adjust: exact;
    }

    .invoice-details {
        margin-bottom: 5px;
    }

    /* Ensure no page breaks between sections */
    .header,
    .invoice-details,
    #invoiceTable,
    .totals {
        page-break-inside: auto;
        page-break-before: auto;
    }
}

.invoice-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Creates 3 equal columns */
    gap: 20px;
    margin-bottom: 10px;
    /*gary was here */
}

.input-group {
    margin-bottom: 15px;
}

/* Optional: Add some responsive styling */
@media (max-width: 768px) {
    .invoice-details {
        grid-template-columns: repeat(2, 1fr);
        /* Changes to 2 columns on smaller screens */
    }
}

@media (max-width: 480px) {
    .invoice-details {
        grid-template-columns: 1fr;
        /* Changes to 1 column on very small screens */
    }
}

/* Payment Information Styling */
.payment-info {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.payment-info h3 {
    font-size: 1.1rem;
    font-weight: var(--font-semibold);
    margin-bottom: 10px;
    color: var(--primary-color);
}

.payment-terms,
.payment-instructions {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.payment-info ul {
    list-style: none;
    padding: 0;
}

.payment-info li {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.e-transfer-details {
    margin-top: 10px;
}

.e-transfer-details p {
    margin-bottom: 10px;
}

.e-transfer-details strong {
    color: var(--primary-color);
}

/* Print styles for payment information */
@media print {
    .payment-info {
        border-top: 1px solid #000;
    }

    .payment-terms,
    .payment-instructions {
        background: none;
        border: none;
        padding: 10px 0;
    }

    .payment-info h3 {
        color: black !important;
    }

    .e-transfer-details strong {
        color: black !important;
    }

    .payment-info ul {
        margin-left: 20px;
    }

    .payment-info li {
        color: black !important;
    }
}

#contractNumber {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: white;
    padding: 8px 12px;
    width: 100%;
    margin-top: 5px;
}

/* For print styling */
@media print {
    #contractNumber {
        color: black !important;
        background: none;
    }
}

#backgroundVideo {
    position: fixed;
    right: 0;
    bottom: 0;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -2;
    object-fit: cover;
    /* filter: brightness(1.1) contrast(0.9); */
}

.remove-row-btn {
    background: #ffd062;
    border: 1px solid #ffffff4d;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    padding: 0;
    margin: 0;
    line-height: 1;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-row-btn:hover {
    background: rgba(255, 0, 0, 0.3);
    transform: scale(1.1);
}

@media print {
    .remove-row-btn {
        display: none;
    }
}
/* Tooltip container */
.tooltip {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
  }
  
  /* Tooltip text */
  .tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: black;
    color: #fff;
    text-align: center;
    padding: 5px 0;
    border-radius: 6px;
   
    /* Position the tooltip text - see examples below! */
    position: absolute;
    z-index: 1;
  }
  
  /* Show the tooltip text when you mouse over the tooltip container */
  .tooltip:hover .tooltiptext {
    visibility: visible;
  }