/* offer_form.css - All styles for offer_form.php */

/* ============================================
   General Styles
   ============================================ */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

@media (max-width: 768px) {
    select {
        font-size: 16px;
    }
}

body {
    display: flex;
    justify-content: center;
    padding-top: 40px;
    background-color: #f0f2f5;
}

.main-container {
    max-width: 600px;
    width: 100%;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
    text-align: left;
}

.main-container h1 {
    font-size: 1.5em;
    margin-bottom: 5px;
    text-align: center;
}

.main-container p {
    font-size: 0.9em;
    color: #606770;
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
}

/* ============================================
   Authentication Section
   ============================================ */
#authSection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 10px;
}

#salesman_id, #salesman_password {
    width: 30%;
    text-align: center;
    border-radius: 6px;
    padding: 4px;
    color: #606770;
    box-sizing: border-box;
    border: 2px solid #ddd;
    background-color: #fff;
    margin: 5px 0;
    line-height: 1.2;
}

#errorMessage {
    color: red;
    display: none;
    font-size: 0.9em;
    margin-top: 5px;
}

#mainForm {
    display: none;
}

/* ============================================
   Form Elements
   ============================================ */
.date-container {
    display: flex;
    gap: 20px;
    align-items: center;
}

.date-container label,
.date-container input {
    display: inline-block;
    margin: 5px 0;
}

.flex-container {
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 20px;
}

.duration-container,
.pos-container,
.purpose-container {
    flex: 1;
}

.duration-container label,
.pos-container label,
.purpose-container label {
    font-weight: bold;
    margin-bottom: 5px;
}

.duration-container input,
.pos-container select,
.purpose-container select {
    width: 100%;
    padding: 10px;
    font-size: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    color: #606770;
}

.client-container {
    display: flex;
    flex-direction: column;
    margin: 10px 0;
    width: 100%;
}

.client-container label {
    font-weight: bold;
    margin-bottom: 5px;
}

.client-container select {
    width: 100%;
    max-width: 600px;
    padding: 10px;
    font-size: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    background-color: #fff;
    color: #606770;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    background-color: #157C81;
    color: white;
    border-radius: 5px;
    padding: 8px 12px;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background-color: #106a6d;
}

.add-btn, .remove-btn {
    background-color: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.add-icon, .remove-icon {
    width: 16px;
    height: 16px;
    background-color: transparent;
    cursor: pointer;
    border: none;
    margin-top: 2px;
}

.add-btn:hover, .remove-btn:hover {
    background-color: yellow;
}

/* ============================================
   Product Rows
   ============================================ */
.productRow {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    border: 1px solid #ccc;
    padding: 10px;
    margin: 10px 0;
    border-radius: 10px;
}

.product-price,
.product-quantity {
    width: 60px;
    padding: 8px;
    font-size: 12px;
    border-radius: 6px;
    border: 2px solid #ddd;
    box-sizing: border-box;
    color: #606770;
}

.row-total {
    width: 70px;
    padding: 8px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 6px;
    border: 2px solid #157C81;
    background-color: #f0f8f9;
    text-align: center;
    color: #157C81;
    display: inline-block;
    min-width: 60px;
}

/* ============================================
   Note Feature
   ============================================ */
.note-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.note-btn:hover {
    background-color: #f0f0f0;
}

.note-container {
    padding-left: 30px;
    margin-top: 5px;
    margin-bottom: 5px;
}

.note-input {
    width: 80%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    color: #606770;
    background-color: #fafafa;
    transition: border-color 0.2s;
}

.note-input:focus {
    border-color: #157C81;
    outline: none;
    background-color: #fff;
}

.note-input::placeholder {
    color: #bbb;
}

/* ============================================
   Custom Dropdown
   ============================================ */
.custom-dropdown {
    position: relative;
    display: inline-block;
    width: 160px;
}

.custom-dropdown .dropdown-btn {
    width: 100%;
    padding: 8px 30px 8px 10px;
    font-size: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #606770;
    cursor: pointer;
    text-align: left;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-dropdown .dropdown-btn::after {
    content: '▼';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #999;
}

.custom-dropdown .dropdown-btn.open::after {
    content: '▲';
}

.custom-dropdown .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    padding: 5px 0;
    overflow: visible;
}

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

/* Category list with scroll */
.custom-dropdown .category-list {
    max-height: 280px;
    overflow-y: auto;
    position: relative;
}

.custom-dropdown .category-item {
    position: relative;
    padding: 8px 30px 8px 12px;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    white-space: nowrap;
    transition: background 0.2s;
}

.custom-dropdown .category-item:hover {
    background: #f0f2f5;
}

.custom-dropdown .category-item .arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #999;
}

/* Sub-menu - Positioned outside the scrollable container */
.custom-dropdown .sub-menu {
    display: none;
    position: fixed;
    min-width: 200px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    padding: 5px 0;
    z-index: 1001;
    max-height: 280px;
    overflow-y: auto;
}

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

.custom-dropdown .product-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    transition: background 0.2s;
    white-space: nowrap;
}

.custom-dropdown .product-item:hover {
    background: #157C81;
    color: #fff;
}

.custom-dropdown .product-item.selected {
    background: #157C81;
    color: #fff;
}

/* Hidden product select */
.product-select-hidden {
    display: none;
}

/* Mobile/touch devices */
@media (max-width: 768px) {
    .custom-dropdown .sub-menu {
        position: absolute;
        left: 0;
        top: 100%;
        margin-left: 0;
        margin-top: 2px;
        min-width: 100%;
        position: fixed;
    }
}

/* ============================================
   Discount Field
   ============================================ */
#discount_amount {
    background-color: #fff;
}

#discount_amount:focus {
    border-color: #157C81;
    outline: none;
}

/* ============================================
   Summary Section
   ============================================ */
#summarySection {
    transition: all 0.3s ease;
    margin: 20px 0;
    padding: 15px;
    border: 2px solid #157C81;
    border-radius: 8px;
    background-color: #f8f9fa;
}

#summarySection h3 {
    margin: 0 0 10px 0;
    text-align: center;
    color: #157C81;
    font-size: 1.1em;
}

#summarySection > div {
    padding: 6px 0;
}

#summarySection .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #ddd;
}

#summarySection .summary-row:last-child {
    border-bottom: none;
}

#summarySection .summary-label {
    font-weight: bold;
}

#summarySection .summary-value {
    color: #157C81;
}

#discount_row_summary {
    display: none;
    color: #e74c3c;
}

#discount_row_summary .summary-value {
    color: #e74c3c;
}

#gross_row .summary-value {
    font-size: 1.4em;
    font-weight: bold;
    color: #157C81;
}

#gross_row {
    padding-top: 10px !important;
    font-size: 1.2em;
    font-weight: bold;
}