/* HiSUP Global Style Sheet and Design System (Vanilla CSS) */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Color Palette (Deep Sapphire theme with rich colors) */
  --primary: #1e3a8a;
  --primary-glow: rgba(30, 58, 138, 0.15);
  --primary-hover: #1e40af;
  --secondary: #f1f5f9;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.15);
  --info: #3b82f6;
  --info-glow: rgba(59, 130, 246, 0.15);

  /* Light Theme Specific Colors */
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --border-color: rgba(226, 232, 240, 0.8);
  --border-focus: #3b82f6;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 20px -2px rgba(148, 163, 184, 0.12), 0 2px 8px -1px rgba(148, 163, 184, 0.08);
  --shadow-lg: 0 12px 30px -4px rgba(148, 163, 184, 0.18), 0 4px 12px -2px rgba(148, 163, 184, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-blur: blur(12px);

  /* Borders and Spacings */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --bg-app: #0b0f19;
  --bg-sidebar: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.7);
  --bg-card-hover: rgba(15, 23, 42, 0.9);
  --border-color: rgba(30, 41, 59, 0.7);
  --border-focus: #60a5fa;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px -2px rgba(0, 0, 0, 0.4), 0 2px 8px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 30px -4px rgba(0, 0, 0, 0.5), 0 4px 12px -2px rgba(0, 0, 0, 0.4);
  
  --glass-bg: rgba(15, 23, 42, 0.55);
  --glass-border: rgba(30, 41, 59, 0.5);
  --secondary: #1e293b;
}

/* Base Styles & Resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  scroll-behavior: smooth;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Layout Containers */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
}

/* Auth Page */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 10% 20%, rgba(30, 58, 138, 0.1) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.08) 0%, transparent 40%),
              var(--bg-app);
}

.auth-card {
  width: 100%;
  max-width: 480px;
  padding: 40px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 10;
  animation: slideUp var(--transition-slow);
}

.auth-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  margin-bottom: 12px;
  box-shadow: var(--shadow-md);
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: inherit;
  font-size: 15px;
  transition: all var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-normal);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

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

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

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 12px var(--danger-glow);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
  box-shadow: 0 4px 12px var(--success-glow);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 12px;
  border-radius: 6px;
}

/* Quick Login Panel */
.quick-login {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-login-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quick-login-btn {
  padding: 8px;
  border-radius: 8px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border-style: solid;
}

.quick-login-btn:hover {
  border-color: var(--border-focus);
  color: var(--border-focus);
  background: var(--primary-glow);
}

/* Dashboard Skeleton */
.dashboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  width: 100vw;
  min-height: 100vh;
}

@media (max-width: 991px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
}

/* Sidebar styling */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: all var(--transition-normal);
}

@media (max-width: 991px) {
  .sidebar {
    position: fixed;
    left: -260px;
    width: 260px;
  }
  .sidebar.open {
    left: 0;
    box-shadow: var(--shadow-lg);
  }
}

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

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-weight: 700;
}

.sidebar-brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.sidebar-nav {
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.sidebar-link:hover {
  background: var(--bg-app);
  color: var(--text-main);
}

.sidebar-link.active {
  background: var(--primary-glow);
  color: var(--primary);
  font-weight: 600;
}

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

/* Top Header Bar */
.main-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

.top-header {
  height: 70px;
  padding: 0 32px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

@media (max-width: 991px) {
  .top-header {
    padding: 0 20px;
  }
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
}

@media (max-width: 991px) {
  .menu-toggle {
    display: block;
  }
}

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

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-hover), var(--info));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.user-info {
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .user-info {
    display: none;
  }
}

.user-name {
  font-size: 14px;
  font-weight: 600;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--bg-app);
  color: var(--text-main);
}

/* Dashboard Page Grid */
.dashboard-content {
  padding: 32px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

@media (max-width: 768px) {
  .dashboard-content {
    padding: 20px;
    gap: 20px;
  }
}

.dashboard-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.dashboard-title-row h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* Stat Grid Card Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

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

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

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--primary-glow);
  color: var(--primary);
}

.stat-icon.success {
  background: var(--success-glow);
  color: var(--success);
}

.stat-icon.danger {
  background: var(--danger-glow);
  color: var(--danger);
}

.stat-icon.warning {
  background: var(--warning-glow);
  color: var(--warning);
}

/* Content Layout Grids */
.layout-two-cols {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 28px;
}

@media (max-width: 1024px) {
  .layout-two-cols {
    grid-template-columns: 1fr;
  }
}

/* Standard Panels/Cards */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-title {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: var(--success-glow);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-glow);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-glow);
  color: var(--warning);
}

.badge-info {
  background: var(--info-glow);
  color: var(--info);
}

/* Lists and Tables */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.table th {
  background: var(--bg-app);
  padding: 14px 18px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: var(--primary-glow);
}

/* Cards List */
.cards-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-item-card {
  padding: 16px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-fast);
}

.list-item-card:hover {
  border-color: var(--border-focus);
  transform: translateX(2px);
}

/* Loading Spinners */
.spinner-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  flex-direction: column;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3.5px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

/* Custom visual progress bars */
.progress-container {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary), var(--info));
  transition: width var(--transition-slow);
}

/* Modal Overlay styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  animation: fadeIn var(--transition-fast);
}

.modal-content {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  animation: slideUp var(--transition-normal);
}

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

.modal-title {
  font-size: 20px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}

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

/* Keyframes */
@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Landing Page Grid */
.landing-hero {
  text-align: center;
  padding: 100px 20px;
  background: radial-gradient(circle at 50% 50%, rgba(30, 58, 138, 0.08) 0%, transparent 60%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.landing-tagline {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.landing-title {
  font-size: 54px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.1;
  max-width: 800px;
}

@media (max-width: 768px) {
  .landing-title {
    font-size: 36px;
  }
}

.landing-desc {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.6;
}

/* Challan Voucher Visual style */
.challan-voucher {
  background: white;
  color: black;
  font-family: 'Courier New', Courier, monospace;
  padding: 30px;
  border: 2px dashed #000;
  border-radius: 4px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-md);
}

.challan-voucher h2 {
  font-size: 16px;
  text-align: center;
  font-family: inherit;
  font-weight: bold;
}

.challan-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 8px;
}

.challan-row {
  display: flex;
  justify-content: space-between;
}

.challan-row.bold {
  font-weight: bold;
  font-size: 14px;
  border-top: 2px double #000;
  border-bottom: 2px double #000;
  padding: 4px 0;
  margin-top: 8px;
}
