/* Portal-specific styles extending Edge UI */

/* ===== LOGIN SCREEN ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-container {
  width: 100%;
  max-width: 420px;
  background: radial-gradient(circle at top left, rgba(79, 140, 255, 0.08), transparent 60%),
    var(--bg-elevated-soft);
  border-radius: var(--border-radius-xl);
  border: 1px solid var(--border-subtle);
  padding: 2rem;
  box-shadow: var(--shadow-soft);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(79, 140, 255, 0.5);
  margin-bottom: 1rem;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.02em;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(10, 14, 24, 0.6);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.form-error {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: transparent;
  font-weight: 500;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 18px rgba(79, 140, 255, 0.6);
  transform: translateY(-1px);
}

.btn-block {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-oauth {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 42px;
}

.btn-oauth:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

/* ===== DIVIDERS ===== */
.login-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.login-divider span {
  padding: 0 1rem;
}

.oauth-buttons {
  display: flex;
  gap: 0.75rem;
}

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
}

.login-footer a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* ===== SPINNER ===== */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== UTILITY CLASSES ===== */
.hidden {
  display: none !important;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== ORG SELECTOR ===== */
.org-selector {
  margin-right: 1rem;
}

.org-select {
  width: auto;
  min-width: 200px;
  height: 36px;
  background: rgba(10, 14, 24, 0.8);
  cursor: pointer;
}

/* ===== DROPDOWN ENHANCEMENTS ===== */
.dropdown-user-info {
  padding: 0.6rem 0.8rem;
}

.dropdown-user-info > div:first-child {
  font-weight: 500;
}

.dropdown-divider {
  border: none;
  height: 1px;
  background: var(--border-subtle);
  margin: 0.35rem 0;
}

/* ===== DEVICE CARDS ===== */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.device-card {
  background: var(--bg-elevated-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-xl);
  padding: 1.25rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.device-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(79, 140, 255, 0.2);
}

.device-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.device-name {
  font-size: 1.1rem;
  font-weight: 600;
}

.device-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background: #35d39c;
  box-shadow: 0 0 8px rgba(53, 211, 156, 0.6);
}

.status-dot.offline {
  background: #ff4f4f;
}

.status-dot.error {
  background: #facc15;
}

.device-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.device-meta dt {
  font-weight: 500;
  color: var(--text-primary);
}

.device-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* ===== TABLES ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.2);
}

.data-table tr:hover td {
  background: rgba(79, 140, 255, 0.05);
}

/* ===== PILLS ===== */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pill-online {
  background: rgba(53, 211, 156, 0.16);
  color: #7ff0c8;
}

.pill-offline {
  background: rgba(255, 79, 79, 0.14);
  color: #ff9a9a;
}

.pill-active {
  background: rgba(79, 140, 255, 0.14);
  color: #a8c6ff;
}

.pill-suspended {
  background: rgba(255, 193, 7, 0.14);
  color: #ffd27a;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  opacity: 0.3;
  margin-bottom: 1rem;
}

.empty-state h3 {
  margin: 0 0 0.5rem;
  color: var(--text-primary);
}

.empty-state p {
  margin: 0 0 1.5rem;
}

/* ===== STATS CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-elevated-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-lg);
  padding: 1.25rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 600;
}

.stat-value.accent {
  color: var(--accent);
}

.stat-value.success {
  color: #35d39c;
}

.stat-value.danger {
  color: var(--danger);
}

/* ===== APP CONTAINER ===== */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-container .app-shell {
  flex: 1;
  min-height: 0;
}

/* ===== STATUS BADGES ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-active {
  background: rgba(53, 211, 156, 0.16);
  color: #7ff0c8;
}

.status-warning {
  background: rgba(250, 204, 21, 0.16);
  color: #ffd27a;
}

.status-error {
  background: rgba(255, 79, 79, 0.14);
  color: #ff9a9a;
}

/* ===== ACTION BUTTONS ===== */
.action-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-xs {
  height: 28px;
  padding: 0 0.5rem;
  font-size: 0.8rem;
}

.btn-xs svg {
  width: 14px;
  height: 14px;
}

.btn-danger-hover:hover {
  background: rgba(255, 79, 79, 0.2);
  border-color: var(--danger);
  color: var(--danger);
}

/* ===== FORM HELP TEXT ===== */
.form-help {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ===== TEXT UTILITIES ===== */
.text-warning {
  color: #ffc107;
  font-size: 0.9rem;
}

.text-error {
  color: var(--danger);
}

/* ===== CODE STYLING ===== */
code {
  font-family: 'SF Mono', Monaco, 'Consolas', monospace;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ===== MODAL ENHANCEMENTS ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--border-radius-xl);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-soft);
}

.modal h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.modal > p {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #ff3535;
  box-shadow: 0 0 12px rgba(255, 79, 79, 0.5);
}

/* ===== ADMIN NAV SECTION ===== */
.admin-nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.admin-nav-section .nav-item {
  width: 100%;
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===== ORG DETAIL HEADER ===== */
.org-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.org-detail-header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.org-detail-header .status-badge {
  margin-left: auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.back-link:hover {
  color: var(--accent);
}

/* ===== DEVICE ASSIGNMENT ===== */
.unassigned-badge {
  background: rgba(250, 204, 21, 0.16);
  color: #ffd27a;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.assign-btn {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent);
}

.assign-btn:hover {
  background: var(--accent);
  color: white;
}
