/* =====================================================================
   QuoteModule.css
   Styles for the CutList Quoting front-end: Get Quote button,
   cost breakdown table, SVG pattern grid, edge legend.
   ===================================================================== */

/* -----------------------------------------------------------------
   Get Quote button
   ----------------------------------------------------------------- */

.dnn-cutlist-quote-btn {
    display: inline-block;
    margin: 8px 0 16px;
    padding: 8px 20px;
    background: #2980b9;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.dnn-cutlist-quote-btn:hover {
    background: #1a6ea5;
}

.dnn-cutlist-quote-btn:disabled {
    background: #7fb3d3;
    cursor: not-allowed;
}

/* -----------------------------------------------------------------
   Quote results container
   ----------------------------------------------------------------- */

.dnn-cutlist-quote-results {
    margin-top: 16px;
    font-family: Arial, sans-serif;
    font-size: 13px;
    color: #333;
}

.dnn-cutlist-quote-results h3 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #2c3e50;
    border-bottom: 2px solid #2980b9;
    padding-bottom: 6px;
}

/* -----------------------------------------------------------------
   Status / error messages
   ----------------------------------------------------------------- */

.dnn-cutlist-quote-status {
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 13px;
}

.dnn-cutlist-quote-status.loading {
    background: #eaf4fb;
    color: #2980b9;
    border: 1px solid #aed6f1;
}

.dnn-cutlist-quote-status.error {
    background: #fdf2f2;
    color: #c0392b;
    border: 1px solid #f5b7b1;
}

/* -----------------------------------------------------------------
   Cost breakdown table
   ----------------------------------------------------------------- */

.dnn-quote-cost-table {
    width: 100%;
    max-width: 560px;
    border-collapse: collapse;
    margin-bottom: 24px;
}

.dnn-quote-cost-table th,
.dnn-quote-cost-table td {
    padding: 7px 10px;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
}

.dnn-quote-cost-table th {
    background: #f5f7fa;
    font-weight: 600;
    color: #555;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dnn-quote-cost-table td:last-child {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.dnn-quote-cost-table tr:last-child td {
    border-bottom: none;
}

/* Subtotals row */
.dnn-quote-cost-table tr.subtotal td {
    border-top: 1px solid #ccc;
    font-weight: 600;
}

/* Grand total row */
.dnn-quote-cost-table tr.grand-total td {
    border-top: 2px solid #2980b9;
    font-size: 14px;
    font-weight: 700;
    color: #2c3e50;
    padding-top: 10px;
}

/* -----------------------------------------------------------------
   Sheet pattern section heading
   ----------------------------------------------------------------- */

.dnn-quote-patterns-heading {
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 12px;
    padding-bottom: 4px;
    border-bottom: 1px solid #ddd;
}

/* -----------------------------------------------------------------
   Sheet pattern grid
   ----------------------------------------------------------------- */

.dnn-quote-pattern-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

/* Individual pattern card */
.dnn-quote-pattern-card {
    background: #fff;
    border: 1px solid #dce0e6;
    border-radius: 6px;
    padding: 10px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    flex: 0 0 auto;
    max-width: 100%;
}

.dnn-quote-pattern-card .pattern-title {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin: 0 0 6px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.dnn-quote-pattern-card .pattern-title .pattern-copies {
    background: #2980b9;
    color: #fff;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 500;
}

.dnn-quote-pattern-card .pattern-title .pattern-book-cut {
    background: #6c3483;
    color: #fff;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 6px;
}

.dnn-quote-pattern-card .pattern-meta {
    font-size: 11px;
    color: #888;
    margin: 0 0 8px;
}

/* Dev diagnostics toggle */
.dnn-quote-pattern-card .debug-toggle {
    background: none;
    border: 1px solid #bbb;
    border-radius: 3px;
    color: #888;
    cursor: pointer;
    font-size: 10px;
    margin: 0 0 4px;
    padding: 2px 6px;
}
.dnn-quote-pattern-card .debug-notes {
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-family: monospace;
    font-size: 10px;
    line-height: 1.5;
    margin: 0 0 8px;
    overflow-x: auto;
    padding: 8px;
    white-space: pre;
}

/* SVG container inside the card */
.dnn-quote-pattern-card .pattern-svg-wrap {
    display: block;
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    background: #f9f9f9;
}

.dnn-quote-pattern-card .pattern-svg-wrap svg {
    display: block;
    width: 100%;
    height: auto;
}

/* -----------------------------------------------------------------
   Edge colour legend
   ----------------------------------------------------------------- */

.dnn-quote-edge-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin: 4px 0 20px;
    font-size: 12px;
    color: #555;
}

.dnn-quote-edge-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dnn-quote-edge-legend-swatch {
    display: inline-block;
    width: 24px;
    height: 4px;
    border-radius: 2px;
}

.swatch-top    { background: #c0392b; }
.swatch-bottom { background: #d35400; }
.swatch-left   { background: #2980b9; }
.swatch-right  { background: #27ae60; }
.swatch-grain  { background: #6d4c41; border-top: 2px dashed #6d4c41; height: 0; }

/* -----------------------------------------------------------------
   Responsive — narrow viewports
   ----------------------------------------------------------------- */

@media (max-width: 520px) {
    .dnn-quote-pattern-card {
        width: 100%;
    }

    .dnn-quote-cost-table {
        max-width: 100%;
    }
}

/* -----------------------------------------------------------------
   Quote Admin Panel
   ----------------------------------------------------------------- */

.qadmin-toggle-bar {
    text-align: right;
    padding: 6px 0 4px;
}

.qadmin-toggle-btn {
    background: none;
    border: 1px solid #bbb;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.qadmin-toggle-btn:hover {
    background: #f0f0f0;
    color: #222;
}

.qadmin-panel {
    background: #f7f9fc;
    border: 1px solid #c8d3df;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #333;
}

.qadmin-header { margin-bottom: 12px; }

.qadmin-title {
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.qadmin-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #d0d8e4;
    margin-bottom: 16px;
}

.qadmin-tab {
    background: none;
    border: 1px solid transparent;
    border-bottom: none;
    padding: 6px 16px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    color: #666;
    position: relative;
    bottom: -2px;
}

.qadmin-tab:hover { background: #edf1f7; }

.qadmin-tab.active {
    background: #f7f9fc;
    border-color: #d0d8e4;
    border-bottom-color: #f7f9fc;
    color: #2c3e50;
    font-weight: 600;
}

.qadmin-form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.qadmin-label {
    width: 200px;
    font-weight: 500;
    color: #444;
    flex-shrink: 0;
}

.qadmin-hint { font-size: 11px; color: #888; }

.qadmin-input {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    width: 120px;
}

.qadmin-input:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 2px rgba(41,128,185,0.15);
}

.qadmin-select {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    min-width: 200px;
    color: #333;
    background-color: #fff;
}

.qadmin-select option {
    color: #333;
    background-color: #fff;
}

.qadmin-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 12px;
}

.qadmin-table th {
    background: #edf1f7;
    padding: 6px 8px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 1px solid #d0d8e4;
}

.qadmin-table td {
    padding: 5px 6px;
    border-bottom: 1px solid #e8edf3;
    vertical-align: middle;
}

.qadmin-table .qadmin-input { width: 100px; padding: 3px 6px; }
.qadmin-table .qadmin-actions { white-space: nowrap; }

.qadmin-empty {
    color: #999;
    font-style: italic;
    padding: 10px;
    text-align: center;
}

.qadmin-add-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 0;
    border-top: 1px dashed #c8d3df;
    margin-top: 4px;
}

.qadmin-add-label {
    font-weight: 600;
    font-size: 12px;
    color: #555;
    flex-shrink: 0;
}

.qadmin-btn {
    padding: 4px 10px;
    border: 1px solid #bbb;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    background: #fff;
    color: #333;
}

.qadmin-btn:hover { background: #edf1f7; }

.qadmin-btn-primary { background: #2980b9; border-color: #2473a8; color: #fff; }
.qadmin-btn-primary:hover { background: #1a6ea5; }
.qadmin-btn-save  { background: #27ae60; border-color: #229954; color: #fff; }
.qadmin-btn-save:hover  { background: #1e9050; }
.qadmin-btn-del   { background: #e74c3c; border-color: #d44232; color: #fff; }
.qadmin-btn-del:hover   { background: #cf3424; }

.qadmin-msg {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.qadmin-msg-ok    { background: #eafaf1; color: #1e8449; border: 1px solid #a9dfbf; }
.qadmin-msg-error { background: #fdf2f2; color: #c0392b; border: 1px solid #f5b7b1; }

/* -----------------------------------------------------------------
   Quote totals summary row (sheets / cut metres / edge metres)
   ----------------------------------------------------------------- */

.dnn-quote-totals-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.dnn-quote-total-cell {
    background: #f0f7fd;
    border: 1px solid #aed6f1;
    border-radius: 6px;
    padding: 10px 18px;
    text-align: center;
    min-width: 90px;
    flex: 1 0 80px;
}

.dnn-quote-total-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #2980b9;
    line-height: 1.2;
}

.dnn-quote-total-label {
    display: block;
    font-size: 11px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 3px;
}


/* ================================================================
   Dev / Benchmark panel
   ================================================================ */

.dnn-quote-dev-panel {
    margin: 16px 0;
    border: 1px dashed #e67e22;
    border-radius: 6px;
    background: #fef9f0;
    padding: 0;
    font-size: 12px;
}

.dnn-quote-dev-panel > summary {
    padding: 8px 14px;
    cursor: pointer;
    color: #e67e22;
    font-weight: 600;
    user-select: none;
    list-style: none;
}

.dnn-quote-dev-panel > summary::-webkit-details-marker { display: none; }
.dnn-quote-dev-panel[open] > summary { border-bottom: 1px dashed #e67e22; }

.dnn-quote-dev-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.dnn-quote-dev-table th,
.dnn-quote-dev-table td {
    padding: 5px 12px;
    text-align: left;
    border-bottom: 1px solid #fce8c8;
    vertical-align: top;
}

.dnn-quote-dev-table tr.dev-header th {
    background: #fce8c8;
    color: #7d4900;
    font-weight: 700;
}

.dnn-quote-dev-table td.dev-match {
    color: #27ae60;
    font-weight: 600;
}

.dnn-quote-dev-table td.dev-diff {
    color: #c0392b;
    font-weight: 600;
}
