/* ============================================
   Sistema de Vendas - Larissa Doces
   CSS Customizado (complementa Bootstrap 5)
   ============================================ */

:root {
    --pink: #d63384;
    --pink-light: #f8d7e9;
    --pink-dark: #ab296a;
    --bg: #fdf2f8;
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --bottom-nav-height: 68px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding-bottom: calc(var(--bottom-nav-height) + 16px);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---- Header ---- */
.app-header {
    background: linear-gradient(135deg, var(--pink), var(--pink-dark));
    color: white;
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(214, 51, 132, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.app-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    text-align: center;
}

.btn-config {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-config:active {
    background: rgba(255, 255, 255, 0.35);
}

.btn-logout {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-logout:active {
    background: rgba(255, 255, 255, 0.35);
}

/* ---- Tela de Login ---- */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fdf2f8, #fce7f3, #f8d7e9);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 24px;
    box-shadow: 0 8px 40px rgba(214, 51, 132, 0.15);
    padding: 40px 28px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-logo {
    font-size: 4rem;
    margin-bottom: 8px;
}

.login-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--pink);
    margin-bottom: 4px;
}

.login-subtitle {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.login-card .form-label {
    text-align: left;
    display: block;
}

.login-card .form-control-lg {
    border-radius: 12px;
}

/* ---- Main Content ---- */
.app-content {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

/* ---- Bottom Navigation ---- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #ffffff, #f8f8f8);
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: var(--bottom-nav-height);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 100;
    padding: 0 4px 6px 4px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    color: #b0b0b0;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    text-transform: uppercase;
}

.nav-emoji {
    font-size: 1.5rem;
    line-height: 1;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 34px;
    border-radius: 12px;
    background: transparent;
    filter: grayscale(80%) opacity(0.5);
}

.nav-item:active .nav-emoji {
    transform: scale(0.85);
}

.nav-item.active {
    color: #555;
}

.nav-item.active .nav-emoji {
    filter: none;
    transform: translateY(-3px) scale(1.15);
    background: rgba(0, 0, 0, 0.04);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.nav-item.active span {
    font-weight: 700;
    color: #444;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: linear-gradient(90deg, var(--pink), var(--pink-dark));
    border-radius: 0 0 6px 6px;
    box-shadow: 0 2px 6px rgba(214, 51, 132, 0.25);
}

/* ---- Cards ---- */
.card-custom {
    background: white;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 16px;
    margin-bottom: 12px;
    border: none;
}

.card-stat {
    text-align: center;
    padding: 20px 16px;
}

.card-stat .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--pink);
}

.card-stat .stat-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* ---- Botões ---- */
.btn-pink {
    background: var(--pink);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    padding: 12px 24px;
}

.btn-pink:hover,
.btn-pink:active {
    background: var(--pink-dark);
    color: white;
}

.btn-outline-pink {
    border: 2px solid var(--pink);
    color: var(--pink);
    background: transparent;
    border-radius: 12px;
    font-weight: 600;
}

.btn-outline-pink:hover {
    background: var(--pink);
    color: white;
}

/* ---- Produto Card (Seleção no Pedido) ---- */
.produto-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border 0.2s;
    border: 2px solid transparent;
}

.produto-card.selecionado {
    border-color: var(--pink);
    background: #fff5f9;
}

.produto-info h6 {
    font-weight: 700;
    margin: 0;
    font-size: 1rem;
}

.produto-info .preco {
    color: var(--pink);
    font-weight: 700;
    font-size: 1.1rem;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-control button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background: white;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.qty-control button:active {
    border-color: var(--pink);
    color: var(--pink);
    transform: scale(0.9);
}

.qty-control .qty-value {
    font-size: 1.3rem;
    font-weight: 800;
    min-width: 30px;
    text-align: center;
}

/* ---- Total Bar ---- */
.total-bar {
    background: white;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 16px 0;
    border: 2px solid var(--pink-light);
}

.total-bar .total-label {
    font-size: 1rem;
    font-weight: 600;
    color: #666;
}

.total-bar .total-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--pink);
}

/* ---- Produto Gerenciamento Card ---- */
.produto-manage-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 4px solid var(--pink);
}

.produto-manage-card.inativo {
    opacity: 0.5;
    border-left-color: #ccc;
}

.produto-manage-info h6 {
    font-weight: 700;
    margin: 0 0 2px 0;
    font-size: 0.95rem;
}

.produto-manage-preco {
    font-weight: 700;
    color: var(--pink);
    font-size: 1.1rem;
}

.produto-manage-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.produto-manage-actions button {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* ---- Cliente Card ---- */
.cliente-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cliente-card .cliente-info h6 {
    font-weight: 700;
    margin: 0 0 4px 0;
}

.cliente-card .cliente-info small {
    color: #888;
}

.cliente-card .cliente-actions {
    display: flex;
    gap: 8px;
}

.cliente-card .cliente-actions button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
}

/* ---- Pedido/Histórico Card ---- */
.pedido-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid #ddd;
}

.pedido-card.status-pendente {
    border-left-color: #ffc107;
}

.pedido-card.status-pago {
    border-left-color: #198754;
}

.pedido-card.status-cancelado {
    border-left-color: #dc3545;
}

.pedido-card .pedido-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
}

.pedido-card .pedido-header h6 {
    font-weight: 700;
    margin: 0;
}

.pedido-card .pedido-itens {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

/* ---- Itens do Pedido (lista organizada) ---- */
.pedido-itens-lista {
    background: #fafafa;
    border-radius: 10px;
    padding: 8px 12px;
    margin: 10px 0;
}

.pedido-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid #f0f0f0;
}

.pedido-item-row:last-child {
    border-bottom: none;
}

.pedido-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pedido-item-qty {
    background: var(--pink-light);
    color: var(--pink-dark);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 6px;
    min-width: 28px;
    text-align: center;
}

.pedido-item-nome {
    font-weight: 500;
    font-size: 0.9rem;
    color: #444;
}

.pedido-item-unit {
    color: #aaa;
    font-size: 0.75rem;
    font-weight: 400;
}

.pedido-item-valor {
    font-weight: 700;
    font-size: 0.9rem;
    color: #333;
}

.pedido-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    margin-top: 4px;
    border-top: 2px dashed #eee;
}

.pedido-total-valor {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--pink);
}

.pedido-card .pedido-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* ---- Badges ---- */
.badge-pendente {
    background: #fff3cd;
    color: #856404;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pago {
    background: #d1e7dd;
    color: #0f5132;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-cancelado {
    background: #f8d7da;
    color: #842029;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ---- Forms ---- */
.form-control:focus,
.form-select:focus {
    border-color: var(--pink);
    box-shadow: 0 0 0 0.2rem rgba(214, 51, 132, 0.15);
}

.form-control-lg {
    border-radius: 12px;
    padding: 12px 16px;
}

.form-select-lg {
    border-radius: 12px;
    padding: 12px 16px;
}

/* ---- Search ---- */
.search-box {
    position: relative;
    margin-bottom: 16px;
}

.search-box input {
    padding-left: 44px;
    border-radius: 12px;
    background: white;
    border: 1px solid #e0e0e0;
}

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}

/* ---- Filtro Tabs ---- */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-tab {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tab.active {
    background: var(--pink);
    color: white;
    border-color: var(--pink);
}

/* ---- Seção Título ---- */
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: #333;
}

/* ---- Próximos Pagamentos ---- */
.pagamento-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.pagamento-item:last-child {
    border-bottom: none;
}

/* ---- Toast customizado ---- */
.toast.bg-success {
    background: #198754 !important;
}

.toast.bg-danger {
    background: #dc3545 !important;
}

.toast.bg-warning {
    background: #ffc107 !important;
    color: #333 !important;
}

/* ---- Observação Bubble ---- */
.obs-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.obs-bubble {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 10px;
    padding: 10px 14px;
    margin: 8px 0;
    font-size: 0.88rem;
    color: #5d4037;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.obs-bubble i {
    margin-right: 6px;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #aaa;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    display: block;
}

/* ---- Animações ---- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ---- Spinner ---- */
.text-pink {
    color: var(--pink) !important;
}

/* ---- Config Sections ---- */
.config-section {
    background: #f9f9f9;
    border-radius: 14px;
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid #eee;
}

.config-section-header {
    background: #f0f0f0;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
}

.config-section-header i {
    font-size: 1.1rem;
}

.config-section-header .bi-chevron-down.rotated {
    transform: rotate(180deg);
}

.config-section-body {
    padding: 16px;
    background: white;
}

.config-section-body .form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.config-section-body .form-control,
.config-section-body .form-select {
    border-radius: 10px;
    font-size: 0.9rem;
}

/* ---- Modal fullscreen no mobile ---- */
@media (max-width: 576px) {
    /* Apenas Configurações em tela cheia (tem muito conteúdo) */
    #modalConfig .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }

    #modalConfig .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    #modalConfig .modal-body {
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
}

/* ---- Responsivo ---- */
@media (max-width: 380px) {
    .app-content {
        padding: 12px;
    }

    .nav-item span {
        font-size: 0.65rem;
    }

    .produto-card {
        padding: 12px;
    }
}
