:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --secondary: #ec4899;
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass-blur: blur(12px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  background: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
    radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
    radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  text-decoration: none;
  color: var(--primary);
  transition: all 0.3s ease;
}

a:hover {
  color: var(--primary-hover);
}

.glass-panel {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
}

/* Auth Pages */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.auth-card {
  width: 100%;
  max-width: 450px;
  padding: 3rem;
  text-align: center;
}

.auth-card h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-card p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  width: 100%;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
  color: white;
}

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

.btn-secondary:hover {
  background: rgba(99, 102, 241, 0.1);
}

/* Layout and Sidebar transitions */
.layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.sidebar {
  width: 280px;
  padding: 2rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  z-index: 10;
}

.sidebar-brand {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 3rem;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 1rem;
  white-space: nowrap;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand span {
  transition: opacity 0.2s ease, width 0.2s ease;
  opacity: 1;
}

.nav-links {
  list-style: none;
  flex: 1;
}

.nav-links li {
  margin-bottom: 0.5rem;
}

.nav-links a {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-links a i {
  margin-right: 1rem;
  font-size: 1.2rem;
  width: 20px;
  text-align: center;
  transition: margin 0.3s ease;
}

.nav-links a span {
  transition: opacity 0.2s ease;
  opacity: 1;
}

.nav-links a:hover, .nav-links a.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-links a.active {
  border-left: 3px solid var(--primary);
  background: linear-gradient(90deg, rgba(99,102,241,0.1) 0%, transparent 100%);
}

.logout-link i {
  margin-right: 1rem;
  font-size: 1.2rem;
  width: 20px;
  text-align: center;
}

.logout-link span {
  transition: opacity 0.2s ease;
  opacity: 1;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
  position: absolute;
  top: 2rem;
  right: -15px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle:hover {
  color: var(--text-main);
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.1);
}

/* Collapsed Sidebar State */
.layout.sidebar-collapsed .sidebar {
  width: 88px;
  padding: 2rem 1rem;
}

.layout.sidebar-collapsed .sidebar-brand span {
  opacity: 0;
  width: 0;
  pointer-events: none;
  display: inline-block;
  overflow: hidden;
}

.layout.sidebar-collapsed .nav-links a span {
  opacity: 0;
  width: 0;
  pointer-events: none;
  display: inline-block;
  overflow: hidden;
}

.layout.sidebar-collapsed .logout-link span {
  opacity: 0;
  width: 0;
  pointer-events: none;
  display: inline-block;
  overflow: hidden;
}

.layout.sidebar-collapsed .nav-links a i,
.layout.sidebar-collapsed .logout-link i {
  margin-right: 0;
}

.layout.sidebar-collapsed .sidebar-toggle i {
  transform: rotate(180deg);
}

.main-content {
  flex: 1;
  padding: 2rem 3rem;
  overflow-y: auto;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0; /* Prevents overflow issues in flex items */
}

/* Mobile Toggle Styles */
.mobile-nav-toggle {
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.25rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  transition: all 0.3s ease;
}

.mobile-nav-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
  color: var(--primary);
}

/* Mobile responsive overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 98;
  display: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.responsive-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Responsiveness Media Queries */
@media (max-width: 1024px) {
  .main-content {
    padding: 2rem;
  }
}

@media (max-width: 992px) {
  .mobile-nav-toggle {
    display: flex;
  }
  
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 99;
    transform: translateX(-100%);
    background: #0f172a; /* Solidify dark backdrop on mobile slide-out */
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }
  
  .sidebar-toggle {
    display: none; /* Hide desktop toggle on mobile */
  }
  
  .layout.sidebar-active .sidebar {
    transform: translateX(0);
  }
  
  .layout.sidebar-active .sidebar-overlay {
    display: block;
    opacity: 1;
  }
  
  /* Reset collapsed state styles on mobile */
  .layout.sidebar-collapsed .sidebar {
    width: 280px;
    padding: 2rem;
    transform: translateX(-100%);
  }
  
  .layout.sidebar-collapsed.sidebar-active .sidebar {
    transform: translateX(0);
  }
  
  .layout.sidebar-collapsed .sidebar-brand span,
  .layout.sidebar-collapsed .nav-links a span,
  .layout.sidebar-collapsed .logout-link span {
    opacity: 1;
    width: auto;
    display: inline;
    pointer-events: auto;
  }
  
  .layout.sidebar-collapsed .nav-links a i,
  .layout.sidebar-collapsed .logout-link i {
    margin-right: 1rem;
  }
  
  .charts-grid {
    grid-template-columns: 1fr;
  }
  
  .responsive-two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .main-content {
    padding: 1.5rem 1rem;
  }
  
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .header .user-profile {
    width: 100%;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .modal-content {
    padding: 1rem;
  }
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.header h2 {
  font-size: 1.8rem;
  font-weight: 600;
}

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

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Dashboard Widgets */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.stat-icon.primary { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.stat-icon.secondary { background: rgba(236, 72, 153, 0.1); color: var(--secondary); }
.stat-icon.success { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.stat-icon.warning { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

.stat-info h3 {
  font-size: 2rem;
  margin-bottom: 0.2rem;
}

.stat-info p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Tables */
.table-container {
  overflow-x: auto;
  margin-top: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge.success { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.badge.warning { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.badge.danger { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.badge.primary { background: rgba(99, 102, 241, 0.1); color: var(--primary); }

/* Charts Area */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}



.chart-card {
  padding: 1.5rem;
  height: 350px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chart-card h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.chart-card .table-container {
  flex: 1;
  overflow-y: auto;
  margin-top: 0;
}

/* Premium Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.4);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 850px;
  padding: 2rem;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

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

/* Premium Glass Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  margin-right: 0.5rem;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: .3s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background-color: var(--primary);
  border-color: var(--primary);
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
  background-color: white;
}

/* Premium Segmented Controls Tab Active state */
.tab-btn.active {
  background: var(--primary) !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Navigation Dropdown Menu styling */
.nav-dropdown {
  position: relative;
}

.nav-dropdown .dropdown-menu {
  list-style: none;
  padding-left: 1.5rem;
  display: none;
  margin-top: 0.25rem;
}

.nav-dropdown:hover .dropdown-menu {
  display: block;
}

.dropdown-menu li {
  margin-bottom: 0.25rem;
}

.dropdown-menu a {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.dropdown-menu a:hover,
.dropdown-menu a.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.dropdown-menu a.active {
  border-left: 2px solid var(--primary);
  padding-left: 0.75rem;
}

.dropdown-arrow {
  transition: transform 0.3s ease;
}

.nav-dropdown:hover .dropdown-arrow {
  transform: rotate(180deg);
}

/* Collapsed Sidebar Hover Dropdown flyout styles */
.layout.sidebar-collapsed .nav-dropdown {
  position: relative;
}

.layout.sidebar-collapsed .nav-dropdown:hover .dropdown-menu {
  position: absolute;
  left: calc(100% - 10px);
  top: 0;
  width: 250px;
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  display: block;
  z-index: 1000;
  box-shadow: var(--glass-shadow);
  margin-top: 0;
}

.layout.sidebar-collapsed .dropdown-menu li a span {
  opacity: 1 !important;
  width: auto !important;
  display: block !important;
  pointer-events: auto !important;
}

/* Browser preview simulation styles */
.browser-preview-card {
  display: flex;
  flex-direction: column;
  height: 580px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #1e293b;
  box-shadow: var(--glass-shadow);
}

.browser-header {
  background: #0f172a;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.browser-dots {
  display: flex;
  gap: 0.4rem;
}

.browser-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.browser-dot.red { background: #ef4444; }
.browser-dot.yellow { background: #f59e0b; }
.browser-dot.green { background: #10b981; }

.browser-address-bar {
  flex: 1;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 6px;
  padding: 0.35rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border: 1px solid var(--border);
}

.browser-address-bar i {
  color: #10b981;
}

.browser-body {
  flex: 1;
  background: #ffffff;
  position: relative;
}

.browser-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

.browser-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  padding: 2.5rem;
  text-align: center;
  background: #0f172a;
}
