/* frontend/quote-send.css
   PartPulse Smart Quote Send Panel — Dark Theme
   Version 1.0.0
*/

/* ─── Panel Container ────────────────────────────────────────────────── */
.quote-send-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 500px;
    max-width: 100vw;
    background: #0f172a;
    border-left: 1px solid rgba(59, 130, 246, 0.25);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
    z-index: 200;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease;
    opacity: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.quote-send-panel.hidden {
    display: none;
}

.quote-send-panel.open {
    transform: translateX(0);
    opacity: 1;
}

.quote-send-panel.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Scrollbar styling */
.quote-send-panel::-webkit-scrollbar {
    width: 6px;
}
.quote-send-panel::-webkit-scrollbar-track {
    background: #0f172a;
}
.quote-send-panel::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

/* ─── Header ─────────────────────────────────────────────────────────── */
.qs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
    background: #0f172a;
    position: sticky;
    top: 0;
    z-index: 10;
}

.qs-header-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.qs-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.qs-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: -0.01em;
}

.qs-close-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}

.qs-close-btn:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.07);
}

/* ─── Summary Bar ────────────────────────────────────────────────────── */
.qs-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    background: #1e293b;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.qs-quote-number {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.qs-supplier {
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
}

.qs-item-count {
    font-size: 0.78rem;
    color: #64748b;
    background: rgba(148, 163, 184, 0.1);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

.qs-status-badge {
    margin-left: auto;
    font-size: 0.78rem;
    font-weight: 600;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    white-space: nowrap;
}

.qs-status-badge.sent {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

/* ─── Section Labels ─────────────────────────────────────────────────── */
.qs-section-label,
.qs-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
    display: block;
}

.qs-optional {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: #475569;
}

/* ─── Items Table ────────────────────────────────────────────────────── */
.qs-items-section {
    padding: 1rem 1.5rem 0.75rem;
}

.qs-table-wrap {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.qs-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.qs-items-table thead tr {
    background: #1e293b;
}

.qs-items-table th {
    padding: 0.45rem 0.6rem;
    text-align: left;
    font-weight: 600;
    color: #64748b;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.qs-items-table td {
    padding: 0.5rem 0.6rem;
    color: #cbd5e1;
    border-bottom: 1px solid rgba(148, 163, 184, 0.07);
    vertical-align: top;
}

.qs-items-table tbody tr:last-child td {
    border-bottom: none;
}

.qs-items-table tbody tr:hover td {
    background: rgba(59, 130, 246, 0.04);
}

.qs-row-num { color: #475569; font-size: 0.72rem; }
.qs-desc { max-width: 140px; }
.qs-part { font-family: 'Courier New', monospace; font-size: 0.75rem; color: #94a3b8; }
.qs-qty { text-align: right; font-weight: 600; color: #f1f5f9; }
.qs-building { color: #7dd3fc; font-size: 0.75rem; }
.qs-date { white-space: nowrap; color: #94a3b8; font-size: 0.75rem; }

/* ─── Email Field ────────────────────────────────────────────────────── */
.qs-email-field {
    padding: 0.75rem 1.5rem;
}

.qs-input {
    width: 100%;
    box-sizing: border-box;
    background: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    color: #f1f5f9;
    font-size: 0.85rem;
    padding: 0.55rem 0.75rem;
    transition: border-color 0.15s;
    outline: none;
}

.qs-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* ─── Language Toggle ────────────────────────────────────────────────── */
.qs-lang-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.5rem 0.75rem;
}

.qs-lang-btns {
    display: flex;
    gap: 0.4rem;
}

.qs-lang-btn {
    background: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    font-size: 0.78rem;
    padding: 0.3rem 0.7rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s;
}

.qs-lang-btn:hover {
    border-color: rgba(59, 130, 246, 0.4);
    color: #cbd5e1;
}

.qs-lang-btn.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.5);
    color: #93c5fd;
    font-weight: 600;
}

/* ─── Email Preview ──────────────────────────────────────────────────── */
.qs-preview-box {
    margin: 0 1.5rem 0.75rem;
    background: #1e293b;
    border-left: 3px solid #3b82f6;
    border-radius: 0 6px 6px 0;
    overflow: hidden;
}

.qs-preview-label {
    padding: 0.45rem 0.85rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(59, 130, 246, 0.06);
    border-bottom: 1px solid rgba(59, 130, 246, 0.15);
}

.qs-preview-text {
    margin: 0;
    padding: 0.85rem;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 0.72rem;
    line-height: 1.55;
    color: #94a3b8;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 220px;
    overflow-y: auto;
}

.qs-preview-text::-webkit-scrollbar { width: 4px; }
.qs-preview-text::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

/* ─── Send Action Buttons ────────────────────────────────────────────── */
.qs-send-options {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.6rem;
    padding: 0 1.5rem 0.75rem;
}

.qs-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.85rem 0.5rem;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.18s;
    text-align: center;
}

.qs-action-btn.qs-primary {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.35);
    color: #93c5fd;
}

.qs-action-btn.qs-primary:hover {
    background: rgba(59, 130, 246, 0.22);
    border-color: rgba(59, 130, 246, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.qs-action-btn.qs-secondary {
    background: rgba(148, 163, 184, 0.07);
    border-color: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.qs-action-btn.qs-secondary:hover {
    background: rgba(148, 163, 184, 0.14);
    border-color: rgba(148, 163, 184, 0.4);
    transform: translateY(-1px);
}

.qs-action-btn.qs-tertiary {
    background: rgba(99, 102, 241, 0.07);
    border-color: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

.qs-action-btn.qs-tertiary:hover {
    background: rgba(99, 102, 241, 0.14);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.qs-action-btn.copied {
    background: rgba(34, 197, 94, 0.12) !important;
    border-color: rgba(34, 197, 94, 0.4) !important;
    color: #86efac !important;
}

.qs-btn-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.qs-btn-label {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.qs-btn-sub {
    font-size: 0.65rem;
    opacity: 0.6;
    line-height: 1;
}

/* ─── Notes Textarea ─────────────────────────────────────────────────── */
.qs-notes-field {
    padding: 0 1.5rem 0.75rem;
}

.qs-textarea {
    width: 100%;
    box-sizing: border-box;
    background: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    color: #f1f5f9;
    font-size: 0.82rem;
    padding: 0.55rem 0.75rem;
    resize: vertical;
    transition: border-color 0.15s;
    outline: none;
    font-family: inherit;
    min-height: 60px;
}

.qs-textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* ─── Mark as Sent Button ────────────────────────────────────────────── */
.qs-mark-sent-btn {
    margin: 0 1.5rem 1rem;
    width: calc(100% - 3rem);
    padding: 0.8rem 1rem;
    background: #166534;
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 8px;
    color: #86efac;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: not-allowed;
    opacity: 0.4;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}

.qs-mark-sent-btn:not([disabled]),
.qs-mark-sent-btn.enabled {
    cursor: pointer;
    opacity: 1;
    background: #15803d;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.2);
}

.qs-mark-sent-btn:not([disabled]):hover,
.qs-mark-sent-btn.enabled:hover {
    background: #16a34a;
    border-color: rgba(34, 197, 94, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.3);
}

.qs-mark-sent-btn.marked {
    background: #14532d;
    color: #4ade80;
    cursor: default;
}

/* ─── Send History ───────────────────────────────────────────────────── */
.qs-history {
    margin: 0 1.5rem 1.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    padding-top: 0.85rem;
}

.qs-history-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.65rem;
}

.qs-history-empty {
    font-size: 0.8rem;
    color: #475569;
    font-style: italic;
}

.qs-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.qs-history-item {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
}

.qs-history-icon {
    font-size: 1rem;
    line-height: 1.4;
    flex-shrink: 0;
}

.qs-history-details {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.qs-history-method {
    font-size: 0.8rem;
    font-weight: 600;
    color: #cbd5e1;
}

.qs-history-meta {
    font-size: 0.72rem;
    color: #475569;
}

.qs-history-email {
    color: #38bdf8;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
}

.qs-history-notes {
    font-size: 0.72rem;
    color: #64748b;
    font-style: italic;
    margin-top: 0.15rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ─── Send Status in Quotes Table ────────────────────────────────────── */
.quote-sent-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    white-space: nowrap;
}

.quote-sent-badge.sent {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.quote-sent-badge.not-sent {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 540px) {
    .quote-send-panel {
        width: 100vw;
    }

    .qs-send-options {
        grid-template-columns: 1fr 1fr;
    }

    .qs-action-btn.qs-tertiary {
        grid-column: 1 / -1;
    }
}
