/* ==========================================================================
   DESKTOP MODE: LOGIN OS-STYLE
   Impecável recriação de Janela nativa (macOS Like) com Liquid Glass
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. GLOBAL ALIGNMENT
   -------------------------------------------------------------------------- */
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--desk-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #0b0e1a; /* fallback */
}

[data-theme="light"] body {
  background-color: #e8f0fa; /* fallback */
}

/* Three.js Background canvas override */
#organic-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

/* --------------------------------------------------------------------------
   2. MACOS WINDOW CONTAINER
   -------------------------------------------------------------------------- */
.macos-window-login {
  position: relative;
  z-index: 10;
  width: 900px;
  max-width: 95vw;
  height: 600px;
  max-height: 90vh;
  margin: 0 auto;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  
  /* Liquid Glass OS Core */
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.8);
  
  /* Initial Entry Animation */
  opacity: 0;
  transform: scale(0.96) translateY(20px);
  animation: window-open 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

[data-theme="dark"] .macos-window-login {
  background: rgba(30, 30, 32, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

@keyframes window-open {
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* --------------------------------------------------------------------------
   3. MACOS TITLE BAR (TRAFFIC LIGHTS)
   -------------------------------------------------------------------------- */
.macos-titlebar {
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  user-select: none;
}

[data-theme="dark"] .macos-titlebar {
  background: rgba(30, 30, 30, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.traffic-lights {
  display: flex;
  gap: 8px;
}

.traffic-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
  transition: filter 0.2s;
}

.macos-titlebar:hover .traffic-dot {
  filter: brightness(1.1);
}

.traffic-dot.close { background-color: #FF5F56; }
.traffic-dot.minimize { background-color: #FFBD2E; }
.traffic-dot.maximize { background-color: #27C93F; }

/* --------------------------------------------------------------------------
   4. WINDOW CONTENT SPLIT (BRAND vs FORM)
   -------------------------------------------------------------------------- */
.macos-window-content {
  display: flex;
  flex: 1;
  height: calc(100% - 48px);
}

/* Left Panel: Branding */
.login-brand-panel {
  flex: 1.1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  color: #1d1d1f;
  position: relative;
}

[data-theme="dark"] .login-brand-panel {
  color: #f5f5f7;
}

.login-brand-panel h1 {
  font-family: var(--font-heading, "Instrument Serif", Georgia, serif);
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
  font-weight: 400;
}

.login-brand-panel .tagline {
  font-size: 1.1rem;
  opacity: 0.8;
  margin-bottom: 2rem;
  line-height: 1.4;
}

.brand-features-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.brand-features-list li {
  padding: 8px 0;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0.85;
}

.brand-features-list li i {
  color: var(--accent, #007AFF);
  font-size: 14px;
}

/* Right Panel: The Form */
.login-form-panel {
  flex: 0.9;
  padding: 40px 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(255, 255, 255, 0.4);
  border-left: 1px solid rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .login-form-panel {
  background: rgba(0, 0, 0, 0.25);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.login-form-panel h2 {
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
  color: #1d1d1f;
  font-weight: 600;
}

[data-theme="dark"] .login-form-panel h2 {
  color: #fff;
}

.login-form-panel .subtitle {
  color: #555;
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

[data-theme="dark"] .login-form-panel .subtitle {
  color: #aaa;
}

/* --------------------------------------------------------------------------
   5. NATIVE-FEELING UI CONTROLS
   -------------------------------------------------------------------------- */
.os-input-group {
  margin-bottom: 20px;
}

.os-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: #444;
}

[data-theme="dark"] .os-label {
  color: #ccc;
}

.os-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.95rem;
  color: #1d1d1f;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

[data-theme="dark"] .os-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.os-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.8);
  border-color: var(--accent, #007AFF);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

[data-theme="dark"] .os-input:focus {
  background: rgba(30, 30, 30, 0.6);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.25);
}

.os-btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: var(--accent, #007AFF);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3), inset 0 1px 1px rgba(255,255,255,0.25);
  margin-top: 8px;
}

.os-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 122, 255, 0.4), inset 0 1px 1px rgba(255,255,255,0.3);
  background: linear-gradient(180deg, var(--accent, #007AFF) 0%, rgba(0, 110, 230, 1) 100%);
}

.os-btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 122, 255, 0.3);
}

.login-links {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-links a {
  color: #666;
  text-decoration: none;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.login-links a:hover {
  color: var(--accent, #007AFF);
}

[data-theme="dark"] .login-links a {
  color: #aaa;
}

.login-links i {
  margin-right: 8px;
  opacity: 0.7;
}

/* Language selection */
.lang-switch {
  position: absolute;
  bottom: 40px;
  left: 40px;
  display: flex;
  gap: 12px;
}

.lang-switch a {
  opacity: 0.5;
  text-decoration: none;
  font-size: 1.2rem;
  transition: opacity 0.2s, transform 0.2s;
}

.lang-switch a:hover,
.lang-switch a.active {
  opacity: 1;
  transform: scale(1.1);
}

/* Responsive constraints */
@media (max-width: 900px) {
  .macos-window-login {
    height: auto;
    min-height: 80vh;
  }
  .macos-window-content {
    flex-direction: column;
  }
  .login-brand-panel {
    flex: none;
    padding: 30px;
  }
  .login-brand-panel h1 { font-size: 2rem; }
  .login-form-panel {
    flex: none;
    padding: 30px;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
  }
  
  .lang-switch {
    position: relative;
    bottom: auto; left: auto;
    margin-top: 20px;
  }
}
