/* ═══════════════════════════════════════════════════
   SDM Orcamento via WhatsApp — v1.2.0
   Shopping do Mecanico Ferramentas
═══════════════════════════════════════════════════ */

:root {
    --sdm-red:     #C0001A;
    --sdm-dark:    #1A1A1A;
    --sdm-gray:    #F5F5F5;
    --sdm-border:  #E0E0E0;
    --sdm-text:    #1A1A1A;
    --sdm-sub:     #666;
    --sdm-green:   #25D366;
    --sdm-radius:  10px;
    --sdm-shadow:  0 8px 40px rgba(0,0,0,0.18);
    --sdm-w:       420px;
    --sdm-z:       99999;
}

.sdm-hidden { display: none !important; }

/* ─── BOTAO FLUTUANTE ────────────────────────────── */
#sdm-cart-toggle {
    position: fixed;
    bottom: 100px;
    right: 24px;
    z-index: var(--sdm-z);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px;
    height: 50px;
    border-radius: 25px;
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(192,0,26,0.45);
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}
#sdm-cart-toggle:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 6px 28px rgba(192,0,26,0.55);
}
#sdm-cart-badge {
    background: #fff;
    color: var(--sdm-red);
    font-size: 11px;
    font-weight: 900;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
}

/* ─── OVERLAY ────────────────────────────────────── */
#sdm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: calc(var(--sdm-z) + 1);
    backdrop-filter: blur(2px);
}
#sdm-overlay.sdm-active { display: block; }

/* ─── DRAWER ─────────────────────────────────────── */
#sdm-drawer {
    position: fixed;
    top: 0;
    right: -440px;
    width: var(--sdm-w);
    max-width: 100vw;
    height: 100vh;
    background: #fff;
    z-index: calc(var(--sdm-z) + 2);
    display: flex;
    flex-direction: column;
    box-shadow: var(--sdm-shadow);
    transition: right 0.32s cubic-bezier(0.4,0,0.2,1);
    font-family: 'Barlow', Arial, sans-serif;
}
#sdm-drawer.sdm-open { right: 0; }

/* ─── HEADER ─────────────────────────────────────── */
#sdm-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    background: var(--sdm-dark);
    color: #fff;
    flex-shrink: 0;
}
#sdm-drawer-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
}
#sdm-drawer-close {
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
#sdm-drawer-close:hover { background: rgba(255,255,255,0.25); }

/* ─── BANNER CARRINHO RESTAURADO ─────────────────── */
#sdm-restored-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: #e8f5e9;
    border-bottom: 1px solid #c8e6c9;
    font-size: 13px;
    font-weight: 600;
    color: #1b5e20;
    flex-shrink: 0;
}
#sdm-clear-restored {
    background: none;
    border: 1px solid #1b5e20;
    color: #1b5e20;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
}
#sdm-clear-restored:hover { background: #c8e6c9; }

/* ─── BODY ───────────────────────────────────────── */
#sdm-drawer-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* ─── LISTA DE ITENS ─────────────────────────────── */
#sdm-items-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 16px 22px;
    min-height: 120px;
}
#sdm-empty-msg {
    text-align: center;
    padding: 40px 20px;
    color: var(--sdm-sub);
}
.sdm-empty-icon { font-size: 48px; margin-bottom: 12px; }
#sdm-empty-msg p { margin: 6px 0; font-size: 15px; }

#sdm-items-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sdm-item {
    display: grid;
    grid-template-columns: 68px 1fr auto;
    gap: 12px;
    align-items: center;
    background: var(--sdm-gray);
    border-radius: var(--sdm-radius);
    padding: 12px;
    border: 1px solid var(--sdm-border);
}
.sdm-item-img {
    width: 68px;
    height: 68px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.sdm-item-img-ph {
    width: 68px;
    height: 68px;
    border-radius: 6px;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}
.sdm-item-info { min-width: 0; }
.sdm-item-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--sdm-text);
    line-height: 1.3;
    margin-bottom: 4px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.sdm-item-price {
    font-size: 14px;
    font-weight: 800;
    color: var(--sdm-red);
}
.sdm-item-sub {
    font-size: 11px;
    color: var(--sdm-sub);
    margin-top: 2px;
}
.sdm-item-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.sdm-qty-mini {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--sdm-border);
    border-radius: 6px;
    overflow: hidden;
}
.sdm-qty-mini button {
    background: none;
    border: none;
    width: 26px;
    height: 26px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    color: var(--sdm-dark);
}
.sdm-qty-mini button:hover { background: var(--sdm-gray); }
.sdm-qty-mini input {
    width: 32px;
    border: none;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--sdm-dark);
    padding: 0;
    background: transparent;
}
.sdm-qty-mini input:focus { outline: none; }
.sdm-remove-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 16px;
    padding: 2px;
    transition: color 0.15s;
}
.sdm-remove-btn:hover { color: var(--sdm-red); }

/* ─── TOTAL ──────────────────────────────────────── */
#sdm-total-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 22px;
    background: #fff;
    border-top: 1px solid var(--sdm-border);
    font-size: 14px;
    color: var(--sdm-sub);
    flex-shrink: 0;
}
#sdm-total-display {
    font-size: 22px;
    font-weight: 900;
    color: var(--sdm-red);
}

/* ─── BANNER VALIDADE ────────────────────────────── */
#sdm-validade-banner {
    padding: 8px 22px;
    background: #fff8e1;
    border-top: 1px solid #ffe082;
    font-size: 12px;
    color: #795500;
    text-align: center;
    flex-shrink: 0;
}

/* ─── FORMULARIO ─────────────────────────────────── */
#sdm-form-wrap {
    padding: 18px 22px 28px;
    background: #fff;
    border-top: 1px solid var(--sdm-border);
    flex-shrink: 0;
}
#sdm-form-wrap h3 {
    font-size: 14px;
    font-weight: 800;
    color: var(--sdm-dark);
    margin: 0 0 4px;
    border: none;
    padding: 0;
}
.sdm-form-note {
    font-size: 12px;
    color: var(--sdm-sub);
    margin: 0 0 14px;
}

/* ─── SELETOR DE VENDEDOR ────────────────────────── */
.sdm-vendedor-field { margin-bottom: 14px; }
.sdm-vendedor-field > label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--sdm-sub);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sdm-vendedor-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sdm-vendedor-option {
    display: flex;
    align-items: center;
    cursor: pointer;
}
.sdm-vendedor-option input[type="radio"] {
    display: none;
}
.sdm-vo-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--sdm-border);
    border-radius: 8px;
    transition: all 0.15s;
    background: var(--sdm-gray);
}
.sdm-vo-inner strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--sdm-dark);
}
.sdm-vo-inner small {
    font-size: 11px;
    color: var(--sdm-sub);
}
.sdm-vendedor-option input:checked + .sdm-vo-inner {
    border-color: var(--sdm-red);
    background: #fff5f5;
}
.sdm-vendedor-option:hover .sdm-vo-inner {
    border-color: #ccc;
    background: #fff;
}

.sdm-field { margin-bottom: 10px; }
.sdm-field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--sdm-sub);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sdm-required { color: var(--sdm-red); }
.sdm-optional { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 11px; }

.sdm-field input,
.sdm-field textarea {
    width: 100%;
    border: 1.5px solid var(--sdm-border);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--sdm-dark);
    background: var(--sdm-gray);
    transition: border-color 0.2s, background 0.2s;
    box-sizing: border-box;
}
.sdm-field input:focus {
    outline: none;
    border-color: var(--sdm-red);
    background: #fff;
}

#sdm-submit-btn {
    width: 100%;
    border: none;
    color: #fff;
    padding: 15px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: filter 0.2s, transform 0.15s;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
#sdm-submit-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

#sdm-form-error {
    margin-top: 8px;
    padding: 10px 14px;
    background: #fff0f0;
    border: 1px solid #ffcccc;
    border-radius: 6px;
    color: var(--sdm-red);
    font-size: 13px;
    font-weight: 600;
}
.sdm-privacy-note {
    margin: 10px 0 0;
    font-size: 11px;
    color: #aaa;
    text-align: center;
}

/* ─── TELA DE SUCESSO ────────────────────────────── */
#sdm-success-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 28px;
    text-align: center;
}
.sdm-success-icon {
    width: 72px;
    height: 72px;
    background: #e8f5e9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: #2e7d32;
    margin-bottom: 20px;
    font-weight: 900;
}
#sdm-success-screen h3 {
    font-size: 22px;
    font-weight: 900;
    color: var(--sdm-dark);
    margin: 0 0 10px;
    border: none;
    padding: 0;
}
#sdm-success-screen p {
    font-size: 15px;
    color: var(--sdm-sub);
    line-height: 1.6;
    margin-bottom: 24px;
}
#sdm-new-orcamento {
    border: none;
    color: #fff;
    padding: 13px 28px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: filter 0.2s;
}
#sdm-new-orcamento:hover { filter: brightness(1.1); }

/* ─── BOTOES NO PRODUTO ──────────────────────────── */
.sdm-product-actions { margin-top: 20px; }
.sdm-qty-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.sdm-qty-wrap label {
    font-size: 14px;
    font-weight: 600;
    color: var(--sdm-sub);
}
.sdm-qty-control {
    display: flex;
    align-items: center;
    border: 2px solid var(--sdm-border);
    border-radius: 6px;
    overflow: hidden;
}
.sdm-qty-btn {
    width: 36px;
    height: 36px;
    background: var(--sdm-gray);
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.sdm-qty-btn:hover { background: var(--sdm-border); }
.sdm-qty-input {
    width: 48px;
    border: none;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--sdm-dark);
    padding: 0;
}
.sdm-qty-input:focus { outline: none; }

/* Botao padrao */
.sdm-add-to-cart-btn {
    width: 100%;
    padding: 15px 24px;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 15px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: filter 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.sdm-add-to-cart-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    color: #fff !important;
}

/* Estado "ja no orcamento" */
.sdm-add-to-cart-btn.sdm-in-cart {
    background: #1A7A3A !important;
    border-color: #1A7A3A !important;
}

.sdm-feedback {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    background: #e8f5e9;
    color: #1A7A3A;
    border: 1px solid #c8e6c9;
}

/* ─── BOTAO NO LOOP ──────────────────────────────── */
.sdm-add-to-cart-loop {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: filter 0.2s;
}
.sdm-add-to-cart-loop:hover {
    filter: brightness(1.12);
    color: #fff !important;
}
.sdm-add-to-cart-loop.sdm-in-cart {
    background: #1A7A3A !important;
    border-color: #1A7A3A !important;
}

/* ─── ANIMACAO BADGE ─────────────────────────────── */
@keyframes sdm-pop {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.6); }
    100% { transform: scale(1); }
}
.sdm-pop { animation: sdm-pop 0.35s ease; }

/* ─── RESPONSIVO ─────────────────────────────────── */
@media (max-width: 480px) {
    #sdm-drawer { width: 100vw; right: -100vw; }
    #sdm-cart-toggle { bottom: 80px; right: 14px; }
}
