
/* =========================
   ROOT
========================= */

:root {
    --primary: #108082;
    --primary-dark: #0d6668;
    --secondary: #323232;
    --bg: #f4f7fb;
    --card: #ffffff;
    --border: #e5e7eb;
    --text: #1f2937;
    --muted: #6b7280;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
}

/* =========================
   RESET
========================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg);
    font-family: "Segoe UI", sans-serif;
    color: var(--text);
}

button,
input,
select,
textarea {
    font-family: inherit;
}

/* =========================
   MAIN
========================= */

.main-content {
    padding: 25px;
}

/* =========================
   TOPBAR
========================= */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.topbar-left h1 {
    font-size: 28px;
    margin-bottom: 5px;
}

.topbar-left p {
    color: var(--muted);
}

.topbar-right {
    display: flex;
    gap: 10px;
}

/* =========================
   BUTTONS
========================= */

.btn {
    border: none;
    outline: none;
    cursor: pointer;
    border-radius: 10px;
    padding: 12px 18px;
    font-weight: 600;
    transition: 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
}

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

.btn.primary:hover {
    background: var(--primary-dark);
}

.btn.secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn.light {
    background: #f3f4f6;
    color: var(--text);
}

.btn.danger {
    background: var(--danger);
    color: #fff;
}

/* =========================
   STATS
========================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--card);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.stat-icon {
    width: 55px;
    height: 55px;
    background: rgba(16, 128, 130, 0.15);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.stat-icon.info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.stat-card h3 {
    font-size: 28px;
}

.stat-card p {
    color: var(--muted);
    margin-top: 4px;
}

/* =========================
   SECTION CARD
========================= */

.section-card {
    background: #fff;
    border-radius: 18px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

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

.section-header h2 {
    margin-bottom: 5px;
}

.section-header p {
    color: var(--muted);
}

/* =========================
   FILTERS
========================= */

.filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.input-control {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    outline: none;
}

.input-control:focus {
    border-color: var(--primary);
}

/* =========================
   TABLE
========================= */

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f8fafc;
}

thead th {
    padding: 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    white-space: nowrap;
}

tbody td {
    padding: 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}

tbody tr:hover {
    background: #fafafa;
}

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 40px;
}

/* =========================
   STATUS
========================= */

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-created {
    background: #fef3c7;
    color: #92400e;
}

.status-generated {
    background: #dcfce7;
    color: #166534;
}

/* =========================
   ACTION BUTTONS
========================= */

.action-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

.action-btn {
    border: none;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
    color: #fff;
    transition: 0.2s ease;
}

.action-btn:hover {
    transform: translateY(-2px);
}

.view-btn {
    background: var(--info);
}

.quote-btn {
    background: var(--success);
}

.reject-btn {
    background: var(--danger);
}

/* =========================
   MOBILE CARDS
========================= */

.mobile-orders {
    display: none;
}

.mobile-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 15px;
    margin-bottom: 15px;
}

.mobile-card h3 {
    margin-bottom: 10px;
}

.mobile-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

/* =========================
   MODAL
========================= */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-box {
    background: #fff;
    width: 95vw;
    max-width: 1400px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.large-modal {
    max-width: 1400px !important;
    width: 95vw !important;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 22px;
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* =========================
   FORM
========================= */

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    position: relative;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    outline: none;
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
}

.required {
    color: var(--danger);
}

/* =========================
   SECTION TITLE
========================= */

.section-title {
    grid-column: 1 / -1;
    margin-top: 10px;
    margin-bottom: 5px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.section-title h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
    font-size: 18px;
    font-weight: 700;
}

/* =========================
   GIFT TABLE
========================= */

.gift-table {
    width: 100%;
    border-collapse: collapse;
    grid-column: 1 / -1;
}

.gift-table th {
    background: var(--primary);
    color: #fff;
    padding: 12px;
    text-align: left;
}

.gift-table td {
    border: 1px solid var(--border);
    padding: 10px;
}

.gift-table input {
    width: 100%;
}

/* =========================
   SCHEME SECTION
========================= */

#schemeItemsContainer {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scheme-row {
    display: grid;
    grid-template-columns:
        minmax(250px, 1fr)
        100px
        100px
        50px;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.scheme-row select,
.scheme-row input {
    width: 100%;
    height: 44px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 0 12px;
    font-size: 14px;
    background: #fff;
    transition: 0.3s;
}

.scheme-row select:focus,
.scheme-row input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 128, 130, 0.15);
}

.schemeItem {
    width: 100%;
    min-width: 250px;
}

.scheme-price {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-weight: 700;
    color: var(--primary);
}

.schemeQty {
    width: 100%;
}

.add-scheme-btn,
.remove-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    transition: 0.3s;
}

.add-scheme-btn {
    background: var(--primary);
}

.add-scheme-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.remove-btn {
    background: var(--danger);
}

.remove-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* =========================
   SCHEME VALUE
========================= */

#schemeValue {
    background: #f8fafc;
    font-weight: 700;
    color: var(--primary);
    text-align: right;
    font-size: 16px;
}

/* =========================
   CUSTOMER EDIT BUTTON
========================= */

.customer-edit-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.customer-edit-btn {
    border: none;
    background: var(--primary);
    color: #fff;
    padding: 9px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: 0.3s;
}

.customer-edit-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.customer-edit-btn.active {
    background: var(--warning);
}

.editable-field {
    background: #fffdf3 !important;
    border-color: var(--warning) !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.customer-create-btn {
    background: #16a34a;
    color: #fff;
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    margin-left: 10px;
}

/* =========================
   CUSTOMER DROPDOWN
========================= */

.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #ddd;
    max-height: 250px;
    overflow-y: auto;
    z-index: 999999;
    display: none;
}

.dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.dropdown-item:hover {
    background: #f3f4f6;
}

.dropdown-item:last-child {
    border-bottom: none;
}

/* =========================
   ENHANCED QUOTATION MODAL
========================= */

.quotation-modal-xl .modal-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.quotation-modal-xl .modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: #fff;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.quotation-modal-xl .modal-body {
    max-height: 75vh;
    padding-top: 16px;
    padding-bottom: 16px;
}

.quotation-modal-xl .section-title {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0;
    border-top: none;
}

.quotation-modal-xl .section-title h3 {
    font-size: 16px;
    padding: 14px 18px;
    margin: 0;
    background: rgba(16, 128, 130, 0.06);
    border-radius: 14px 14px 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
}

.quotation-modal-xl .section-card-body {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    background: #fff;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 14px 14px;
    padding: 18px;
    margin-bottom: 6px;
}

.quotation-modal-xl .customer-edit-title {
    grid-column: 1 / -1;
    margin: 0;
    padding: 14px 18px;
    background: rgba(16, 128, 130, 0.06);
    border-radius: 14px 14px 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.quotation-modal-xl .customer-edit-title h3 {
    margin: 0;
    color: var(--primary);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.quotation-modal-xl .customer-edit-title .customer-edit-btn,
.quotation-modal-xl .customer-edit-title .customer-create-btn {
    margin-left: 0;
}

/* =========================
   GRAND TOTAL CARD
========================= */

.grand-total-card {
    grid-column: 1 / -1;
    background: linear-gradient(
        135deg,
        var(--primary) 0%,
        var(--primary-dark) 100%
    );
    border-radius: 14px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    color: #fff;
    box-shadow: 0 8px 20px rgba(16, 128, 130, 0.25);
}

.grand-total-card .grand-total-label {
    font-size: 14px;
    font-weight: 600;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.grand-total-card .grand-total-value {
    font-size: 28px;
    font-weight: 800;
}

.grand-total-card .grand-total-breakdown {
    font-size: 13px;
    opacity: 0.85;
    margin-top: 4px;
}

.grand-total-hidden-input {
    grid-column: 1 / -1;
}

.grand-total-hidden-input input {
    display: none;
}

/* =========================
   MODAL POLISH
========================= */

.quotation-modal-xl .form-group label {
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 700;
}

.quotation-modal-xl .form-group input,
.quotation-modal-xl .form-group select,
.quotation-modal-xl .form-group textarea {
    font-size: 14px;
}

.quotation-modal-xl #editLockInfo {
    display: block;
    grid-column: 1 / -1;
    background: #fef3c7;
    color: #92400e;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12.5px;
    font-weight: 600;
}

/* =========================
   NEW ORDER POPUP
========================= */

#quotationNewOrderPopup {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.confirm-popup-card {
    width: 92%;
    max-width: 430px;
    background: #fff;
    border-radius: 18px;
    padding: 28px;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
}

.confirm-popup-icon {
    font-size: 42px;
    color: var(--primary);
    margin-bottom: 14px;
}

.confirm-popup-card h2 {
    margin-bottom: 10px;
    color: #111827;
}

.confirm-popup-card p {
    color: #475569;
    line-height: 1.7;
}

.confirm-popup-btn {
    border: none;
    background: var(--primary);
    color: #fff;
    padding: 11px 18px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

/* =========================
   QUOTATION PAGINATION
========================= */

.quotation-pagination-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 16px 0 2px;
}

.quotation-pagination-info {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.quotation-mini-note {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.quotation-pagination-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    flex-wrap: wrap;
}

.quotation-page-btn {
    min-width: 38px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #d7dee8;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.quotation-page-btn:hover:not(:disabled),
.quotation-page-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}

.quotation-page-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    background: #f1f5f9;
}

/* =========================
   TOAST
========================= */

#toastBox {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
}

/* =========================
   SCROLLBAR
========================= */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 50px;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .quotation-modal-xl .section-card-body {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .filters {
        grid-template-columns: 1fr;
    }

    .table-wrap {
        display: none;
    }

    .mobile-orders {
        display: block;
    }

    .form-grid,
    .quotation-modal-xl .section-card-body {
        grid-template-columns: 1fr;
    }

    .scheme-row {
        grid-template-columns: 1fr;
    }

    .add-scheme-btn,
    .remove-btn {
        width: 100%;
        height: 42px;
    }
}

@media (max-width: 600px) {
    .main-content {
        padding: 14px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .topbar-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .btn {
        width: 100%;
    }

    .section-card {
        padding: 16px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .modal {
        padding: 10px;
    }

    .modal-box {
        width: 100%;
    }

    .modal-footer {
        flex-direction: column;
    }

    .quotation-pagination-footer {
        align-items: stretch;
    }

    .quotation-pagination-info,
    .quotation-pagination-controls {
        width: 100%;
    }

    .quotation-pagination-controls {
        justify-content: center;
    }

    .quotation-page-btn {
        flex: 1;
    }
} 