/**
 * Dashboard Common Styles
 * Defensive IT compliant - No external dependencies
 * 
 * @author Alan Axford
 * @version 1.0
 */

/* ==========================================
   CSS VARIABLES (Design Tokens)
   ========================================== */
:root {
  /* Primary Colors */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;

  /* Status Colors */
  --success-50: #f0fdf4;
  --success-500: #22c55e;
  --success-600: #16a34a;
  --danger-50: #fef2f2;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --amber-50: #fffbeb;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --purple-50: #faf5ff;
  --purple-500: #a855f7;
  --purple-600: #9333ea;
  --teal-50: #f0fdfa;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --pink-50: #fdf2f8;
  --pink-500: #ec4899;
  --pink-600: #db2777;

  /* Neutral Colors */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Typography - System font stack (no external dependencies) */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono",
    Consolas, "Liberation Mono", Menlo, Monaco, monospace;

  /* Shadows */
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),
    0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Border Radius */
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

/* ==========================================
   BASE STYLES
   ========================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: linear-gradient(
    135deg,
    var(--slate-100) 0%,
    var(--slate-50) 100%
  );
  color: var(--slate-800);
  line-height: 1.6;
  min-height: 100vh;
}

/* ==========================================
   HEADER STYLES
   ========================================== */
.app-header {
  background: linear-gradient(
    135deg,
    var(--primary-700) 0%,
    var(--primary-600) 100%
  );
  color: white;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.back-btn {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateX(-2px);
}

.back-btn svg {
  width: 20px;
  height: 20px;
  stroke: white;
  stroke-width: 2;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-logo-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.app-logo h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-logo span {
  font-size: 12px;
  opacity: 0.8;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
}

.header-title h1 {
  font-size: 18px;
  font-weight: 700;
}

.header-title span {
  font-size: 12px;
  opacity: 0.8;
}

.header-actions,
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==========================================
   BUTTON STYLES
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.btn-white {
  background: white;
  color: var(--primary-600);
}

.btn-white:hover {
  background: var(--primary-50);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: white;
  color: var(--slate-700);
  border: 1px solid var(--slate-300);
}

.btn-secondary:hover {
  background: var(--slate-50);
}

.btn-success {
  background: var(--success-500);
  color: white;
}

.btn-success:hover {
  background: var(--success-600);
}

.btn-danger {
  background: var(--danger-500);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-600);
}

.btn-ghost {
  background: transparent;
  color: var(--slate-600);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: var(--slate-100);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px;
}

.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 16px;
  color: var(--slate-600);
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 20px;
}

/* ==========================================
   MODULE GRID & CARDS
   ========================================== */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.module-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--slate-200);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.module-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.module-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: transparent;
}

.module-content {
  padding: 24px;
}

.module-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.module-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.module-title-section {
  flex: 1;
}

.module-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 4px;
}

.module-description {
  font-size: 13px;
  color: var(--slate-600);
  line-height: 1.5;
}

.module-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.module-stat {
  flex: 1;
}

.module-stat-value {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--slate-800);
  line-height: 1;
}

.module-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
  margin-top: 4px;
}

.module-footer {
  padding: 16px 24px;
  background: var(--slate-50);
  border-top: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.module-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
  transition: all 0.2s;
}

.module-link svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  transition: transform 0.2s;
}

.module-card:hover .module-link svg {
  transform: translateX(4px);
}

.module-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.module-badge.success {
  background: var(--success-50);
  color: var(--success-600);
}

.module-badge.warning {
  background: var(--warning-50);
  color: var(--warning-600);
}

.module-badge.active {
  background: var(--primary-50);
  color: var(--primary-600);
}

/* ==========================================
   STATS ROW
   ========================================== */
.stats-row {
  display: flex;
  gap: 20px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 200px;
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--slate-200);
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--slate-900);
  line-height: 1;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  margin-top: 8px;
}

.stat-change.positive {
  color: var(--success-600);
}

.stat-change.negative {
  color: var(--danger-600);
}

/* ==========================================
   LOADING & EMPTY STATES
   ========================================== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--slate-200);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-state {
  text-align: center;
  padding: 60px 40px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 8px;
}

.empty-text {
  color: var(--slate-500);
  margin-bottom: 20px;
}

/* ==========================================
   ANIMATIONS
   ========================================== */
.animate-in {
  animation: slideInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger animation delays */
.animate-in:nth-child(1) {
  animation-delay: 0.1s;
}
.animate-in:nth-child(2) {
  animation-delay: 0.2s;
}
.animate-in:nth-child(3) {
  animation-delay: 0.3s;
}
.animate-in:nth-child(4) {
  animation-delay: 0.4s;
}
.animate-in:nth-child(5) {
  animation-delay: 0.5s;
}
.animate-in:nth-child(6) {
  animation-delay: 0.6s;
}

/* ==========================================
   UTILITIES
   ========================================== */
.text-center {
  text-align: center;
}

.mb-32 {
  margin-bottom: 32px;
}

.mt-32 {
  margin-top: 32px;
}
