/* Finance Bridge Dashboard - Custom Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --mpesa-green: #823b7d;
  --mpesa-green-dark: #6e316a;
  --sidebar-bg: #1e2433;
  --sidebar-hover: #2a3142;
  --sidebar-active: #00BE13;
  --body-bg: #f5f7fa;
  --card-bg: #ffffff;
  --text-primary: #1e2433;
  --text-muted: #6c7a8a;
  --border-color: #e2e8f0;
}

* {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--body-bg);
  color: var(--text-primary);
}

/* Sidebar Styles */
.sidebar {
  background-color: var(--sidebar-bg);
  min-height: 100vh;
  width: 260px;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: var(--mpesa-green);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
}

.sidebar-brand-text {
  color: white;
}

.sidebar-brand-text h6 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.sidebar-brand-text small {
  color: rgba(255,255,255,0.6);
  font-size: 0.75rem;
}

.sidebar-nav {
  padding: 1rem;
}

.sidebar-nav .nav-link {
  color: rgba(255,255,255,0.7);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.15s ease;
  font-size: 0.875rem;
  font-weight: 500;
}

.sidebar-nav .nav-link:hover {
  background-color: var(--sidebar-hover);
  color: white;
}

.sidebar-nav .nav-link.active {
  background-color: var(--mpesa-green);
  color: white;
}

.sidebar-nav .nav-link i {
  width: 20px;
  text-align: center;
}

.sidebar-user {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user .user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.sidebar-user .user-avatar {
  width: 36px;
  height: 36px;
  background: var(--sidebar-hover);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 500;
  font-size: 0.875rem;
}

.sidebar-user .user-details {
  flex: 1;
  min-width: 0;
}

.sidebar-user .user-name {
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-email {
  color: rgba(255,255,255,0.6);
  font-size: 0.75rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .btn-logout {
  width: 100%;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  text-align: left;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.sidebar-user .btn-logout:hover {
  background: var(--sidebar-hover);
  color: white;
}

/* Main Content */
.main-content {
  margin-left: 260px;
  min-height: 100vh;
}

.top-header {
  background: white;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-header .sync-status {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.content-wrapper {
  padding: 1.5rem;
}

/* Page Header */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.page-header p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.875rem;
}

/* Metric Cards */
.metric-card {
  background: white;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  transition: box-shadow 0.2s ease;
}

.metric-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.07);
}

.metric-card .metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.metric-card .metric-icon.success {
  background: rgba(0, 190, 19, 0.1);
  color: var(--mpesa-green);
}

.metric-card .metric-icon.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.metric-card .metric-icon.info {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.metric-card .metric-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.5rem;
}

.metric-card .metric-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.metric-card .metric-trend {
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

.metric-card .metric-trend.positive {
  color: var(--mpesa-green);
}

.metric-card .metric-trend.negative {
  color: #ef4444;
}

/* Data Tables */
.data-card {
  background: white;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.data-card .card-header {
  background: white;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
}

.data-card .card-header h5 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.data-table {
  margin: 0;
}

.data-table thead th {
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.data-table tbody td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table .mono {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  font-size: 0.8125rem;
}

/* Status Badges */
.badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.badge-fetched {
  background: rgba(0, 190, 19, 0.15);
  color: #00891a;
}

.badge-deleted {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-http-2xx {
  background: rgba(0, 190, 19, 0.15);
  color: #00891a;
}

.badge-http-4xx {
  background: #fef3c7;
  color: #92400e;
}

.badge-http-5xx {
  background: #fee2e2;
  color: #b91c1c;
}

/* Activity List */
.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.activity-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.activity-list li:last-child {
  border-bottom: none;
}

.activity-list .activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.75rem;
}

.activity-list .activity-dot.success { background: var(--mpesa-green); }
.activity-list .activity-dot.warning { background: #f59e0b; }
.activity-list .activity-dot.info { background: #3b82f6; }

.activity-list .activity-text {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.activity-list .activity-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Chart Card */
.chart-card {
  background: white;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  padding: 1.5rem;
}

.chart-card h5 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.chart-card .chart-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Login Page */
.login-wrapper {
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-brand-icon {
  width: 64px;
  height: 64px;
  background: var(--mpesa-green);
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.login-brand h1 {
  color: white;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.login-brand p {
  color: rgba(255,255,255,0.7);
  font-size: 0.875rem;
}

.login-form-card {
  background: white;
  border-radius: 0.75rem;
  padding: 2rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

.login-form-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.login-form .form-label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.login-form .form-control {
  padding: 0.625rem 0.75rem 0.625rem 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
}

.login-form .form-control:focus {
  border-color: var(--mpesa-green);
  box-shadow: 0 0 0 3px rgba(0, 190, 19, 0.15);
}

.login-form .input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.btn-mpesa {
  background: var(--mpesa-green);
  border-color: var(--mpesa-green);
  color: white;
  font-weight: 500;
  padding: 0.625rem 1rem;
}

.btn-mpesa:hover {
  background: var(--mpesa-green-dark);
  border-color: var(--mpesa-green-dark);
  color: white;
}

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  color: rgba(255,255,255,0.5);
  font-size: 0.75rem;
}

/* Search Input */
.search-input {
  position: relative;
}

.search-input .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input input {
  padding-left: 2.5rem;
}

/* Mobile Toggle */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
}

/* Responsive */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .mobile-toggle {
    display: block;
  }
  
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
  }
  
  .sidebar-overlay.show {
    display: block;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}
