/* ============================================================
   Product Quotation System – Frontend Styles
   Primary:   #1b8760 (green)
   Secondary: #f7cd0f (yellow)
   ============================================================ */

:root {
    --pq-primary:       #1b8760;
    --pq-primary-dark:  #146b4a;
    --pq-secondary:     #f7cd0f;
    --pq-secondary-dark:#d4ab00;
    --pq-success:       #28a745;
    --pq-danger:        #dc3545;
    --pq-warning:       #ffc107;
    --pq-info:          #17a2b8;
    --pq-light:         #f8f9fa;
    --pq-dark:          #212529;
    --pq-text:          #343a40;
    --pq-border:        #dee2e6;
    --pq-border-radius: 8px;
    --pq-shadow:        0 2px 15px rgba(0, 0, 0, 0.1);
    --pq-transition:    all 0.3s ease;
}

/* ---- Containers ---- */
.pq-form-container,
.pq-quotation-container {
    max-width: 900px;
    margin: 2rem auto;
    background: #fff;
    border-radius: var(--pq-border-radius);
    box-shadow: var(--pq-shadow);
    overflow: hidden;
}

/* ---- Header ---- */
.pq-form-header,
.pq-quotation-header {
    background: linear-gradient(135deg, var(--pq-primary), var(--pq-primary-dark));
    color: #fff;
    padding: 2rem;
    text-align: center;
}

.pq-form-header h2,
.pq-quotation-header h2 {
    margin: 0 0 .5rem;
    font-size: 1.8rem;
    font-weight: 600;
}

.pq-subtitle {
    margin: 0;
    opacity: .9;
    font-size: 1rem;
}

/* Quotation header: split layout */
.pq-quotation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
}

.pq-quotation-title h2 { font-size: 1.5rem; }

.pq-reference {
    font-size: .9rem;
    opacity: .9;
    margin-top: .25rem;
}

.pq-quotation-date {
    text-align: right;
    font-size: .9rem;
    opacity: .9;
}

/* ---- Step Indicator ---- */
.pq-step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin-bottom: 1.25rem;
}

.pq-step {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.3);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
}

.pq-step-active {
    background: var(--pq-secondary);
    color: var(--pq-dark);
}

.pq-step-done {
    background: rgba(255,255,255,.9);
    color: var(--pq-primary);
}

.pq-step-line {
    flex: 1;
    max-width: 60px;
    height: 2px;
    background: rgba(255,255,255,.3);
    border-radius: 1px;
}

.pq-line-done {
    background: rgba(255,255,255,.8);
}

/* ---- Form Elements ---- */
.pq-form {
    padding: 2rem;
}

.pq-form-group {
    margin-bottom: 1.5rem;
}

.pq-form-group label {
    display: block;
    margin-bottom: .5rem;
    font-weight: 600;
    color: var(--pq-dark);
}

.pq-required {
    color: var(--pq-danger);
    margin-left: .2rem;
}

.pq-input,
.pq-select {
    width: 100%;
    padding: .75rem 1rem;
    border: 2px solid var(--pq-border);
    border-radius: var(--pq-border-radius);
    font-size: 1rem;
    transition: var(--pq-transition);
    background: #fff;
    box-sizing: border-box;
}

.pq-input:focus,
.pq-select:focus {
    outline: none;
    border-color: var(--pq-primary);
    box-shadow: 0 0 0 3px rgba(27, 135, 96, .15);
}

.pq-textarea {
    resize: vertical;
    min-height: 80px;
}

.pq-form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0;
}

.pq-form-col { flex: 1; }

.pq-col-narrow { flex: 0 0 140px; }

/* ---- Buttons ---- */
.pq-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .75rem 1.5rem;
    border: none;
    border-radius: var(--pq-border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--pq-transition);
    text-decoration: none;
    line-height: 1;
}

.pq-button-primary {
    background: var(--pq-primary);
    color: #fff;
}

.pq-button-primary:hover:not(:disabled) {
    background: var(--pq-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(27,135,96,.3);
    color: #fff;
}

.pq-button-primary:disabled {
    background: #aaa;
    cursor: not-allowed;
}

.pq-button-secondary {
    background: #6c757d;
    color: #fff;
}

.pq-button-secondary:hover {
    background: #5a6268;
    color: #fff;
}

.pq-button-outline {
    background: transparent;
    border: 2px solid var(--pq-primary);
    color: var(--pq-primary);
}

.pq-button-outline:hover {
    background: var(--pq-primary);
    color: #fff;
}

.pq-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--pq-border);
}

/* ---- Alerts ---- */
.pq-alert {
    padding: 1rem 1.5rem;
    margin: 0 2rem 1.5rem;
    border-radius: var(--pq-border-radius);
    border-left: 4px solid;
    font-size: .95rem;
}

.pq-alert-success {
    background: rgba(40, 167, 69, .08);
    border-color: var(--pq-success);
    color: #155724;
}

.pq-alert-danger {
    background: rgba(220, 53, 69, .08);
    border-color: var(--pq-danger);
    color: #721c24;
}

.pq-alert-warning {
    background: rgba(255, 193, 7, .1);
    border-color: var(--pq-warning);
    color: #856404;
}

/* ---- Product Search ---- */
.pq-product-search-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 0 2rem 1.5rem;
    padding: .75rem 1rem;
    background: var(--pq-light);
    border-radius: var(--pq-border-radius);
    border: 2px solid var(--pq-border);
}

.pq-product-search-bar i {
    color: var(--pq-primary);
    font-size: 1.1rem;
}

.pq-product-search-bar input {
    border: none;
    background: transparent;
    flex: 1;
    font-size: 1rem;
    outline: none;
    width: 100%;
}

/* ---- Product Grid ---- */
.pq-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    padding: 0 2rem 1.5rem;
}

.pq-product-card {
    border: 2px solid var(--pq-border);
    border-radius: var(--pq-border-radius);
    overflow: hidden;
    transition: var(--pq-transition);
    background: #fff;
    display: flex;
    flex-direction: column;
}

.pq-product-card:hover {
    border-color: var(--pq-primary);
    box-shadow: 0 4px 16px rgba(27,135,96,.15);
    transform: translateY(-2px);
}

.pq-product-card.pq-card-hidden {
    display: none;
}

.pq-product-image {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f0f0f0;
}

.pq-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}

.pq-product-card:hover .pq-product-image img {
    transform: scale(1.05);
}

.pq-product-info {
    padding: .75rem;
    flex: 1;
}

.pq-product-name {
    margin: 0 0 .5rem;
    font-size: .9rem;
    font-weight: 600;
    color: var(--pq-dark);
    line-height: 1.3;
}

.pq-product-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--pq-primary);
}

.pq-add-to-cart {
    width: 100%;
    border-radius: 0;
    padding: .6rem;
    font-size: .9rem;
}

/* ---- Cart / Order Summary ---- */
.pq-cart-section {
    margin: 0 2rem 1.5rem;
    border: 2px solid var(--pq-border);
    border-radius: var(--pq-border-radius);
    overflow: hidden;
}

.pq-cart-section h3 {
    margin: 0;
    padding: 1rem 1.5rem;
    background: var(--pq-light);
    border-bottom: 1px solid var(--pq-border);
    font-size: 1.1rem;
    color: var(--pq-primary);
}

.pq-cart-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #999;
}

.pq-cart-empty i {
    font-size: 2.5rem;
    margin-bottom: .75rem;
    display: block;
}

.pq-cart-table {
    width: 100%;
    border-collapse: collapse;
}

.pq-cart-table th,
.pq-cart-table td {
    padding: .75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--pq-border);
    font-size: .95rem;
}

.pq-cart-table thead th {
    background: var(--pq-primary);
    color: #fff;
    font-weight: 600;
    border-bottom: none;
}

.pq-cart-table tbody tr:hover {
    background: rgba(27,135,96,.04);
}

.pq-cart-total td {
    font-size: 1.1rem;
    background: var(--pq-secondary);
    color: var(--pq-dark);
}

.pq-cart-subtotal td {
    background: var(--pq-light);
}

.pq-qty-input {
    width: 65px;
    padding: .3rem .5rem;
    border: 1px solid var(--pq-border);
    border-radius: 4px;
    text-align: center;
}

.pq-remove-item {
    background: none;
    border: none;
    color: var(--pq-danger);
    cursor: pointer;
    font-size: 1rem;
    padding: .2rem .5rem;
    border-radius: 4px;
    transition: var(--pq-transition);
}

.pq-remove-item:hover {
    background: rgba(220,53,69,.1);
}

/* ---- Quotation Display ---- */
.pq-quotation-body {
    padding: 2rem;
}

.pq-section {
    margin-bottom: 2rem;
}

.pq-section h3 {
    margin: 0 0 1rem;
    color: var(--pq-dark);
    font-size: 1.2rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--pq-border);
}

.pq-section h3 i {
    color: var(--pq-primary);
    margin-right: .5rem;
}

.pq-info-row {
    display: flex;
    margin-bottom: .75rem;
}

.pq-info-label {
    flex: 0 0 120px;
    font-weight: 600;
    color: var(--pq-dark);
}

.pq-info-value {
    flex: 1;
    color: #495057;
}

/* ---- Line Items Table (Quotation display) ---- */
.pq-line-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: .5rem;
}

.pq-line-items-table th,
.pq-line-items-table td {
    padding: .75rem 1rem;
    border: 1px solid var(--pq-border);
    font-size: .95rem;
}

.pq-line-items-table thead th {
    background: var(--pq-primary);
    color: #fff;
    font-weight: 600;
}

.pq-line-items-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.pq-line-items-table .pq-col-img {
    width: 60px;
    text-align: center;
}

.pq-line-item-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

.pq-total-subtotal-row td {
    background: var(--pq-light);
    font-weight: 600;
}

.pq-grand-total-row td {
    background: var(--pq-secondary);
    font-size: 1.1rem;
}

/* ---- Quotation Footer ---- */
.pq-quotation-footer {
    padding: 1.5rem 2rem;
    background: var(--pq-light);
    border-top: 1px solid var(--pq-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.pq-export-options h4 {
    margin: 0 0 .75rem;
    color: var(--pq-dark);
    font-size: 1rem;
}

.pq-export-buttons {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}

/* ---- Org / Seller Header (Step 3 quotation display) ---- */
.pq-quotation-header {
    background: linear-gradient(135deg, var(--pq-primary), var(--pq-primary-dark));
    color: #fff;
    padding: 1.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.pq-org-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.pq-org-logo {
    max-height: 70px;
    max-width: 160px;
    object-fit: contain;
    border-radius: 4px;
    background: rgba(255,255,255,.1);
    padding: 4px;
}

.pq-org-details {}

.pq-org-name {
    margin: 0 0 .3rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
}

.pq-org-address {
    margin: 0;
    font-size: .875rem;
    opacity: .9;
}

.pq-org-address i { margin-right: .35rem; }

/* Reference badge */
.pq-quotation-meta {
    text-align: right;
    flex-shrink: 0;
}

.pq-quotation-badge {
    background: var(--pq-secondary);
    color: var(--pq-dark);
    padding: .85rem 1.25rem;
    border-radius: var(--pq-border-radius);
    text-align: center;
    min-width: 160px;
}

.pq-badge-label {
    font-weight: 700;
    font-size: .85rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.pq-reference-num {
    font-size: .95rem;
    margin-top: .3rem;
}

.pq-quotation-date {
    font-size: .8rem;
    margin-top: .3rem;
    opacity: .8;
}

/* ---- Duplicate-client confirmation screen ---- */
.pq-confirm-card {
    border: 2px solid var(--pq-border);
    border-radius: var(--pq-border-radius);
    margin-bottom: .75rem;
    overflow: hidden;
    transition: var(--pq-transition);
}

.pq-confirm-card:hover {
    border-color: var(--pq-primary);
    box-shadow: 0 3px 12px rgba(27,135,96,.12);
}

.pq-confirm-card-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    gap: 1rem;
}

.pq-confirm-none {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--pq-light);
    border: 2px dashed var(--pq-border);
    border-radius: var(--pq-border-radius);
    padding: 1rem 1.25rem;
}

.pq-confirm-none p { margin: 0; color: #555; font-size: .95rem; }

.pq-text-muted { color: #6c757d; font-size: .875rem; }
.pq-text-muted i { margin-right: .35rem; }

/* ---- Animations ---- */
.pq-fade-in {
    animation: pq-fadeIn .4s ease-in;
}

@keyframes pq-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Loading ---- */
.pq-loading {
    position: relative;
    opacity: .7;
    pointer-events: none;
}

.pq-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.25rem;
    height: 1.25rem;
    margin: -.625rem 0 0 -.625rem;
    border: 2px solid var(--pq-border);
    border-top-color: var(--pq-primary);
    border-radius: 50%;
    animation: pq-spin .8s linear infinite;
}

@keyframes pq-spin { to { transform: rotate(360deg); } }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .pq-form-row { flex-direction: column; }
    .pq-col-narrow { flex: 1 1 100%; }

    .pq-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        padding: 0 1rem 1rem;
    }

    .pq-product-search-bar,
    .pq-cart-section,
    .pq-alert { margin-left: 1rem; margin-right: 1rem; }

    .pq-form-actions { flex-direction: column; gap: .75rem; }
    .pq-form-actions .pq-button { width: 100%; }

    .pq-quotation-header { flex-direction: column; text-align: center; gap: 1rem; }
    .pq-quotation-date { text-align: center; }
    .pq-info-row { flex-direction: column; }
    .pq-info-label { margin-bottom: .2rem; }

    .pq-quotation-footer { flex-direction: column; }
    .pq-export-buttons { flex-direction: column; }
    .pq-export-buttons .pq-button { width: 100%; }

    .pq-line-item-img { width: 36px; height: 36px; }
}

/* ============================================================
   Step 0 – Organisation Selection  (v3.0.5)
   All text properties use !important to override theme CSS.
   ============================================================ */

.pq-org-page.pq-form-container { max-width: 760px; }

/* Search bar */
.pq-org-search-wrap {
    padding: 1.5rem 1.75rem .75rem;
}
.pq-org-search-wrap .pq-product-search-bar {
    margin: 0;
    border-radius: 50px;
    padding: .6rem 1.25rem;
    border: 2px solid var(--pq-border);
    background: var(--pq-light);
}
.pq-org-search-wrap .pq-product-search-bar i {
    color: #adb5bd !important;
    font-size: .95rem;
    flex-shrink: 0;
}
.pq-org-search-wrap .pq-product-search-bar input {
    font-size: .95rem !important;
    color: #343a40 !important;
    background: transparent;
    border: none;
    outline: none;
    flex: 1;
    min-width: 0;
}
.pq-org-count {
    margin: .5rem 0 0 .5rem;
    font-size: .78rem !important;
    color: #adb5bd !important;
    display: block !important;
    visibility: visible !important;
}

/* List container */
.pq-org-grid {
    display: flex !important;
    flex-direction: column !important;
    padding: .75rem 1.75rem 2rem;
    gap: .5rem;
    list-style: none !important;
}

/* Card — horizontal flex row */
.pq-org-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 1rem;
    padding: .875rem 1rem;
    border: 1.5px solid #e9ecef !important;
    border-radius: 10px;
    background: #ffffff !important;
    text-decoration: none !important;
    transition: border-color .2s, box-shadow .2s, transform .15s;
    overflow: visible;
    box-sizing: border-box;
}
.pq-org-card:hover {
    border-color: var(--pq-primary) !important;
    box-shadow: 0 4px 20px rgba(27,135,96,.12);
    transform: translateY(-1px);
}

/* Logo box — fixed 56px square, clips image inside */
.pq-org-card > .pq-org-card-logo {
    flex: 0 0 56px !important;
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    background: #f8f9fa;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden;
}
.pq-org-card > .pq-org-card-logo img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    padding: 5px;
    display: block !important;
}
.pq-org-logo-placeholder {
    color: #ced4da !important;
    font-size: 1.4rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100%;
    height: 100%;
}

/* Info column — grows to fill all space between logo and button */
.pq-org-card > .pq-org-card-info {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: .1rem;
    overflow: hidden;
}

/* Org name */
.pq-org-card > .pq-org-card-info > .pq-org-card-name,
.pq-org-card .pq-org-card-name {
    font-size: .975rem !important;
    font-weight: 700 !important;
    color: #212529 !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.35 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: none !important;
    border: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

/* City and phone meta lines */
.pq-org-card > .pq-org-card-info > .pq-org-card-city,
.pq-org-card > .pq-org-card-info > .pq-org-card-phone,
.pq-org-card .pq-org-card-city,
.pq-org-card .pq-org-card-phone {
    font-size: .8rem !important;
    color: #868e96 !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.5 !important;
    display: flex !important;
    align-items: center !important;
    gap: .3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    visibility: visible !important;
    opacity: 1 !important;
    background: none !important;
    border: none !important;
}
.pq-org-card .pq-org-card-city i,
.pq-org-card .pq-org-card-phone i {
    font-size: .65rem !important;
    color: var(--pq-primary) !important;
    opacity: .75 !important;
    flex-shrink: 0;
    width: 10px;
    text-align: center;
    display: inline-block !important;
    visibility: visible !important;
}

/* CTA button — fixed right side, never shrinks */
.pq-org-card > .pq-org-select-btn,
.pq-org-card .pq-org-select-btn {
    flex: 0 0 auto !important;
    padding: .5rem 1rem !important;
    font-size: .85rem !important;
    border-radius: 6px !important;
    white-space: nowrap;
    display: inline-flex !important;
    align-items: center !important;
    gap: .4rem;
    color: #fff !important;
    background: var(--pq-primary) !important;
    text-decoration: none !important;
}
.pq-org-select-btn i {
    font-size: .75rem !important;
    color: #fff !important;
    transition: transform .2s ease;
}
.pq-org-card:hover .pq-org-select-btn i { transform: translateX(3px); }

/* Empty state */
.pq-org-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #adb5bd !important;
    display: block !important;
    visibility: visible !important;
}
.pq-org-empty i { font-size: 2.5rem; display: block; margin-bottom: .75rem; }
.pq-org-empty p { color: #adb5bd !important; }

/* Mobile */
@media (max-width: 600px) {
    .pq-org-grid { padding: .5rem 1rem 1.5rem; }
    .pq-org-search-wrap { padding: 1rem 1rem .5rem; }
    .pq-org-card { padding: .75rem .875rem; gap: .75rem; }
    .pq-org-card > .pq-org-card-logo {
        flex: 0 0 46px !important;
        width: 46px !important;
        height: 46px !important;
        min-width: 46px !important;
    }
    .pq-org-card .pq-org-card-name { font-size: .9rem !important; }
    .pq-org-card .pq-org-select-btn { padding: .45rem .75rem !important; font-size: .8rem !important; }
}
