/*
  ISP CRM Modern Design System
  Enterprise-grade SaaS UI with professional ISP aesthetics
  Version: 2.0
*/

/* ========================================
   1. DESIGN TOKENS & CSS VARIABLES
======================================== */

:root {
  /* Typography */
  --font-primary: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Fira Code", "Courier New", monospace;
  
  /* Colors - Light Theme */
  --color-primary: #6366f1;
  --color-primary-dark: #4f46e5;
  --color-primary-light: #818cf8;
  --color-secondary: #7c3aed;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #3b82f6;
  
  /* Neutrals */
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;
  
  /* Semantic Colors */
  --bg-body: #f6f7fb;
  --bg-surface: #ffffff;
  --bg-surface-hover: #fafbff;
  --bg-elevated: #ffffff;
  
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --text-on-primary: #ffffff;
  
  --border-color: rgba(15, 23, 42, 0.08);
  --border-color-strong: rgba(15, 23, 42, 0.12);
  
  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 4px 12px rgba(2, 6, 23, 0.06);
  --shadow-md: 0 10px 30px rgba(2, 6, 23, 0.08);
  --shadow-lg: 0 20px 50px rgba(2, 6, 23, 0.12);
  --shadow-xl: 0 30px 80px rgba(2, 6, 23, 0.20);
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
  --space-4xl: 64px;
  
  /* Transitions */
  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   2. BASE STYLES & RESETS
======================================== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
}

/* ========================================
   3. TYPOGRAPHY
======================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

h1 { font-size: 2.25rem; } /* 36px */
h2 { font-size: 1.875rem; } /* 30px */
h3 { font-size: 1.5rem; } /* 24px */
h4 { font-size: 1.25rem; } /* 20px */
h5 { font-size: 1rem; } /* 16px */
h6 { font-size: 0.875rem; } /* 14px */

p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

/* ========================================
   4. LAYOUT SYSTEM
======================================== */

.container-fluid {
  padding: var(--space-xl);
  max-width: 100%;
}

.page-header {
  margin-bottom: var(--space-2xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: 0;
}

.page-title i {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: white;
  border-radius: var(--radius-lg);
  font-size: 1.1rem;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: var(--space-xs);
}

.page-actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
.grid-cols-6 { grid-template-columns: repeat(6, 1fr); }
.grid-cols-12 { grid-template-columns: repeat(12, 1fr); }

.col-span-1 { grid-column: span 1; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }
.col-span-5 { grid-column: span 5; }
.col-span-6 { grid-column: span 6; }
.col-span-7 { grid-column: span 7; }
.col-span-8 { grid-column: span 8; }
.col-span-9 { grid-column: span 9; }
.col-span-10 { grid-column: span 10; }
.col-span-11 { grid-column: span 11; }
.col-span-12 { grid-column: span 12; }

/* ========================================
   5. MODERN CARD COMPONENT
======================================== */

.card-modern {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--transition-base);
}

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

.card-modern.card-flat {
  box-shadow: none;
  border: 1px solid var(--border-color);
}

.card-modern.card-flat:hover {
  box-shadow: var(--shadow-sm);
}

.card-header-modern {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

.card-title-modern {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0;
}

.card-title-modern i {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-gray-100);
  color: var(--color-primary);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}

.card-body-modern {
  padding: var(--space-lg);
}

.card-footer-modern {
  padding: var(--space-lg);
  border-top: 1px solid var(--border-color);
  background: var(--color-gray-50);
}

/* ========================================
   6. STAT CARDS / KPI CARDS
======================================== */

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

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

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  font-size: 1.3rem;
  color: white;
  flex-shrink: 0;
}

.stat-card-icon.primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
}

.stat-card-icon.success {
  background: linear-gradient(135deg, #10b981 0%, #22c55e 100%);
}

.stat-card-icon.warning {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
}

.stat-card-icon.danger {
  background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
}

.stat-card-icon.info {
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
}

.stat-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.stat-card-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin: 0;
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1;
  margin: 0;
}

.stat-card-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-full);
}

.stat-card-change.positive {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.stat-card-change.negative {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
}

/* ========================================
   7. MODERN BUTTONS
======================================== */

.btn-modern {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-modern i {
  font-size: 1rem;
}

/* Primary Button */
.btn-modern.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-modern.btn-primary:hover {
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
  transform: translateY(-2px);
}

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

/* Secondary Button */
.btn-modern.btn-secondary {
  background: var(--color-gray-100);
  color: var(--text-primary);
}

.btn-modern.btn-secondary:hover {
  background: var(--color-gray-200);
}

/* Outline Button */
.btn-modern.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-color-strong);
  color: var(--text-primary);
}

.btn-modern.btn-outline:hover {
  background: var(--color-gray-100);
  border-color: var(--color-gray-300);
}

/* Success, Warning, Danger */
.btn-modern.btn-success {
  background: var(--color-success);
  color: white;
}

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

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

/* Button Sizes */
.btn-modern.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-modern.btn-lg {
  padding: 14px 24px;
  font-size: 1rem;
}

/* ========================================
   8. MODERN FORM INPUTS
======================================== */

.form-group-modern {
  margin-bottom: var(--space-lg);
}

.form-label-modern {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.form-label-modern .required {
  color: var(--color-danger);
  margin-left: 2px;
}

.form-input-modern {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: var(--font-primary);
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: all var(--transition-fast);
}

.form-input-modern:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

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

/* Input with icon */
.input-group-modern {
  position: relative;
}

.input-group-modern i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.input-group-modern .form-input-modern {
  padding-left: 42px;
}

.form-select-modern {
  width: 100%;
  padding: 10px 38px 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: var(--font-primary);
  color: var(--text-primary);
  background: var(--bg-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  appearance: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.form-select-modern:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

/* ========================================
   9. MODERN TABLE
======================================== */

.table-container-modern {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-modern {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table-modern thead {
  background: var(--color-gray-50);
  border-bottom: 2px solid var(--border-color);
}

.table-modern thead th {
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.table-modern tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}

.table-modern tbody tr:hover {
  background: var(--bg-surface-hover);
}

.table-modern tbody td {
  padding: var(--space-md) var(--space-lg);
  color: var(--text-primary);
  vertical-align: middle;
}

/* ========================================
   10. BADGES & PILLS
======================================== */

.badge-modern {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-modern.badge-primary {
  background: rgba(99, 102, 241, 0.12);
  color: var(--color-primary-dark);
}

.badge-modern.badge-success {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.badge-modern.badge-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.badge-modern.badge-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.badge-modern.badge-info {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.badge-modern.badge-gray {
  background: var(--color-gray-100);
  color: var(--color-gray-700);
}

/* ========================================
   11. CHART CONTAINER
======================================== */

.chart-container-modern {
  position: relative;
  width: 100%;
  height: 300px;
  padding: var(--space-md);
}

.chart-container-modern canvas {
  max-width: 100%;
  max-height: 100%;
}

/* ========================================
   12. UTILITY CLASSES
======================================== */

/* Spacing */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--space-xs) !important; }
.mb-2 { margin-bottom: var(--space-sm) !important; }
.mb-3 { margin-bottom: var(--space-md) !important; }
.mb-4 { margin-bottom: var(--space-lg) !important; }
.mb-5 { margin-bottom: var(--space-xl) !important; }
.mb-6 { margin-bottom: var(--space-2xl) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--space-xs) !important; }
.mt-2 { margin-top: var(--space-sm) !important; }
.mt-3 { margin-top: var(--space-md) !important; }
.mt-4 { margin-top: var(--space-lg) !important; }
.mt-5 { margin-top: var(--space-xl) !important; }
.mt-6 { margin-top: var(--space-2xl) !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: var(--space-xs) !important; }
.p-2 { padding: var(--space-sm) !important; }
.p-3 { padding: var(--space-md) !important; }
.p-4 { padding: var(--space-lg) !important; }
.p-5 { padding: var(--space-xl) !important; }
.p-6 { padding: var(--space-2xl) !important; }

/* Text Alignment */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* Font Weight */
.font-normal { font-weight: 400 !important; }
.font-medium { font-weight: 500 !important; }
.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }
.font-extrabold { font-weight: 800 !important; }

/* Text Colors */
.text-primary { color: var(--color-primary) !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-info { color: var(--color-info) !important; }
.text-muted { color: var(--text-secondary) !important; }

/* Display */
.flex { display: flex !important; }
.inline-flex { display: inline-flex !important; }
.grid { display: grid !important; }
.hidden { display: none !important; }

/* Flex utilities */
.items-center { align-items: center !important; }
.items-start { align-items: flex-start !important; }
.items-end { align-items: flex-end !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }
.flex-wrap { flex-wrap: wrap !important; }
.gap-1 { gap: var(--space-xs) !important; }
.gap-2 { gap: var(--space-sm) !important; }
.gap-3 { gap: var(--space-md) !important; }
.gap-4 { gap: var(--space-lg) !important; }

/* Responsive */
@media (max-width: 1200px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-6 { grid-template-columns: repeat(3, 1fr); }
  .grid-cols-12 { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 768px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4, .grid-cols-6 {
    grid-template-columns: 1fr;
  }
  .grid-cols-12 { grid-template-columns: repeat(2, 1fr); }
  .col-span-2, .col-span-3, .col-span-4, .col-span-5, .col-span-6,
  .col-span-7, .col-span-8, .col-span-9, .col-span-10, .col-span-11, .col-span-12 {
    grid-column: span 1;
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .container-fluid {
    padding: var(--space-lg);
  }
}

/* ========================================
   13. LOADING & ANIMATIONS
======================================== */

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-gray-200);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

/* ========================================
   14. ALERTS & NOTIFICATIONS
======================================== */

.alert-modern {
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.alert-modern i {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-modern.alert-success {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
  color: #065f46;
}

.alert-modern.alert-warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
  color: #92400e;
}

.alert-modern.alert-danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: #991b1b;
}

.alert-modern.alert-info {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
  color: #1e40af;
}

/* ========================================
   Signup Requests Page Animations
======================================== */

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

.is-animate {
  animation: slideInDown 0.3s ease;
}

/* Table row hover effect */
tbody tr {
  transition: background-color 0.2s ease, box-shadow 0.2s ease !important;
}

tbody tr:hover {
  background-color: rgba(99, 102, 241, 0.04) !important;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.08);
}

/* Stat card animations */
.stat-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(2, 6, 23, 0.12) !important;
}
