/* main.css - Mobile First Base */

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-size: 16px; /* Base 16px para boa leitura mobile */
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

/* Utilitários Visibilidade */
.hidden { display: none !important; }
.view-active { display: block; }

/* Tipografia */
h1 { font-size: 24px; font-weight: 700; color: var(--text-primary); }
h2 { font-size: 20px; font-weight: 600; color: var(--text-primary); }
h3 { font-size: 18px; font-weight: 600; color: var(--text-primary); }
p { font-size: 16px; color: var(--text-secondary); }

/* Utilitários de Texto */
.text-red { color: var(--color-danger); }
.text-green { color: var(--color-success); }
.text-yellow { color: var(--color-warning); }
.text-blue { color: var(--color-info); }
.text-gray { color: var(--text-secondary); }
.font-bold { font-weight: bold; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }

/* Views Base */
.view {
    min-height: 100vh;
    width: 100%;
}

/* Inputs e Forms */
.form-group {
    margin-bottom: 16px;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

input, select, textarea {
    width: 100%;
    min-height: 52px; /* Regra inegociável */
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px; /* Regra inegociável mobile */
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    transition: all var(--transition-fast);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--color-primary);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--color-primary-hover);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-danger {
    background-color: var(--color-danger);
    color: #fff;
}

.btn-success {
    background-color: var(--color-success);
    color: #fff;
}

.w-full { width: 100%; }

/* Ícones avulsos (botão sem texto, ex: back, notif) */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    background: transparent;
    position: relative;
}
.btn-icon:hover, .btn-icon:active {
    background-color: var(--bg-surface-hover);
}

/* Badges */
.badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: var(--color-danger);
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.badge-status {
    position: static;
    display: inline-flex;
    padding: 4px 8px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}
.badge-status.success { background-color: var(--color-success-light); color: var(--color-success); }
.badge-status.danger { background-color: var(--color-danger-light); color: var(--color-danger); }
.badge-status.warning { background-color: var(--color-warning-light); color: var(--color-warning); }
.badge-status.info { background-color: var(--color-info-light); color: var(--color-info); }

/* Login View */
.login-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
    max-width: 400px;
    margin: 0 auto;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header .logo-icon {
    width: 64px;
    height: 64px;
    color: var(--color-primary);
    margin-bottom: 16px;
}

/* Vendedor View (Mobile) */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.user-greeting {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background-color: var(--color-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}

.greeting {
    font-weight: 600;
    font-size: 18px;
}

.quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 16px 20px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}

.stat-box {
    display: flex;
    flex-direction: column;
    padding: 12px 8px;
    border-radius: var(--radius-md);
    background-color: var(--bg-base);
    align-items: center;
    text-align: center;
}

.stat-alert {
    background-color: var(--color-danger-light);
}

.stat-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.stat-value {
    font-size: 14px;
    font-weight: 700;
}

.app-content {
    padding: 16px 20px;
    padding-bottom: 90px; /* Espaço pro bottom nav */
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: var(--nav-bg);
    border-top: 1px solid var(--nav-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 50;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--nav-icon);
    font-size: 11px;
    font-weight: 500;
    min-height: 50px;
    padding: 4px 12px;
}

.nav-item i {
    width: 24px;
    height: 24px;
}

.nav-item.active {
    color: var(--color-primary);
}

.nav-fab {
    position: relative;
    top: -15px;
}

.fab-inner {
    width: 50px;
    height: 50px;
    background-color: var(--color-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 4px;
    box-shadow: var(--shadow-md);
}

.fab-inner i {
    width: 24px;
    height: 24px;
}

/* Loader / Spinner */
.global-loader {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.spinner {
    width: 40px; height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Cards Genéricos */
.card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 80px; /* Acima da navbar */
    left: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    padding: 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUp 0.3s ease forwards;
    border-left: 4px solid transparent;
}
.toast.success { border-left-color: var(--color-success); }
.toast.error { border-left-color: var(--color-danger); }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
