/* =========================================
   ACADEMY - User Dashboard CSS (Redesigned)
   Version: 2.0
   ========================================= */

/* ===== GOOGLE FONTS ===== */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@300;400;500;600;700&family=DM+Sans:wght@400;500;700&display=swap");

/* ===== CSS VARIABLES ===== */
:root {
  /* Light Theme Colors */
  --dashboard-bg: #dfe5ef;
  --widget-bg: #dfe5ef;
  --widget-title-bg: #e0eaff;
  --primary-text: #002b69;
  --secondary-text: #3d3d3d;
  --accent-color: #0056d2;
  --gradient-btn: linear-gradient(135deg, #362fd9, #362fd9, #2e97a7);

  /* Additional Light Theme Colors */
  --card-bg: #ffffff;
  --border-color: #c5cfe0;
  --hover-bg: #d0d9e8;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --info-color: #17a2b8;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 43, 105, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 43, 105, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 43, 105, 0.15);

  /* Typography */
  --font-primary:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-secondary: "Poppins", sans-serif;
  --font-display: "DM Sans", sans-serif;
}

[data-theme="dark"] {
  /* Dark Theme Colors */
  --dashboard-bg: #191d24;
  --widget-bg: #232935;
  --widget-title-bg: #232935;
  --primary-text: #dfe5ef;
  --secondary-text: #dadfe9;
  --accent-color: #0056d2;
  --gradient-btn: linear-gradient(135deg, #362fd9, #362fd9, #2e97a7);

  /* Additional Dark Theme Colors */
  --card-bg: #2a3142;
  --border-color: #3a4052;
  --hover-bg: #2f3648;
  --success-color: #34d058;
  --warning-color: #ffb020;
  --danger-color: #f85149;
  --info-color: #58a6ff;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ===== RESET & BASE STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  background-color: var(--dashboard-bg);
  color: var(--primary-text);
  line-height: 1.6;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
  overflow-x: hidden;
}

/* ===== LAYOUT STRUCTURE ===== */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 280px;
  background-color: var(--card-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  z-index: 1000;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo img {
  max-width: 160px;
  height: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 12px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 6px;
  border-radius: 12px;
  color: var(--secondary-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.nav-item i {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.nav-item:hover {
  background-color: var(--hover-bg);
  color: var(--accent-color);
  transform: translateX(4px);
}

.nav-item.active {
  background-color: var(--accent-color);
  color: white;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.nav-item.active i {
  color: white;
}

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

.user-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background-color: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-color), #003d99);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 12px;
  color: var(--secondary-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar Bottom Section */
.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
}

.sidebar-nav-secondary {
  padding: 12px 12px 0 12px;
}

.sidebar-nav-secondary .nav-item {
  padding: 12px 18px;
  margin-bottom: 4px;
  font-size: 14px;
}

.sidebar-nav-secondary .nav-item i {
  font-size: 18px;
}

/* Profile Card */
.user-profile-card {
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-profile-card:hover {
  background-color: var(--hover-bg);
}

.profile-chevron {
  color: var(--secondary-text);
  font-size: 12px;
  transition: transform 0.2s ease;
}

.user-profile-card.active .profile-chevron {
  transform: rotate(180deg);
}

/* Profile Dropdown */
.sidebar-footer {
  position: relative;
}

.profile-dropdown {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 16px;
  right: 16px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  margin-bottom: 8px;
  overflow: hidden;
  z-index: 1000;
}

.profile-dropdown.show {
  display: block;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--primary-text);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
}

.profile-dropdown-item:hover {
  background-color: var(--hover-bg);
  color: #e74c3c;
}

.profile-dropdown-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* ===== MAIN CONTENT AREA ===== */
.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 32px;
  min-height: 100vh;
  background-color: var(--dashboard-bg);
  transition: margin-left 0.3s ease;
}

/* ===== WELCOME BANNER ===== */
.welcome-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 32px;
  background: linear-gradient(135deg, var(--accent-color), #0041a8);
  border-radius: 16px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
  color: white;
}

.welcome-text h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 6px;
}

.welcome-text h1 span {
  color: #ffd700;
}

.welcome-text p {
  font-size: 15px;
  opacity: 0.9;
  font-weight: 400;
}

.quick-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* ===== METRICS GRID ===== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.metric-card {
  background-color: var(--card-bg);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.metric-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.metric-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-color), #003d99);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  flex-shrink: 0;
}

.metric-content {
  flex: 1;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-text);
  font-family: var(--font-display);
  margin-bottom: 4px;
}

.metric-label {
  font-size: 13px;
  color: var(--secondary-text);
  font-weight: 500;
}

/* ===== WIDGETS ===== */
.widget {
  background-color: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.widget-header {
  padding: 20px 24px;
  background-color: var(--widget-title-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.widget-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-text);
  font-family: var(--font-secondary);
}

.widget-actions select {
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--card-bg);
  color: var(--primary-text);
  font-size: 14px;
  font-family: var(--font-primary);
  cursor: pointer;
}

.widget-body {
  padding: 24px;
}

.view-all {
  color: var(--accent-color);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s;
}

.view-all:hover {
  opacity: 0.8;
}

/* ===== CHARTS ===== */
.chart-widget canvas {
  max-width: 100%;
  height: 300px !important;
}

/* ===== ACTIVITY LIST ===== */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.activity-item:hover {
  background-color: var(--hover-bg);
  box-shadow: var(--shadow-sm);
}

.activity-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--info-color), #0d8aa8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  flex-shrink: 0;
}

.activity-details {
  flex: 1;
  min-width: 0;
}

.activity-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary-text);
  margin-bottom: 4px;
}

.activity-time {
  font-size: 13px;
  color: var(--secondary-text);
}

.activity-status {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.activity-status.running,
.activity-status.active {
  background-color: rgba(40, 167, 69, 0.15);
  color: var(--success-color);
}

.activity-status.stopped {
  background-color: rgba(220, 53, 69, 0.15);
  color: var(--danger-color);
}

/* ===== DASHBOARD CONTENT SECTIONS ===== */
.dashboard-content {
  display: none;
}

.dashboard-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }

  .welcome-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
  }

  .welcome-text h1 {
    font-size: 24px;
  }

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

  .widget-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* ===== MOBILE MENU TOGGLE ===== */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1100;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background-color: var(--accent-color);
  color: white;
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main-content {
    padding-top: 80px;
  }
}

/* ===== OVERLAY FOR MOBILE ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

@media (max-width: 768px) {
  .sidebar-overlay.show {
    display: block;
  }
}

/* ===== LOADING SPINNER ===== */
.loading-spinner {
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--accent-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ===== UTILITIES ===== */
.text-center {
  text-align: center;
}

.mb-2 {
  margin-bottom: 16px;
}

.mb-3 {
  margin-bottom: 24px;
}

.mt-2 {
  margin-top: 16px;
}

.hidden {
  display: none !important;
}

/* ===== MODAL STYLES ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--widget-title-bg);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h3 i {
  color: var(--accent-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--secondary-text);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--danger-color);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--widget-bg);
}

/* ===== TARGET MACHINE CARDS ===== */
.machine-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  cursor: pointer;
}

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

.machine-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
  margin-bottom: 16px;
}

.machine-card-icon.linux {
  background: linear-gradient(135deg, #00b894, #00cec9);
}

.machine-card-icon.windows {
  background: linear-gradient(135deg, #0984e3, #74b9ff);
}

.machine-card h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary-text);
  margin-bottom: 8px;
}

.machine-card p {
  font-size: 13px;
  color: var(--secondary-text);
  line-height: 1.5;
  margin-bottom: 16px;
}

.machine-card .launch-btn {
  width: 100%;
  padding: 10px 16px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.machine-card .launch-btn:hover {
  background: #004bb5;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  border-left: 4px solid var(--accent-color);
  animation: toastSlideIn 0.3s ease-out;
  pointer-events: auto;
  min-width: 300px;
}

.toast.toast-success {
  border-left-color: #00b894;
}

.toast.toast-error {
  border-left-color: #e74c3c;
}

.toast.toast-warning {
  border-left-color: #f39c12;
}

.toast.toast-info {
  border-left-color: #0984e3;
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.toast-success .toast-icon {
  background: rgba(0, 184, 148, 0.15);
  color: #00b894;
}

.toast-error .toast-icon {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.toast-warning .toast-icon {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
}

.toast-info .toast-icon {
  background: rgba(9, 132, 227, 0.15);
  color: #0984e3;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-text);
  margin-bottom: 4px;
}

.toast-message {
  font-size: 13px;
  color: var(--secondary-text);
  line-height: 1.4;
  word-wrap: break-word;
}

.toast-close {
  background: none;
  border: none;
  color: var(--secondary-text);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.toast-close:hover {
  opacity: 1;
}

.toast.toast-hiding {
  animation: toastSlideOut 0.3s ease-in forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

/* Cooldown Display in Quick Launch */
.cooldown-display {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(243, 156, 18, 0.1);
  border: 1px solid rgba(243, 156, 18, 0.3);
  border-radius: 8px;
  color: #f39c12;
}

.cooldown-display i {
  font-size: 18px;
}

.cooldown-display .cooldown-text {
  font-size: 14px;
  font-weight: 500;
}

.quota-display {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--secondary-text);
  margin-top: 8px;
}

.quota-display .quota-badge {
  background: var(--accent-color);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 12px;
}
