/* CSS Variables for Sleek Premium Dark Theme (Neutral Grays) */
:root {
  --primary-color: #52525b;
  /* Zinc 600 - Neutral elegant accent */
  --primary-hover: #3f3f46;
  /* Zinc 700 */
  --bg-color: #18181b;
  /* Zinc 900 - Deep grey background */
  --card-bg: rgba(39, 39, 42, 0.7);
  /* Zinc 800 with transparency for glass */
  --text-primary: #f4f4f5;
  /* Zinc 50 - Off-white for less strain */
  --text-secondary: #a1a1aa;
  /* Zinc 400 - Muted elegant text */
  --border-color: rgba(255, 255, 255, 0.08);
  /* Extremely subtle border */
  --glass-blur: blur(16px);
  /* Strong blur for modern macOS look */
  --error-color: #f43f5e;
  /* Rose 500 */
  --radius-subtle: 8px;
  /* Smooth modern curves */
}

/* Base Reset & Typography */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography Utility */
h1,
h2,
h3 {
  font-weight: 600;
  letter-spacing: -0.025em;
}

p {
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Glassmorphism Classes */
.glass-panel {
  background: var(--card-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-subtle);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

/* ==========================================
   LOGIN PAGE SPECIFIC
   ========================================== */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h1 {
  font-size: 1.875rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  background: rgba(24, 24, 27, 0.6);
  /* Translucent Zinc 900 */
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-subtle);
  font-size: 1rem;
  transition: all 0.2s ease;
  outline: none;
}

/* Solução para o fundo Azul/Amarelo de Autofill do Chrome/Edge adaptado pro Dark Mode Gray */
.form-control:-webkit-autofill,
.form-control:-webkit-autofill:hover,
.form-control:-webkit-autofill:focus,
.form-control:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px #18181b inset !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  transition: background-color 5000s ease-in-out 0s;
}

.form-control:focus {
  border-color: rgba(82, 82, 91, 0.5);
  /* Zinc 600 glow */
  box-shadow: 0 0 0 3px rgba(82, 82, 91, 0.15);
  /* Soft outer glow */
}

.btn-primary {
  width: 100%;
  background: var(--primary-color);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius-subtle);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ==========================================
   DASHBOARD PAGE SPECIFIC
   ========================================== */
.dashboard-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(24, 24, 27, 0.8);
  /* Zinc 900 Glass */
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  position: sticky;
  top: 0;
  z-index: 50;
}

.navbar-brand {
  font-weight: 600;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-logout {
  background: var(--card-bg);
  /* Contrast solid background */
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.2);
}

.main-content {
  flex: 1;
  padding: 3rem 2rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 2.5rem;
}

/* App Grid */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1.25rem;
}

.app-card {
  padding: 1rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  aspect-ratio: 1 / 1;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.app-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
  z-index: 1;
}

.app-card:hover {
  transform: translateY(-5px);
  border-color: rgba(161, 161, 170, 0.3);
  box-shadow: 0 20px 30px -5px rgba(0, 0, 0, 0.3), 0 0 20px rgba(161, 161, 170, 0.12);
}

.app-icon {
  font-size: 3rem;
  background: transparent;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-subtle);
  z-index: 2;
  margin-bottom: 0.5rem;
}

/* Para quando o usuário adicionar as imagens na pasta de ícones */
.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.app-info {
  z-index: 2;
  width: 100%;
}

.app-info h3 {
  font-size: 1rem;
  font-weight: 500;
  margin: 0;
  color: var(--text-primary);
  word-wrap: break-word;
}

/* ==========================================
   VIEWER PAGE SPECIFIC (GUACAMOLE)
   ========================================== */
.viewer-layout {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: #000;
  display: flex;
  flex-direction: column;
}

.viewer-toolbar {
  height: 54px;
  background: rgba(24, 24, 27, 0.95);
  /* Zinc 900 */
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  z-index: 100;
}

.viewer-toolbar-title {
  font-weight: 500;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#display {
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  /* Remove as barras de rolagem que aparecem ao perder o foco */
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #000;
  /* Importante para o Canvas do Guacamole */
  cursor: none;
  /* Deixa o cursor ser gerenciado pelo RDP */
}

/* Loading e Erros */
.alert {
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  display: none;
}

.alert-error {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--error-color);
  color: #fca5a5;
  display: block;
}

.loader {
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}

.hidden {
  display: none !important;
}

/* Animações */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}