/* -------------------------------------------------------------
 * DIKAN DSM Gateway Portal - Clean Matte Developer Console Theme
 * ------------------------------------------------------------- */

/* Custom Typography - Clean Developer Sans */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Color System - Solid Matte Dashboard Slate */
  --bg-primary: #080b11;       /* Solid deep slate-black ground */
  --bg-secondary: #0f1624;     /* Card and panel ground */
  --bg-tertiary: #172033;      /* Input fields, default cards, sub-surfaces */
  --border-subtle: #1e293b;    /* Border line for panels */
  --border-strong: #2d3748;    /* Border line for cards and fields */
  
  --accent-blue: #3b82f6;
  --accent-blue-rgb: 59, 130, 246;
  --accent-violet: #a78bfa;
  --accent-violet-rgb: 167, 139, 250;
  --accent-emerald: #10b981;
  --accent-emerald-rgb: 16, 185, 129;
  --accent-rose: #ef4444;
  --accent-rose-rgb: 239, 68, 68;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  
  /* Radii Tokens - Tighter for a professional UI structure */
  --rounded-sm: 6px;
  --rounded-md: 8px;
  --rounded-lg: 10px;
  --rounded-xl: 12px;
  
  /* Fonts */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout Centering Wrapper - Fixes alignment shifts on wide viewports */
.app-layout {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header Section */
header {
  padding: 2.5rem 0 1.5rem;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}

.header-logo-group {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

/* Official SVG Logo display - Explicit dimensions fix layout shifts */
.dikan-logo {
  width: 80px;
  height: 22px;
  display: block;
}

.logo-separator {
  width: 1px;
  height: 16px;
  background-color: var(--border-strong);
}

.logo-subtitle {
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

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

/* Action Buttons */
.btn {
  font-family: var(--font-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.45rem 0.875rem;
  border-radius: var(--rounded-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-secondary);
}

.btn:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.btn-icon-only {
  padding: 0.45rem;
  aspect-ratio: 1;
}

/* Main Dashboard Grid */
main {
  flex: 1;
  width: 100%;
  padding: 2rem 0 4rem;
}

/* grid minmax(0, 1fr) ensures columns shrink and wrap, preventing horizontal skewing */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem;
}

@media (max-width: 868px) {
  .app-layout {
    padding: 0 1.25rem;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
  header {
    padding: 1.5rem 0 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  main {
    padding: 1.5rem 0 3rem;
  }
}

/* Section Containers - Clean solid surfaces */
.section-panel {
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.section-header {
  padding-bottom: 0.75rem;
}

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

.section-icon-badge {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-icon-badge svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-secondary);
}

.in-office:hover .section-icon-badge svg {
  stroke: var(--accent-blue);
}

.out-office:hover .section-icon-badge svg {
  stroke: var(--accent-violet);
}

.section-header h2 {
  font-family: var(--font-primary);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-header p {
  font-family: var(--font-primary);
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  line-height: 1.4;
}

/* User Alert Notes - Clean and Refined Alert styling (no side borders) */
.section-note {
  font-family: var(--font-primary);
  font-size: 0.75rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--rounded-md);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.01);
}

.section-note svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

.in-office .section-note svg {
  color: var(--accent-blue);
}

.out-office .section-note svg {
  color: var(--accent-violet);
}

.section-note strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* Servers List Scaffolding */
.servers-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Server Access Card - Matte Solid Card Row */
.server-card {
  text-decoration: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--rounded-lg);
  padding: 1.125rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.125rem;
  cursor: pointer;
  transition: all 0.15s ease-out;
}

.server-card:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-strong);
}

.in-office .server-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
}

.out-office .server-card:hover {
  border-color: rgba(167, 139, 250, 0.4);
}

.server-card:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* Clean, inline icons without round background boxes */
.server-card-icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.server-card-icon-container svg {
  width: 22px;
  height: 22px;
}

.in-office .server-card:hover .server-card-icon-container {
  color: var(--accent-blue);
}

.out-office .server-card:hover .server-card-icon-container {
  color: var(--accent-violet);
}

/* Server Information Fields */
.server-card-info {
  flex: 1;
  min-width: 0; /* Prevents text overflow */
}

.server-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.1rem;
}

.server-card-title {
  font-family: var(--font-primary);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.server-card-badge {
  font-family: var(--font-primary);
  font-size: 0.625rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.archive-card .server-card-badge {
  background: rgba(59, 130, 246, 0.08);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.12);
}

.comms-card .server-card-badge {
  background: rgba(16, 185, 129, 0.08);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.12);
}

.server-card-desc {
  font-family: var(--font-primary);
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-card-address {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.server-card:hover .server-card-address {
  color: var(--text-secondary);
}

.server-card-address svg {
  width: 10px;
  height: 10px;
}

/* Status Indicator Dot */
.server-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.status-indicator {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--text-muted);
  transition: all 0.25s ease;
}

.status-dot.online {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.3);
  animation: pulse-glow 2.2s infinite;
}

.status-dot.offline {
  background-color: var(--accent-rose);
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.2);
}

.status-dot.checking {
  background-color: #d97706; /* Amber-600 */
  box-shadow: 0 0 4px rgba(217, 119, 6, 0.2);
  animation: pulse-glow 1.2s infinite;
}

.status-dot.local-link {
  background-color: var(--text-muted);
  box-shadow: none;
}

.status-label {
  font-family: var(--font-primary);
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-dot.online ~ .status-label {
  color: var(--accent-emerald);
}

.status-dot.offline ~ .status-label {
  color: var(--accent-rose);
}

.status-dot.checking ~ .status-label {
  color: #d97706;
}

.status-dot.local-link ~ .status-label {
  color: var(--text-muted);
}

@keyframes pulse-glow {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(var(--accent-color-rgb, 16, 185, 129), 0.3);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 4px rgba(var(--accent-color-rgb, 16, 185, 129), 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(var(--accent-color-rgb, 16, 185, 129), 0);
  }
}

.status-dot.online {
  --accent-color-rgb: var(--accent-emerald-rgb);
}
.status-dot.offline {
  --accent-color-rgb: var(--accent-rose-rgb);
}
.status-dot.checking {
  --accent-color-rgb: 217, 119, 6;
}

/* SMB Action Link Finder Mount Button */
.smb-action-link {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--rounded-sm);
  transition: all 0.15s ease;
  z-index: 5;
  position: relative;
}

.smb-action-link:hover {
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.08);
}

.out-office .smb-action-link:hover {
  color: var(--accent-violet);
  background: rgba(167, 139, 250, 0.08);
}

.smb-action-link svg {
  width: 14px;
  height: 14px;
}

/* Card Launch Indicator */
.launch-icon-wrapper {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--rounded-sm);
  transition: all 0.15s ease;
}

.server-card:hover .launch-icon-wrapper {
  color: var(--text-primary);
  transform: translateX(1px);
}

.launch-icon-wrapper svg {
  width: 14px;
  height: 14px;
}

/* Settings Dialog Modal (Natively managed display state) */
dialog.settings-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--rounded-xl);
  padding: 2rem;
  max-width: 480px;
  width: 90%;
  color: var(--text-primary);
  
  /* Centered position */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
  z-index: 100;
  
  /* Safe browser animation toggles */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

dialog.settings-dialog[open] {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

dialog.settings-dialog::backdrop {
  background-color: rgba(4, 6, 10, 0.85); /* Solid dark mask */
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

dialog.settings-dialog[open]::backdrop {
  opacity: 1;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
}

.dialog-header h3 {
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dialog-header h3 svg {
  width: 18px;
  height: 18px;
  color: var(--accent-blue);
}

.dialog-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--rounded-sm);
  transition: all 0.15s ease;
}

.dialog-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.dialog-close svg {
  width: 16px;
  height: 16px;
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.dialog-form-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dialog-form-section h4 {
  font-family: var(--font-primary);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-left: 2px solid var(--accent-blue);
  padding-left: 0.5rem;
  margin-bottom: 0.1rem;
}

.dialog-form-section.out-office-fields h4 {
  border-left-color: var(--accent-violet);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group label {
  font-family: var(--font-primary);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-strong);
  border-radius: var(--rounded-sm);
  padding: 0.45rem 0.65rem;
  color: var(--text-primary);
  width: 100%;
  transition: border-color 0.15s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.dialog-form-section.out-office-fields .form-group input:focus {
  border-color: var(--accent-violet);
}

/* Shake animation for password authentication errors */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.form-group input.input-error {
  border-color: var(--accent-rose) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) !important;
  animation: shake 0.4s ease-in-out;
}

.dialog-footer {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1rem;
}

/* Toast Alerts (Strictly no left-stripe borders) */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  font-family: var(--font-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  border-radius: var(--rounded-md);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 250px;
  transform: translateY(15px);
  opacity: 0;
  animation: slide-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.success {
  border-color: var(--accent-emerald);
}

.toast.success svg {
  color: var(--accent-emerald);
}

.toast svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.toast-content {
  font-size: 0.78rem;
  font-weight: 500;
}

@keyframes slide-in {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .toast-container {
    right: 1rem;
    left: 1rem;
    bottom: 1rem;
  }
  .toast {
    min-width: 0;
    width: 100%;
  }
}

/* Footer Section */
footer {
  padding: 2.5rem 0;
  font-family: var(--font-primary);
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  width: 100%;
  text-align: center;
}

footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

footer a:hover {
  color: var(--accent-blue);
}

/* Sub-section Divider and Headers */
.sub-section-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--border-subtle) 0%, transparent 100%);
  margin: 2rem 0 1.5rem;
}

.sub-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.sub-section-title {
  font-family: var(--font-primary);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.smb-username-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-strong);
  border-radius: var(--rounded-sm);
  padding: 0.4rem 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.smb-username-group:focus-within {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.smb-username-group svg.user-icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.smb-username-group input {
  font-family: var(--font-primary);
  font-size: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-primary);
  outline: none;
  padding: 0;
  width: 120px;
  transition: width 0.2s ease;
}

.smb-username-group input::placeholder {
  color: var(--text-muted);
  opacity: 0.55;
}

.smb-username-group input:focus {
  width: 160px;
}


