/* ==========================================================================
   PAINEL ADMINISTRATIVO - BASE, TOPBAR, TABS & MODAIS (adminBase.css)
   ========================================================================== */
/* 1. CONTAINER PRINCIPAL (Mobile Default) */
.admin-app {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0.65rem 0.5rem;
    box-sizing: border-box;
    min-height: 85vh;
    overflow-x: hidden;
}


/* 3. DASHBOARD CONTAINER PRINCIPAL */
.admin-dashboard-screen {
    background-color: #ffffff;
    border-radius: 18px;
    padding: 1rem 0.75rem;
    box-shadow: var(--shadow-md);
    border: 1.5px solid var(--color-border);
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Cabeçalho do Painel */
.admin-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.15rem;
    padding-bottom: 0.85rem;
    border-bottom: 1.5px solid var(--color-border);
    flex-wrap: wrap;
}

.admin-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-header-title h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--color-primary-dark);
    margin: 0;
}

.admin-status-pill {
    font-size: 0.7rem;
    font-weight: 700;
    color: #16a34a;
    background: #dcfce7;
    padding: 0.18rem 0.5rem;
    border-radius: 20px;
    display: inline-block;
    white-space: nowrap;
}

.admin-user-pill {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: #f8fafc;
    border: 1px solid var(--color-border);
    padding: 0.25rem 0.6rem;
    border-radius: 30px;
}

.admin-user-avatar {
    font-size: 0.9rem;
}

.admin-user-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-text-primary);
    white-space: nowrap;
}

.btn-logout-pill {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    padding: 0.2rem 0.55rem;
    border-radius: 14px;
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-logout-pill:hover {
    background: #fca5a5;
}

/* 4. NAVEGAÇÃO EM ABAS DO PAINEL */
.admin-tab-nav {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 1.15rem;
    padding-bottom: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--color-border);
    width: 100%;
}

.admin-tab-nav::-webkit-scrollbar {
    display: none;
}

.admin-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    padding: 0.38rem 0.65rem;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--color-border);
    background: #f8fafc;
    color: var(--color-text-secondary);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .admin-tab-btn {
        padding: 0.45rem 0.8rem;
        font-size: 0.82rem;
        gap: 0.35rem;
    }
}

.admin-tab-btn:hover {
    background: #f1f5f9;
    color: var(--color-text-primary);
}

.admin-tab-btn.active {
    background: var(--color-primary-gradient);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(234, 88, 12, 0.3);
}

.admin-tab-badge {
    background: #ef4444;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 15px;
    text-align: center;
}

.admin-tab-pane {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}


/* ==========================================================================
   ELEMENTOS DE FORMULÁRIO UNIVERSAIS (ADMIN)
   ========================================================================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.95rem;
    width: 100%;
}

.form-group label,
.admin-sheet-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    margin-bottom: 0.2rem;
}

.form-control {
    width: 100%;
    height: 40px;
    padding: 0 0.85rem;
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--color-text-primary);
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 1rem;
    padding-right: 2.2rem;
}

textarea.form-control {
    height: auto;
    min-height: 80px;
    padding: 0.65rem 0.85rem;
    resize: vertical;
    line-height: 1.45;
}

/* Prefixo de Moeda (R$) */
.input-prefix-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-prefix {
    position: absolute;
    left: 0.85rem;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--color-text-secondary);
    pointer-events: none;
}

.form-control.with-prefix {
    padding-left: 2.3rem;
}

/* ==========================================================================
   MODAIS MOBILE-FIRST (BOTTOM SHEETS & DIALOGS)
   ========================================================================== */
.admin-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: none;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-sizing: border-box;
}

.admin-modal-backdrop.active {
    display: flex;
    opacity: 1;
}

.admin-modal-sheet {
    background: #ffffff;
    width: 100%;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    padding: 1.35rem 1.15rem;
    box-sizing: border-box;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
}

.admin-modal-backdrop.active .admin-modal-sheet {
    transform: translateY(0);
}

.admin-modal-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.15rem;
    border-bottom: 1.5px solid var(--color-border);
    padding-bottom: 0.75rem;
}

.admin-modal-sheet-header h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--color-primary-dark);
    margin: 0;
}

.admin-modal-subtitle {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    margin: 0.2rem 0 0 0;
}

.btn-sheet-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    transition: all var(--transition-fast);
    line-height: 1;
}

.btn-sheet-close:hover {
    background: #fee2e2;
    color: var(--color-danger);
}

.admin-sheet-form {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.admin-sheet-actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 1.25rem;
    width: 100%;
}

.btn-sheet-submit {
    width: 100%;
    height: 42px;
    background: var(--color-primary-gradient);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.25);
    transition: all 0.2s ease;
}

.btn-sheet-submit:hover {
    background: var(--color-primary-gradient-hover);
    transform: translateY(-1px);
}

.btn-sheet-cancel {
    width: 100%;
    height: 42px;
    background: #f1f5f9;
    color: var(--color-text-secondary);
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sheet-cancel:hover {
    background: #e2e8f0;
    color: var(--color-text-primary);
}

/* Modal de Exclusão */
.admin-delete-sheet {
    background: #ffffff;
    width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 1.75rem 1.25rem;
    box-sizing: border-box;
    text-align: center;
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-modal-backdrop.active .admin-delete-sheet {
    transform: translateY(0);
}

.delete-icon-wrap {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.admin-delete-sheet h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--color-primary-dark);
    margin-bottom: 0.35rem;
}

.admin-delete-sheet p {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    line-height: 1.4;
    margin-bottom: 1.25rem;
}

.admin-delete-actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.btn-confirm-del {
    width: 100%;
    height: 42px;
    background: #dc2626;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-confirm-del:hover {
    background: #b91c1c;
}

.btn-cancel-del {
    width: 100%;
    height: 42px;
    background: #f1f5f9;
    color: var(--color-text-secondary);
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-cancel-del:hover {
    background: #e2e8f0;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 1rem;
    left: 0.75rem;
    right: 0.75rem;
    z-index: 99999;
    display: flex;

    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast-message {
    background: #0f172a;
    color: #ffffff;
    padding: 0.85rem 1.15rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    font-size: 0.88rem;
    font-weight: 600;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast-message.success {
    border-left: 4px solid #22c55e;
}

.toast-message.error {
    border-left: 4px solid #ef4444;
}


/* ==========================================================================
   ESCALABILIDADE RESPONSIVA (TABLET & DESKTOP)
   ========================================================================== */

/* Tablets (>= 680px) */
@media (min-width: 680px) {
    .admin-app {
        max-width: 760px;
        padding: 1.5rem;
    }

    .admin-dashboard-screen {
        padding: 2rem 1.75rem;
        border-radius: 24px;
    }

    .admin-stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .analytics-kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .analytics-details-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .orders-toolbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .orders-search-wrap {
        max-width: 180px;
    }

    .orders-feed-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .admin-actions-bar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .btn-create-product {
        width: auto;
        padding: 0 1.5rem;
    }

    .admin-search-box {
        max-width: 340px;
    }

    .admin-products-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .admin-modal-backdrop {
        align-items: center;
        padding: 1.5rem;
    }

    .admin-modal-sheet {
        max-width: 620px;
        border-radius: 20px;
    }

    .admin-delete-sheet {
        max-width: 400px;
        border-radius: 20px;
    }

    .form-row-responsive {
        flex-direction: row;
    }

    .form-row-responsive .form-group {
        flex: 1;
    }

    .admin-sheet-actions {
        flex-direction: row-reverse;
    }

    .admin-delete-actions {
        flex-direction: row-reverse;
    }

    .toast-container {
        left: auto;
        right: 1.5rem;
        bottom: 1.5rem;
        max-width: 360px;
    }
}

/* Desktop (>= 1024px) */
@media (min-width: 1024px) {
    .admin-app {
        max-width: 1140px;
        padding: 2.25rem 2rem;
    }

    .admin-dashboard-screen {
        padding: 2.5rem 2.25rem;
    }

    .admin-products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }

    .orders-feed-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }

    .admin-header-title h2 {
        font-size: 1.65rem;
    }
}
