/* 
   Sarkar AI Dashboard - Dark Mode
   Author: Claude
   Date: May 2025
*/

/* ==================== 
   Variables & Reset
   ==================== */
:root {
  --bg-primary: #121212;
  --bg-secondary: #1e1e1e;
  --bg-tertiary: #252525;
  --bg-elevated: #2d2d2d;
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #60A5FA;
  --primary-translucent: rgba(37, 99, 235, 0.1);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --border-color: #333333;
  --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  --card-hover-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1.0);
  --radius: 8px;
}

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

body, html {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input {
  font-family: inherit;
}

/* ==================== 
   App Container Layout
   ==================== */
.app-container {
  display: flex;
  height: 100vh;
  width: 100%;
}

/* ==================== 
   Sidebar Styling
   ==================== */
.sidebar {
  width: 240px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo span {
  font-weight: 600;
  font-size: 18px;
  color: var(--text-primary);
}

.sidebar-nav {
  padding: 24px 0;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s var(--ease);
}

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

.nav-item.active {
  background-color: var(--primary-translucent);
  color: var(--primary-light);
  position: relative;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background-color: var(--primary);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--primary-translucent);
  color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
}

.user-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
}

.user-email {
  color: var(--text-tertiary);
  font-size: 12px;
}

/* ==================== 
   Main Content Area
   ==================== */
.main-content {
  flex-grow: 1;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.top-bar {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.search-bar {
  display: flex;
  align-items: center;
  background-color: var(--bg-tertiary);
  border-radius: 6px;
  padding: 0 12px;
  height: 36px;
  width: 400px;
}

.search-bar input {
  background: none;
  border: none;
  color: var(--text-primary);
  outline: none;
  width: 100%;
  margin-left: 8px;
}

.search-bar input::placeholder {
  color: var(--text-tertiary);
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.help-btn, .notifications-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
  position: relative;
}

.help-btn:hover, .notifications-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.notification-badge {
  position: absolute;
  top: 0;
  right: 0;
  background-color: var(--danger);
  color: white;
  font-size: 10px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==================== 
   Dashboard Container
   ==================== */
.dashboard-container {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.add-device-btn, .refresh-btn, .grant-access-btn, .create-workflow-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.add-device-btn:hover, .refresh-btn:hover, .grant-access-btn:hover, .create-workflow-btn:hover {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

.view-all {
  color: var(--primary-light);
  font-size: 13px;
  text-decoration: none;
}

.view-all:hover {
  text-decoration: underline;
}

/* ==================== 
   Devices Section
   ==================== */
.device-status {
  width: 100%;
  background-color: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.devices-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.device-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  transition: all 0.2s var(--ease);
}

.device-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-hover-shadow);
}

.device-card.active {
  background-color: rgba(37, 99, 235, 0.05);
  border-color: rgba(37, 99, 235, 0.3);
}

.device-status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.device-status-indicator.online {
  background-color: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.device-status-indicator.offline {
  background-color: var(--text-tertiary);
}

.device-info {
  flex-grow: 1;
}

.device-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.device-details {
  color: var(--text-secondary);
  font-size: 12px;
}

.device-metrics {
  display: flex;
  gap: 16px;
}

.metric {
  text-align: center;
}

.metric-label {
  display: block;
  color: var(--text-tertiary);
  font-size: 11px;
  margin-bottom: 4px;
}

.metric-value {
  font-weight: 600;
  color: var(--text-secondary);
}

.device-action-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
}

.device-action-btn:hover {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

/* ==================== 
   Command Console
   ==================== */
.command-console {
  width: 100%;
  background-color: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.command-input {
  display: flex;
  align-items: center;
  background-color: var(--bg-tertiary);
  border-radius: 6px;
  padding: 0 12px;
  height: 48px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: all 0.2s var(--ease);
}

.command-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2);
}

.command-input input {
  background: none;
  border: none;
  color: var(--text-primary);
  outline: none;
  width: 100%;
  height: 100%;
  font-size: 14px;
}

.command-input input::placeholder {
  color: var(--text-tertiary);
}

.voice-input-btn, .send-command-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
}

.voice-input-btn:hover, .send-command-btn:hover {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

.send-command-btn {
  color: var(--primary);
}

.command-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.suggestion-chip {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.suggestion-chip:hover {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

/* ==================== 
   Dashboard Grid Layout
   ==================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

/* ==================== 
   Recent Commands Section
   ==================== */
.recent-commands {
  background-color: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.commands-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.command-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  transition: all 0.2s var(--ease);
}

.command-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-hover-shadow);
}

.command-status-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.command-item.success .command-status-icon {
  background-color: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.command-item.pending .command-status-icon {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.command-item.failed .command-status-icon {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.command-details {
  flex-grow: 1;
}

.command-text {
  font-weight: 500;
  margin-bottom: 4px;
}

.command-time {
  color: var(--text-tertiary);
  font-size: 12px;
}

.command-action-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
}

.command-action-btn:hover {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

/* ==================== 
   Device Screen Section
   ==================== */
.device-screen {
  background-color: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.screen-display {
  background-color: var(--bg-tertiary);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.screenshot {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.screen-footer {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
}

.screen-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.active-app {
  font-weight: 500;
  font-size: 13px;
}

.update-time {
  color: var(--text-tertiary);
  font-size: 12px;
}

.screen-actions {
  display: flex;
  gap: 8px;
}

.screen-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-elevated);
  border: none;
  color: var(--text-secondary);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.screen-action-btn:hover {
  background-color: var(--primary-translucent);
  color: var(--primary-light);
}

/* ==================== 
   Access Management Section
   ==================== */
.access-management {
  background-color: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.active-sessions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  transition: all 0.2s var(--ease);
}

.session-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-hover-shadow);
}

.session-user {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-grow: 1;
}

.session-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--primary-translucent);
  color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-name {
  font-weight: 500;
  font-size: 14px;
}

.session-email {
  color: var(--text-tertiary);
  font-size: 12px;
}

.session-details {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.session-type {
  font-weight: 500;
  font-size: 13px;
  color: var(--primary-light);
}

.session-expiry {
  color: var(--text-tertiary);
  font-size: 12px;
}

.session-action-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
}

.session-action-btn:hover {
  background-color: rgba(239, 68, 68, 0.1);
}

/* ==================== 
   Saved Workflows Section
   ==================== */
.saved-workflows {
  background-color: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.workflows-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.workflow-item {
  display: flex;
  align-items: center;
  padding: 14px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  transition: all 0.2s var(--ease);
}

.workflow-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-hover-shadow);
}

.workflow-name {
  font-weight: 500;
  width: 140px;
}

.workflow-details {
  flex-grow: 1;
  color: var(--text-secondary);
  font-size: 13px;
}

.workflow-run-btn {
  background-color: var(--primary-translucent);
  border: none;
  color: var(--primary-light);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.workflow-run-btn:hover {
  background-color: var(--primary);
  color: white;
}

/* ==================== 
   Responsive Adjustments
   ==================== */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
  }
  
  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 12px;
  }
  
  .search-bar {
    width: 100%;
    max-width: 300px;
  }
}
