/* AWG Vendas - Mobile PWA Styles */

/* Reset e Base */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(180deg, #0D1B2A 0%, #1B2838 100%);
  color: #E5E7EB;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Esconde scrollbar mas permite scroll */
::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* PWA Status Bar */
.pwa-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, #0D1B2A 0%, rgba(13, 27, 42, 0.95) 100%);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.pwa-logo {
  font-size: 20px;
  font-weight: 800;
  color: #FFD700;
}

.pwa-logo span {
  font-weight: 400;
  color: #9CA3AF;
  font-size: 14px;
}

.pwa-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #9CA3AF;
  font-size: 14px;
}

/* Container principal */
.mobile-container {
  padding: 16px;
  padding-bottom: 80px; /* Espaço para nav bottom */
  max-width: 100%;
  overflow-x: hidden;
}

/* Cards */
.mobile-card {
  background: rgba(27, 40, 56, 0.8);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.mobile-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #9CA3AF;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* KPIs Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.kpi-item {
  background: rgba(27, 40, 56, 0.6);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.kpi-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.kpi-value.green { color: #10B981; }
.kpi-value.cyan { color: #00D4FF; }
.kpi-value.gold { color: #FFD700; }
.kpi-value.purple { color: #A855F7; }

.kpi-label {
  font-size: 11px;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-sublabel {
  font-size: 10px;
  color: #4B5563;
  margin-top: 2px;
}

/* Barra de progresso */
.progress-container {
  margin-top: 16px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10B981, #00D4FF);
  border-radius: 5px;
  transition: width 0.5s ease;
}

.progress-bar-fill.gold {
  background: linear-gradient(90deg, #10B981, #FFD700);
}

/* Atividades */
.activities-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.activity-item {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 12px 8px;
  text-align: center;
}

.activity-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.activity-value {
  font-size: 18px;
  font-weight: 700;
  color: #E5E7EB;
}

.activity-label {
  font-size: 9px;
  color: #6B7280;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Alertas */
.alert-item {
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid #EF4444;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

.alert-item.warning {
  background: rgba(245, 158, 11, 0.1);
  border-left-color: #F59E0B;
}

.alert-item.info {
  background: rgba(0, 212, 255, 0.1);
  border-left-color: #00D4FF;
}

.alert-title {
  font-size: 14px;
  font-weight: 600;
  color: #E5E7EB;
  margin-bottom: 4px;
}

.alert-desc {
  font-size: 12px;
  color: #9CA3AF;
}

/* Pipeline */
.pipeline-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.pipeline-info {
  flex: 1;
}

.pipeline-etapa {
  font-size: 14px;
  font-weight: 500;
  color: #E5E7EB;
}

.pipeline-qtd {
  font-size: 12px;
  color: #6B7280;
}

.pipeline-valor {
  font-size: 16px;
  font-weight: 700;
  color: #00D4FF;
}

/* Ranking */
.ranking-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.ranking-item.highlight {
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.3);
}

.ranking-position {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  margin-right: 12px;
}

.ranking-position.gold { background: rgba(255, 215, 0, 0.2); color: #FFD700; }
.ranking-position.silver { background: rgba(192, 192, 192, 0.2); color: #C0C0C0; }
.ranking-position.bronze { background: rgba(205, 127, 50, 0.2); color: #CD7F32; }
.ranking-position.default { background: rgba(255, 255, 255, 0.1); color: #6B7280; }

.ranking-info {
  flex: 1;
}

.ranking-name {
  font-size: 14px;
  font-weight: 600;
  color: #E5E7EB;
}

.ranking-vendas {
  font-size: 11px;
  color: #6B7280;
}

.ranking-valor {
  font-size: 15px;
  font-weight: 700;
  color: #10B981;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(13, 27, 42, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  backdrop-filter: blur(10px);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px;
  border-radius: 12px;
  color: #6B7280;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  background: none;
}

.nav-item.active {
  color: #00D4FF;
  background: rgba(0, 212, 255, 0.1);
}

.nav-icon {
  font-size: 22px;
  margin-bottom: 4px;
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
}

/* Filtro de período */
.period-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  font-size: 13px;
  color: #9CA3AF;
}

.period-filter select {
  background: transparent;
  border: none;
  color: #E5E7EB;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.period-filter select option {
  background: #1B2838;
  color: #E5E7EB;
}

/* Login */
.login-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.login-logo {
  font-size: 32px;
  font-weight: 800;
  color: #FFD700;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 14px;
  color: #6B7280;
  margin-bottom: 40px;
}

.login-form {
  width: 100%;
  max-width: 320px;
}

.login-input {
  width: 100%;
  padding: 16px;
  margin-bottom: 16px;
  background: rgba(27, 40, 56, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #E5E7EB;
  font-size: 16px;
  outline: none;
}

.login-input:focus {
  border-color: #00D4FF;
}

.login-input::placeholder {
  color: #6B7280;
}

.login-button {
  width: 100%;
  padding: 16px;
  background: linear-gradient(90deg, #00D4FF, #10B981);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.login-button:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.login-error {
  color: #EF4444;
  font-size: 14px;
  text-align: center;
  margin-top: 16px;
}

/* Equipamento Form */
.equip-form {
  padding: 16px;
}

.equip-input {
  width: 100%;
  padding: 14px;
  margin-bottom: 12px;
  background: rgba(27, 40, 56, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #E5E7EB;
  font-size: 15px;
  outline: none;
}

.equip-input:focus {
  border-color: #00D4FF;
}

.equip-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(90deg, #10B981, #00D4FF);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.equip-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  margin-top: 8px;
}

/* Gráfico mini */
.chart-container {
  height: 160px;
  margin-top: 12px;
}

/* Loader */
.loader {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.loader-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 212, 255, 0.2);
  border-top-color: #00D4FF;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 80px;
  left: 16px;
  right: 16px;
  background: #1B2838;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 200;
  animation: slideUp 0.3s ease;
}

.toast.success {
  border-left: 3px solid #10B981;
}

.toast.error {
  border-left: 3px solid #EF4444;
}

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

/* Pull to refresh indicator */
.pull-indicator {
  text-align: center;
  padding: 16px;
  color: #6B7280;
  font-size: 13px;
}

/* Offline indicator */
.offline-banner {
  background: rgba(239, 68, 68, 0.9);
  color: white;
  text-align: center;
  padding: 8px;
  font-size: 12px;
  font-weight: 500;
}

/* Histórico gráfico */
.history-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 140px;
  padding: 8px 0;
  gap: 2px;
  overflow-x: auto;
  padding-bottom: 30px;
}

.history-bar-item {
  flex: 1;
  min-width: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.history-bar-fill {
  width: 100%;
  max-width: 22px;
  min-height: 4px;
  background: linear-gradient(180deg, #00D4FF 0%, #10B981 100%);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
}

.history-bar-label {
  font-size: 8px;
  color: #6B7280;
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
}

.history-bar-value {
  font-size: 8px;
  color: #9CA3AF;
  margin-bottom: 4px;
  white-space: nowrap;
}
