/* 
* Kabulei App - Mobile First PWA Styles
* Desenvolvido para conversão web to app nativo
*/

/* ==========================================
   CSS CUSTOM PROPERTIES (VARIÁVEIS)
   ========================================== */
:root {
  /* Cores principais do Kabulei */
  --primary-color: #4285F4;
  --primary-dark: #3367D6;
  --primary-light: #5A9BF8;
  --accent-color: #22C55E;
  --accent-dark: #16A34A;
  
  /* Cores neutras */
  --white: #FFFFFF;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  
  /* Cores de estado */
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;
  --info: #3B82F6;
  
  /* Dimensões para mobile */
  --status-bar-height: 44px; /* iOS */
  --safe-area-top: env(safe-area-inset-top);
  --safe-area-bottom: env(safe-area-inset-bottom);
  --safe-area-left: env(safe-area-inset-left);
  --safe-area-right: env(safe-area-inset-right);
  
  /* Tamanhos de fonte mobile-friendly */
  --fs-xs: 0.75rem;   /* 12px */
  --fs-sm: 0.875rem;  /* 14px */
  --fs-base: 1rem;    /* 16px */
  --fs-lg: 1.125rem;  /* 18px */
  --fs-xl: 1.25rem;   /* 20px */
  --fs-2xl: 1.5rem;   /* 24px */
  --fs-3xl: 1.875rem; /* 30px */
  
  /* Espaçamentos touch-friendly */
  --touch-target: 44px;
  --padding-xs: 0.5rem;
  --padding-sm: 0.75rem;
  --padding-md: 1rem;
  --padding-lg: 1.5rem;
  --padding-xl: 2rem;
  
  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.03);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.03);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.03);
  
  /* Bordas */
  --border-radius: 0.5rem;
  --border-radius-lg: 1rem;
  --border-radius-xl: 1.5rem;
}

/* ==========================================
   RESET E CONFIGURAÇÕES GLOBAIS
   ========================================== */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  /* Previne zoom em inputs no iOS */
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--gray-50);
  color: var(--gray-900);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ==========================================
   STATUS BAR E SAFE AREAS
   ========================================== */
.status-bar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--safe-area-top, var(--status-bar-height));
  background-color: var(--primary-color);
  z-index: 9999;
}

.safe-area-bottom {
  height: var(--safe-area-bottom, 0);
  background-color: var(--white);
}

/* ==========================================
   TELA DE LOGIN
   ========================================== */
.login-body {
  background: var(--gray-50);
  background-image: 
    radial-gradient(circle at 25% 25%, rgba(66, 133, 244, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(34, 197, 94, 0.02) 0%, transparent 50%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--safe-area-top, 0);
  padding-bottom: var(--safe-area-bottom, 0);
}

.login-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: var(--padding-xl) 0;
}

.logo-container {
  margin-bottom: 3rem;
}

.login-logo {
  max-width: 200px;
  max-height: 70px;
  width: auto;
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.login-title {
  font-size: var(--fs-3xl);
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: var(--padding-sm);
  letter-spacing: -0.025em;
}

.login-subtitle {
  font-size: var(--fs-lg);
  color: var(--gray-600);
  font-weight: 400;
}

.login-form {
  background: var(--white);
  border-radius: var(--border-radius-xl);
  padding: 2.5rem;
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 10px 15px -3px rgba(0, 0, 0, 0.05),
    0 0 0 1px rgba(0, 0, 0, 0.05);
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* ==========================================
   FORM CONTROLS MOBILE-FRIENDLY
   ========================================== */
.form-control {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius);
  font-size: var(--fs-base);
  min-height: var(--touch-target);
  transition: all 0.2s ease;
  background-color: var(--gray-50);
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.08);
  background-color: var(--white);
}

.form-control-lg {
  min-height: 56px;
  font-size: var(--fs-base);
  padding: var(--padding-md) var(--padding-lg);
  border-radius: 12px;
}

.form-floating > label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--gray-500);
  padding-left: var(--padding-lg);
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
  color: var(--primary-color);
  font-weight: 600;
}

/* ==========================================
   BOTÕES MOBILE-FRIENDLY
   ========================================== */
.btn {
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  border: none;
}

.btn-lg {
  min-height: var(--touch-target);
  font-size: var(--fs-base);
  padding: var(--padding-md) var(--padding-xl);
  border-radius: 14px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.15);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.25);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(66, 133, 244, 0.2);
}

.btn-primary:disabled {
  background: var(--gray-300);
  transform: none;
  box-shadow: none;
}

/* ==========================================
   ALERTAS E NOTIFICAÇÕES
   ========================================== */
.alert {
  border-radius: var(--border-radius);
  border: none;
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: var(--padding-md);
}

.alert-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

/* ==========================================
   CHECKBOXES E FORM CHECKS
   ========================================== */
.form-check-input {
  width: 20px;
  height: 20px;
  margin-top: 0.125rem;
  border: 2px solid var(--gray-300);
  border-radius: 4px;
}

.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.form-check-label {
  font-size: var(--fs-sm);
  color: var(--gray-700);
  margin-left: var(--padding-xs);
}

/* ==========================================
   BOTTOM NAVIGATION (Para outras telas)
   ========================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: var(--padding-sm) 0;
  padding-bottom: calc(var(--padding-sm) + var(--safe-area-bottom, 0));
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--gray-500);
  transition: color 0.2s ease;
  padding: var(--padding-xs);
  min-height: var(--touch-target);
  justify-content: center;
}

.bottom-nav-item.active {
  color: var(--primary-color);
}

.bottom-nav-item i {
  font-size: 20px;
  margin-bottom: 2px;
}

.bottom-nav-item span {
  font-size: var(--fs-xs);
  font-weight: 500;
}

/* ==========================================
   CARDS E CONTAINERS
   ========================================== */
.card {
  border: none;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  background: var(--white);
}

.card-header {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  padding: var(--padding-lg);
  font-weight: 600;
  color: var(--gray-800);
}

.card-body {
  padding: var(--padding-lg);
}

/* ==========================================
   LOADING STATES
   ========================================== */
.spinner-border-sm {
  width: 1rem;
  height: 1rem;
}

/* ==========================================
   UTILITY CLASSES MOBILE
   ========================================== */
.text-touch-lg {
  font-size: var(--fs-lg) !important;
}

.p-touch {
  padding: var(--padding-md) !important;
}

.m-touch {
  margin: var(--padding-md) !important;
}

.vh-100-safe {
  height: calc(100vh - var(--safe-area-top, 0) - var(--safe-area-bottom, 0));
}

/* ==========================================
   ANIMAÇÕES E TRANSIÇÕES
   ========================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* ==========================================
   RESPONSIVE BREAKPOINTS
   ========================================== */

/* Phones portrait (até 576px) - base styles acima */

/* Phones landscape e tablets portrait (576px+) */
@media (min-width: 576px) {
  .login-form {
    padding: var(--padding-xl) 2.5rem;
  }
  
  .login-logo {
    max-width: 200px;
    max-height: 70px;
  }
}

/* Tablets landscape (768px+) */
@media (min-width: 768px) {
  .login-container {
    padding: var(--padding-xl) 0;
  }
  
  .login-form {
    padding: 3rem;
  }
  
  .bottom-nav-item span {
    font-size: var(--fs-sm);
  }
  
  .bottom-nav-item i {
    font-size: 24px;
  }
}

/* Desktop (992px+) */
@media (min-width: 992px) {
  .login-title {
    font-size: 2.5rem;
  }
  
  .login-subtitle {
    font-size: var(--fs-xl);
  }
}

/* ==========================================
   DARK MODE SUPPORT (Para futuro)
   ========================================== */
@media (prefers-color-scheme: dark) {
  /* Variáveis para modo escuro podem ser adicionadas aqui */
}

/* ==========================================
   PRINT STYLES
   ========================================== */
@media print {
  .bottom-nav,
  .status-bar-overlay {
    display: none !important;
  }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible para acessibilidade */
:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn-primary {
    border: 2px solid var(--primary-dark);
  }
  
  .form-control {
    border-width: 2px;
  }
}