/* ✅ Brand Colours */
:root {
    --qf-purple: #2a0c4b;
    --qf-orange: #ff5722;
    --sidebar-bg: #f5f5f7;
    --sidebar-hover: #ebebef;
    --text-dark: #222;
    --card-bg: #ffffff;
}

/* ✅ Layout Reset */
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: #f0f1f6;
    color: var(--text-dark);
}

/* ✅ Header */
#qf-header {
    background: var(--qf-purple);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#qf-header .brand {
    font-size: 20px;
    font-weight: bold;
}

#qf-header button {
    background: var(--qf-orange);
    border: none;
    padding: 6px 12px;
    color: white;
    cursor: pointer;
}

/* ✅ Sidebar */
#qf-sidebar {
    position: fixed;
    top: 50px;
    left: 0;
    width: 210px;
    height: calc(100% - 50px);
    background: var(--sidebar-bg);
    border-right: 1px solid #ddd;
}

#qf-sidebar .nav-item {
    padding: 14px;
    cursor: pointer;
    border-bottom: 1px solid #e5e5e5;
}

#qf-sidebar .nav-item:hover {
    background: var(--sidebar-hover);
}

#qf-sidebar .nav-item.active {
    border-left: 4px solid var(--qf-orange);
    background: #fff;
}

/* ✅ Main Panel */
#qf-main {
    margin-left: 220px;
    padding: 20px;
}

.panel {
    display: none;
}

.panel.active {
    display: block;
}

/* ✅ Tables */
.table-card {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #fafafa;
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

td {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

/* ✅ Status Badges */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    color: white;
    font-size: 12px;
}

.badge.created { background: grey; }
.badge.ordered { background: #3f51b5; }
.badge.part { background: #ff9800; }
.badge.delivered { background: #4caf50; }
.badge.late { background: #d32f2f; }

.btn-po {
    background: #6b4dfc;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.btn-po:hover {
    background: #5637f5;
}

/* ========================================================= */
/* PO CREATION MODAL — Phase 3 Step 3                        */
/* ========================================================= */

#po-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(2px);
    z-index: 9000;
    display: none;
}

#po-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 80%;
    max-height: 85vh;
    overflow-y: auto;
    transform: translate(-50%, -50%);
    background: #ffffff;
    padding: 0;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    z-index: 10000;
    display: none;
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

.po-modal-header {
    background: #6b4dfc;
    color: white;
    padding: 14px 18px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.po-modal-header h2 {
    margin: 0;
    font-size: 18px;
}

#po-modal-close {
    background: transparent;
    border: none;
    font-size: 22px;
    color: white;
    cursor: pointer;
}

.po-modal-body {
    padding: 18px;
}

.po-field {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
}

.po-field label {
    font-weight: 600;
    margin-bottom: 3px;
    color: #333;
}

.po-field input,
.po-field textarea,
.po-field select {
    padding: 8px;
    border: 1px solid #bbb;
    border-radius: 6px;
    font-size: 14px;
    width: 100%;
}

.po-field textarea {
    resize: vertical;
    min-height: 60px;
}

.po-modal-footer {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-grey {
    background: #e0e0e0;
    padding: 7px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-grey:hover {
    background: #d5d5d5;
}

/* ========================================================= */
/* PO TOTALS BOX                                              */
/* ========================================================= */

.po-totals-box {
    margin-top: 20px;
    border: 2px solid #333;
    padding: 0;
    border-radius: 6px;
    overflow: hidden;
    width: 100%;
}

.po-totals-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.po-totals-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #999;
}

.po-totals-table tr:nth-child(odd) td {
    background: #e3e3e3;
}

.po-totals-table tr:nth-child(even) td {
    background: #f2f2f2;
}

.po-totals-table .label {
    text-align: right;
    font-weight: 600;
    width: 60%;
}

.po-totals-table .value {
    text-align: right;
    width: 40%;
}

.po-totals-table .value input {
    width: 120px;
    text-align: right;
    padding: 4px 6px;
}

.po-totals-table .strong {
    font-weight: 700;
    font-size: 17px;
}