/* ============================================
   Mini CRM - Mobile First Responsive Styles
   ============================================ */

/* Bootstrap Icons Utilities */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --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);
  --radius: 8px;
  --radius-lg: 12px;
}

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

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 80px; /* Space for bottom nav */
}

/* ============================================
   Layout
   ============================================ */

.app-header {
  background: var(--primary);
  color: white;
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.app-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* ============================================
   Bottom Navigation (Mobile)
   ============================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-around;
  padding: 0.5rem 0;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--gray-500);
  font-size: 0.75rem;
  padding: 0.25rem 1rem;
  transition: color 0.2s;
}

.bottom-nav a.active,
.bottom-nav a:hover {
  color: var(--primary);
}

.bottom-nav .icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

/* ============================================
   Cards
   ============================================ */

.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  overflow: hidden;
}

.card-header {
  padding: 1rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.card-body {
  padding: 1rem;
}

/* ============================================
   Stats Cards (Dashboard)
   ============================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: white;
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-card .label {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-card .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-800);
}

.stat-card.primary .value { color: var(--primary); }
.stat-card.success .value { color: var(--success); }
.stat-card.warning .value { color: var(--warning); }
.stat-card.danger .value { color: var(--danger); }

/* ============================================
   Lists
   ============================================ */

.list {
  list-style: none;
}

.list-item {
  background: white;
  padding: 1rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s;
}

.list-item:hover {
  background: var(--gray-50);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.list-item-badge {
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.list-item-badge.danger {
  background: var(--danger);
}

.list-item-badge.success {
  background: var(--success);
}

/* ============================================
   Forms
   ============================================ */

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 1rem;
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

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

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

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

.btn-secondary:hover {
  background: var(--gray-300);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-fab {
  position: fixed;
  bottom: 90px;
  right: 1rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 1.5rem;
  box-shadow: var(--shadow-md);
  z-index: 90;
}

.btn-fab:hover {
  transform: scale(1.05);
}

/* ============================================
   Search & Filters
   ============================================ */

.search-box {
  position: relative;
  margin-bottom: 1rem;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 1rem;
}

.search-box::before {
  content: "🔍";
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
}

/* ============================================
   Tabs
   ============================================ */

.tabs {
  display: flex;
  background: white;
  border-bottom: 1px solid var(--gray-200);
  overflow-x: auto;
}

.tab {
  flex: 1;
  padding: 1rem;
  text-align: center;
  text-decoration: none;
  color: var(--gray-500);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ============================================
   Status Badges
   ============================================ */

.status {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-completed {
  background: #d1fae5;
  color: #065f46;
}

.status-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-500);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* ============================================
   Detail View
   ============================================ */

.detail-section {
  margin-bottom: 1.5rem;
}

.detail-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  margin-bottom: 0.25rem;
}

.detail-value {
  font-size: 1rem;
  color: var(--gray-800);
  font-weight: 500;
}

.detail-value.large {
  font-size: 1.5rem;
  font-weight: 700;
}

/* ============================================
   Tablet & Desktop
   ============================================ */

@media (min-width: 768px) {
  body {
    padding-bottom: 0;
    padding-top: 60px;
  }

  .bottom-nav {
    display: none;
  }

  .app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .main-nav {
    display: flex;
    gap: 1.5rem;
  }

  .main-nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.2s;
  }

  .main-nav a:hover,
  .main-nav a.active {
    opacity: 1;
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .btn-fab {
    bottom: 2rem;
    right: 2rem;
  }

  .container {
    padding: 1.5rem;
  }
}

@media (max-width: 767px) {
  .main-nav {
    display: none;
  }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
  .bottom-nav,
  .btn-fab,
  .btn {
    display: none !important;
  }

  body {
    padding: 0;
    background: white;
  }
}
