/* PWA Styles - Escola Log */

/* Força tema claro independente das configurações do navegador */
:root {
  color-scheme: light only;
}

html {
  color-scheme: light only;
}

body {
  color-scheme: light only;
}

/* Reset e base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  color-scheme: light only;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333 !important;
  background-color: #f8fafc !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Força elementos específicos a manter tema claro */
input, textarea, select, button {
  color-scheme: light only !important;
}

/* Exceção para botões de cookies - garantir visibilidade */
#cookieBanner button {
  color: white !important;
  font-weight: 500 !important;
}

#cookieBanner button[onclick="acceptCookies()"] {
  background: hsl(var(--brand-blue)) !important;
  color: white !important;
  font-weight: 600 !important;
}

#cookieBanner button[onclick="showPrivacyModal()"] {
  background: transparent !important;
  border: 1px solid white !important;
  color: white !important;
}

/* Previne inversão de cores em elementos de formulário */
input[type="text"], 
input[type="email"], 
input[type="password"], 
input[type="number"], 
input[type="tel"], 
input[type="url"], 
input[type="search"], 
textarea, 
select {
  background-color: white !important;
  color: #333 !important;
  border: 1px solid #d1d5db !important;
}

/* Força cor de fundo e texto para elementos comuns */
div, span, p, h1, h2, h3, h4, h5, h6, a, li, td, th {
  color-scheme: light only;
}

/* PWA Safe Area */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
    padding-top: max(0px, env(safe-area-inset-top));
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
}


/* PWA Install Banner */
.install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #3b82f6;
  color: white;
  padding: 1rem;
  display: none;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.install-banner.show {
  display: flex;
}

.install-banner-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.install-banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.install-banner-text {
  flex: 1;
}

.install-banner-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.install-banner-description {
  font-size: 0.875rem;
  opacity: 0.9;
}

.install-banner-actions {
  display: flex;
  gap: 0.5rem;
}

.install-btn {
  background: white;
  color: #3b82f6;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.install-btn:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
}

.install-dismiss {
  /* Tornar visível em fundo claro e escuro */
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #cbd5e1;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.install-dismiss:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* Offline Indicator */
.offline-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #ef4444;
  color: white;
  padding: 0.75rem;
  text-align: center;
  font-weight: 600;
  z-index: 1001;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.offline-indicator.show {
  transform: translateY(0);
}

/* PWA Status Bar */
.pwa-status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top, 0px);
  background: #3b82f6;
  z-index: 1002;
}

/* App Container */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Loading States */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

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

/* Animations */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


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

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

/* Responsive Design */
@media (max-width: 768px) {
  .install-banner {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .install-banner-actions {
    width: 100%;
    justify-content: center;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #0f172a;
    color: #f1f5f9;
  }
  
  .splash-screen {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .splash-screen {
    background: #000;
  }
  
  .install-banner {
    background: #000;
    border-top: 2px solid #fff;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print Styles */
@media print {
  .install-banner,
  .offline-indicator,
  .pwa-status-bar {
    display: none !important;
  }
}

/* Standard Profile Icon */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.user-avatar:hover {
    transform: scale(1.05);
}

/* For larger profile views */
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    font-weight: 600;
    margin-right: 20px;
}
