/* ===================== Portal Page Styles - Theme Aware ===================== */

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

body {
  font-family: var(--font-family);
  line-height: 1.6;
  color: hsl(var(--foreground));
}

/* Login Page Styles */
.login-page {
  background: hsl(var(--background));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  position: relative;
}

.login-title {
  position: absolute;
  top: 2rem;
  left: 2rem;
  font-size: 2.5rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  font-family: "Courier New", monospace;
  margin: 0;
}

.login-container {
  background: hsl(var(--card));
  border-radius: 16px;
  box-shadow: 0 4px 20px hsl(var(--border) / 0.3);
  max-width: 1200px;
  width: 100%;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
}

.login-header {
  padding: 2rem;
  background: hsl(var(--background));
  border-bottom: 1px solid hsl(var(--border));
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.login-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  font-family: "Courier New", monospace;
}

.login-header .login-logo {
  height: 3rem;
  width: auto;
}

.login-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 2rem;
  padding: 3rem;
  background: hsl(var(--card));
}

.welcome-section {
  grid-column: 1 / -1;
}

.welcome-section h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: hsl(var(--foreground));
}

.welcome-section p {
  font-size: 1.1rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.8;
}

.login-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  background: hsl(var(--muted) / 0.3);
  border-radius: var(--radius);
}

.visual-placeholder {
  width: 100%;
  max-width: 500px;
}

.plant-visual {
  width: 100%;
  height: auto;
}

.plant-visual-image {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px hsl(var(--border) / 0.5);
  object-fit: cover;
}

.login-actions {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  justify-content: center;
}

.login-actions h3 {
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  color: hsl(var(--foreground));
  text-align: center;
}

.login-actions .btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.login-actions .btn i,
.login-actions .btn svg {
  width: 20px;
  height: 20px;
}

.microsoft-icon {
  flex-shrink: 0;
}

/* Portal Page Styles */
.portal-page {
  background: hsl(var(--background));
  min-height: 100vh;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===================== Header - Theme Aware (Matching TimeLog/Admin) ===================== */
.app-header {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid hsl(var(--border));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-section i {
  font-size: 1.8rem;
  color: hsl(var(--primary));
}

.logo-section h1 {
  font-size: 1.8rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.logo-section .app-logo {
  height: 2.5rem;
  width: auto;
}

/* Theme-aware logo switching */
.light-logo {
  display: block;
}

.dark-logo {
  display: none;
}

body.dark .light-logo {
  display: none;
}

body.dark .dark-logo {
  display: block;
}

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

.user-info-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  color: hsl(var(--foreground));
}

.user-info-text i {
  font-size: 1rem;
  color: hsl(var(--foreground));
}

/* Clickable username styling */
.user-info-text #userName {
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  transition: all 0.2s;
}

.user-info-text #userName:hover {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  box-shadow: 0 0 0 1px hsl(var(--primary) / 0.2);
  transform: translateY(-1px);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Ensure consistent sizing for theme toggle and customizer buttons */
.header-actions .theme-toggle-btn {
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 2.5rem;
  height: 2.5rem;
}

.header-actions .btn {
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  height: 2.5rem;
}

.header-actions .theme-toggle-btn:hover,
.header-actions .btn:hover {
  background: hsl(var(--accent));
  border-color: hsl(var(--primary));
}

/* Theme Toggle Button - Light/Dark Mode */
.theme-toggle-btn {
  position: relative;
}

.theme-toggle-btn .fa-moon {
  display: none;
}

body.dark .theme-toggle-btn .fa-sun {
  display: none;
}

body.dark .theme-toggle-btn .fa-moon {
  display: inline;
}

/* ===================== Navigation - Tab Navigation System ===================== */
.app-nav {
  display: flex;
  justify-content: flex-start;
  padding: 0.5rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  background: hsl(var(--background));
  position: sticky;
  top: 73px;
  z-index: 97;
}

.nav-container {
  background: hsl(var(--muted));
  border-bottom: 1px solid hsl(var(--border));
  padding: 0.25rem 0.5rem;
  display: inline-flex;
  height: 2.75rem;
  align-items: center;
  gap: 0.25rem;
  border-radius: 0.5rem;
  width: fit-content;
}

.nav-btn {
  background: none;
  border: none;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  transition: all 0.2s;
  border-radius: 0.375rem;
  font-weight: 500;
  height: 2.25rem;
  gap: 0.375rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-btn:hover {
  color: hsl(var(--foreground));
}

.nav-btn.active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Tab Content */
.tab-content {
  padding: 2rem;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ===================== Main Content - Responsive ===================== */
.app-content {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem;
}

.portal-section {
  margin-bottom: 3rem;
}

.portal-section h2 {
  font-size: 1.8rem;
  margin-bottom: 2rem;
  color: hsl(var(--foreground));
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 25px;
  margin-bottom: 3rem;
}

.app-card {
  background: hsl(var(--card));
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid hsl(var(--border));
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 240px;
  max-width: 400px;
}

.app-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.app-card h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: hsl(var(--foreground));
}

.app-card p {
  color: hsl(var(--muted-foreground));
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  flex: 1;
  min-height: 3em;
  line-height: 1.5;
}

.internal-app h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.internal-app h3 i {
  font-size: 1.2rem;
  color: hsl(var(--primary));
}

.internal-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid hsl(var(--border));
}

.internal-section h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: hsl(var(--foreground));
}

.section-description {
  color: hsl(var(--muted-foreground));
  margin-bottom: 2rem;
  font-size: 1rem;
}

/* Button Styles */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
}

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border: 1px solid hsl(var(--primary));
}

.btn-primary:hover {
  background: hsl(var(--primary) / 0.9);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px hsl(var(--primary) / 0.3);
}

.btn-dark {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
}

.btn-dark:hover {
  background: hsl(var(--accent));
  border-color: hsl(var(--primary));
  transform: translateY(-2px);
}

.btn-app {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 10px 20px;
  font-size: 0.9rem;
  margin-top: auto;
  width: 100%;
}

.btn-app:disabled {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-app:disabled:hover {
  transform: none;
}

.btn-active {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.btn-active:hover {
  background: hsl(var(--primary) / 0.9);
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.icon {
  font-size: 1.2rem;
}

.microsoft-icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* ===================== User Info Modal ===================== */
.user-info-modal .modal-content {
  max-width: 500px;
}

.user-detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1rem;
  background: hsl(var(--muted));
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.user-detail-item:last-child {
  margin-bottom: 0;
}

.user-detail-label {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-detail-label i {
  font-size: 0.875rem;
}

.user-detail-value {
  font-size: 1rem;
  color: hsl(var(--foreground));
  font-weight: 500;
}

.user-roles-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  border-radius: calc(var(--radius) * 2);
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid hsl(var(--primary) / 0.2);
}

/* Organization Switcher Styles */
.org-switcher-controls {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
  margin-top: 0.5rem;
}

.org-switcher-select {
  flex: 1;
  padding: 0.625rem 0.875rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.org-switcher-select:hover {
  border-color: hsl(var(--primary));
  background: hsl(var(--accent));
}

.org-switcher-select:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.2);
}

.btn-sm {
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .app-content {
    max-width: 100%;
    padding: 0;
  }

  .app-nav {
    padding: 0.5rem 1rem;
  }

  .tab-content {
    padding: 2rem 1rem;
  }
}

@media (max-width: 768px) {
  .login-content {
    grid-template-columns: 1fr;
  }

  .apps-grid {
    grid-template-columns: 1fr;
  }

  .app-header {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .user-info {
    width: 100%;
    justify-content: space-between;
  }

  .app-content {
    padding: 0;
  }

  .app-nav {
    padding: 0.5rem 0.5rem;
  }

  .nav-container {
    overflow-x: auto;
    width: 100%;
    flex-wrap: nowrap;
  }

  .nav-btn {
    white-space: nowrap;
  }

  .tab-content {
    padding: 1rem 0.5rem;
  }

  .portal-section h2,
  .internal-section h2 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .logo-section h1 {
    font-size: 1.25rem;
  }

  .logo-section i {
    font-size: 1.25rem;
  }

  .user-info-text span {
    display: none;
  }

  .theme-toggle-btn span {
    display: none;
  }

  .org-switcher-controls {
    flex-direction: column;
  }

  .org-switcher-select {
    width: 100%;
  }

  .btn-sm {
    width: 100%;
  }
}
