/* IDF App-First UI Design System */

/* Mobile-First Typography - Narrow, Readable Fonts */
@import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@300;400;500;600;700&family=Bebas+Neue&family=Oswald:wght@300;400;500;600;700&family=Barlow+Condensed:wght@300;400;500;600;700;800&display=swap');

/* App Design System Variables */
:root {
  /* Mobile-First Font Stack */
  --font-primary: 'Barlow Condensed', 'Roboto Condensed', -apple-system, system-ui, sans-serif;
  --font-heading: 'Oswald', 'Bebas Neue', sans-serif;
  --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  
  /* App Color Palette - Kenyan Flag Inspired */
  --app-black: #0F0F0F;
  --app-green: #00A651;
  --app-red: #CE1126;
  --app-gold: #FFC727;
  --app-white: #FFFFFF;
  
  /* Functional Colors */
  --primary: var(--app-green);
  --secondary: var(--app-gold);
  --danger: var(--app-red);
  --dark: var(--app-black);
  --light: #F7F8FA;
  --gray: #6B7280;
  
  /* App Spacing - Compact for Mobile */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  
  /* Border Radius - Modern App Feel */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Shadows - Subtle Depth */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-xl: 0 8px 32px rgba(0,0,0,0.16);
  
  /* App Layout */
  --header-height: 56px;
  --bottom-nav-height: 64px;
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0);
}

/* Global App Styles */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-primary);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.3px;
  color: var(--dark);
  background: var(--light);
  overscroll-behavior: contain;
}

/* Typography - Optimized for Mobile */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }
h5 { font-size: 16px; }
h6 { font-size: 14px; }

p {
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  padding-top: var(--header-height);
  padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-inset-bottom));
}

/* App Header - Fixed Top */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--app-white);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
}

/* Bottom Navigation - App Style */
.app-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-height) + var(--safe-area-inset-bottom));
  padding-bottom: var(--safe-area-inset-bottom);
  background: var(--app-white);
  border-top: 1px solid rgba(0,0,0,0.08);
  z-index: 100;
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.app-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
  color: var(--gray);
  text-decoration: none;
  transition: all 0.2s;
}

.app-nav-item.active {
  color: var(--primary);
}

.app-nav-item i {
  font-size: 20px;
  margin-bottom: 4px;
}

.app-nav-item span {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Action Tiles - Core App Component */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: var(--space-md);
  padding: var(--space-lg);
}

.tile {
  background: var(--app-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}

.tile:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-xs);
}

.tile-icon {
  width: 32px;
  height: 32px;
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.tile-icon i {
  font-size: 18px;
}

.tile-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.tile-count {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--app-red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

/* Feature Tiles - Larger, More Prominent */
.feature-tile {
  background: var(--app-white);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: all 0.2s;
  cursor: pointer;
}

.feature-tile:active {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.feature-tile-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.feature-tile-content {
  flex: 1;
}

.feature-tile-title {
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.feature-tile-subtitle {
  font-size: 13px;
  color: var(--gray);
  line-height: 1.3;
}

.feature-tile-action {
  color: var(--gray);
  font-size: 20px;
}

/* Quick Stats - Compact Mobile Design */
.stat-row {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.stat-card {
  background: var(--app-white);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  min-width: 100px;
  flex: 1;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--gray);
  margin-top: 4px;
  letter-spacing: 0.5px;
}

/* App Buttons - Touch Optimized */
.btn-app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-lg);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-height: 44px;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn-app:active {
  transform: scale(0.97);
}

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

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

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

/* App Section Headers */
.section-header {
  padding: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-action {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  text-decoration: none;
}

/* App List Items */
.list-item {
  display: flex;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: var(--app-white);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  transition: background 0.2s;
}

.list-item:active {
  background: var(--light);
}

.list-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: var(--space-md);
  flex-shrink: 0;
}

.list-item-content {
  flex: 1;
}

.list-item-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 2px;
}

.list-item-subtitle {
  font-size: 13px;
  color: var(--gray);
}

.list-item-action {
  color: var(--gray);
}

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--safe-area-inset-bottom) + 16px);
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 90;
  transition: all 0.2s;
}

.fab:active {
  transform: scale(0.9);
}

.fab i {
  font-size: 24px;
}

/* App Cards - Compact Design */
.app-card {
  background: var(--app-white);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-sm);
}

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

.app-card-title {
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.app-card-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  background: var(--light);
  text-transform: uppercase;
}

/* Responsive Grid System */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 calc(var(--space-sm) * -1);
}

.col {
  flex: 1;
  padding: 0 var(--space-sm);
  min-width: 0;
}

/* Loading States */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Tablet Adjustments */
@media (min-width: 768px) {
  :root {
    --header-height: 64px;
    --bottom-nav-height: 0;
  }
  
  .app-bottom-nav {
    display: none;
  }
  
  .app-container {
    padding-bottom: 0;
  }
  
  .tile-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
  
  h1 { font-size: 32px; }
  h2 { font-size: 28px; }
  h3 { font-size: 24px; }
}

/* Desktop Adjustments */
@media (min-width: 1024px) {
  .app-container {
    max-width: 1200px;
    margin: 0 auto;
  }
  
  .tile-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --app-white: #1A1A1A;
    --light: #0F0F0F;
    --dark: #FFFFFF;
    --gray: #9CA3AF;
  }
  
  body {
    background: var(--light);
    color: var(--dark);
  }
}