/* ===================================================
   PEDIFOOD AI — Cadastro de Loja (CSS Simplificado)
   Mantém a identidade visual, sem complexidades
   =================================================== */

/* ── RESET & BASE ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary:       #E53935;
    --primary-light: #ffeaea;
    --primary-dark:  #b71c1c;
    --secondary:     #FFC107;
    --bg:            #f7f5f2;
    --surface:       #ffffff;
    --border:        #e8e4df;
    --text:          #1a1714;
    --text-secondary:#6b6560;
    --text-hint:     #aba49c;
    --radius-sm:     8px;
    --radius:        14px;
    --font-body:     'DM Sans', system-ui, sans-serif;
    --font-display:  'Syne', system-ui, sans-serif;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

/* ── APP SHELL ── */
.app {
    width: 100%;
    max-width: 520px;
    min-height: 100dvh;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── BARRA DE PROGRESSO ── */
.progress-bar {
    height: 3px;
    background: var(--border);
    flex-shrink: 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

/* ── STEP HEADER ── */
.step-header {
    padding: 16px 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.step-dots {
    display: flex;
    gap: 5px;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.2s;
}

.dot.done {
    background: var(--primary);
    opacity: 0.4;
    width: 12px;
    border-radius: 3px;
}

.dot.active {
    background: var(--primary);
    width: 20px;
    border-radius: 3px;
}

.step-counter {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-hint);
    letter-spacing: 0.06em;
}

/* ── VIEWPORT (painéis) ── */
.viewport {
    flex: 1;
    overflow-y: auto;
    padding: 24px 24px 0;
}

.panel {
    display: none;
}

.panel.active {
    display: block;
}

.panel-eyebrow {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 4px;
}

.panel-title {
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.15;
    color: var(--text);
    margin-bottom: 6px;
}

.panel-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
}

/* ── FORMULÁRIOS ── */
.form-group {
    margin-bottom: 16px;
}

.label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.label .req {
    color: var(--primary);
}

.label-hint {
    font-weight: 400;
    color: var(--text-hint);
}

.input-field {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--surface);
    outline: none;
    appearance: none;
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(229,57,53,0.1);
}

textarea.input-field {
    resize: vertical;
    min-height: 80px;
}

select.input-field {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6560' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

/* ── INPUT COM PREFIXO ── */
.input-prefix-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.input-prefix-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(229,57,53,0.1);
}

.prefix-icon {
    padding: 0 12px;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-right: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    align-self: stretch;
}

.input-prefix-wrap .input-field {
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* ── TYPE GRID ── */
.type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.type-card:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.type-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.type-icon {
    font-size: 1.8rem;
}

/* ── UPLOAD BOX ── */
.upload-box {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    background: #fafaf9;
    position: relative;
    overflow: hidden;
}

.upload-box:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-box.has-image {
    border-style: solid;
    padding: 0;
}

.upload-box img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: calc(var(--radius) - 2px);
    display: block;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-icon { font-size: 2rem; }
.upload-label { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.upload-hint { font-size: 0.75rem; color: var(--text-hint); }

.remove-img-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.75rem;
    cursor: pointer;
}

/* ── PAYMENT METHODS ── */
.payment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.payment-item {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.payment-item.on {
    border-color: var(--primary);
}

.payment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
}

.payment-icon { font-size: 1.2rem; flex-shrink: 0; width: 26px; text-align: center; }
.payment-info { flex: 1; }
.payment-label { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.payment-sub { font-size: 0.75rem; color: var(--text-secondary); margin-top: 1px; }

/* Toggle switch */
.tog {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.tog input {
    opacity: 0;
    width: 0;
    height: 0;
}

.tog-track {
    position: absolute;
    inset: 0;
    border-radius: 11px;
    background: var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.tog-track::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.tog input:checked + .tog-track {
    background: var(--primary);
}

.tog input:checked + .tog-track::after {
    transform: translateX(18px);
}

/* Bandeiras */
.flags-wrap {
    padding: 0 14px 12px;
    display: none;
}

.payment-item.on .flags-wrap {
    display: block;
}

.flags-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-hint);
    margin-bottom: 8px;
    padding-top: 4px;
    border-top: 1px solid var(--border);
}

.flags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.flag-chip {
    padding: 4px 12px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.flag-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.flag-chip.on {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

/* ── TOGGLE ROW (entrega) ── */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.toggle-row.on {
    border-color: var(--primary);
    background: var(--primary-light);
}

.toggle-row-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.toggle-row-sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ── INFO BOX ── */
.info-box {
    padding: 10px 14px;
    background: #FFF8E1;
    border: 1px solid #FFE082;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: #795548;
    line-height: 1.5;
    margin-bottom: 16px;
}

.loc-status {
    padding: 10px 14px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.loc-status.ok {
    border-color: #4CAF50;
    background: #F1F8E9;
    color: #2E7D32;
}

.btn-geo {
    width: 100%;
    padding: 11px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 8px;
    text-align: left;
}

.btn-geo:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.frete-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

/* ── CORES / APARÊNCIA ── */
.cores-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
}

.color-picker-wrap input[type="color"] {
    width: 28px;
    height: 28px;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 4px;
    background: none;
}

.color-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: monospace;
}

.color-preview-box {
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.preview-btn {
    padding: 10px 20px;
    border-radius: 6px;
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    background: var(--primary);
    font-family: var(--font-body);
}

.preview-badge {
    padding: 5px 12px;
    border-radius: 20px;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    background: var(--secondary);
    font-family: var(--font-body);
}

.preview-font {
    font-size: 1.1rem;
    color: var(--text);
}

/* ── SUCESSO ── */
.success-wrap {
    text-align: center;
    padding: 32px 0;
}

.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 20px;
}

.success-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.success-name {
    font-size: 1.05rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 6px;
}

.success-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 320px;
    margin: 0 auto;
}

.success-logo {
    width: 72px;
    height: 72px;
    border-radius: var(--radius);
    object-fit: cover;
    border: 3px solid var(--primary-light);
    margin-bottom: 16px;
    display: none;
}

/* ── AÇÕES ── */
.actions {
    padding: 16px 24px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.btn-primary {
    flex: 1;
    padding: 14px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}

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

.btn-outline {
    padding: 14px 20px;
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-outline:hover {
    border-color: #ccc7c0;
    color: var(--text);
}

/* ── RESPONSIVO ── */
@media (max-width: 480px) {
    .app { max-width: 100%; }
    .type-grid { grid-template-columns: repeat(3, 1fr); }
    .cores-grid, .frete-grid { grid-template-columns: 1fr 1fr; }
}