﻿/**
 * NIRVAH Financial Platform - User Dashboard CSS
 * Module 7: User Portal Layout, Sidebar, Timeline, Cards
 */

/* ============================================================
   USER PORTAL LAYOUT
   ============================================================ */

.user-portal-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - var(--header-height));
  background-color: var(--background);
  align-items: start;
}

.user-portal-content {
  padding: var(--space-8);
  min-width: 0; /* prevent overflow in grid */
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.user-sidebar {
  width: 260px;
  background-color: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  overflow-y: auto;
}

.user-sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--primary-green), var(--dark-green));
}

.user-avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0;
}

.user-sidebar-info {
  min-width: 0;
  flex: 1;
}

.user-sidebar-name {
  color: #fff;
  font-size: var(--font-size-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-sidebar-email {
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--font-size-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Nav Links */
.user-sidebar-nav {
  flex: 1;
  padding: var(--space-3) 0;
}

.user-sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  color: var(--text);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  position: relative;
}

.user-sidebar-link:hover {
  background-color: var(--primary-green-light);
  color: var(--primary-green);
}

.user-sidebar-link.active {
  background-color: var(--primary-green-light);
  color: var(--primary-green);
  border-left-color: var(--primary-green);
  font-weight: 600;
}

.user-sidebar-logout {
  color: var(--danger) !important;
}

.user-sidebar-logout:hover {
  background-color: var(--danger-light) !important;
  color: var(--danger) !important;
}

.usn-icon {
  font-size: 1.1rem;
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.usn-label {
  flex: 1;
}

.usn-badge {
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

/* Sidebar Footer */
.user-sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
}

/* ============================================================
   DASHBOARD PAGE HEADER
   ============================================================ */

.dashboard-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.dashboard-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark-green);
  margin: 0 0 var(--space-1) 0;
}

.dashboard-page-subtitle {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0;
}

/* ============================================================
   STAT CARDS
   ============================================================ */

.stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

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

.stat-card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  margin-bottom: var(--space-1);
}

.stat-card-icon.green  { background: var(--primary-green-light); color: var(--primary-green); }
.stat-card-icon.gold   { background: var(--gold-light);          color: var(--gold); }
.stat-card-icon.info   { background: var(--info-light);          color: var(--info); }
.stat-card-icon.danger { background: var(--danger-light);        color: var(--danger); }

.stat-card-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.stat-card-value {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--dark-green);
  line-height: 1.2;
}

.stat-card-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ============================================================
   APPLICATION SUMMARY CARD
   ============================================================ */

.app-summary-card {
  background: linear-gradient(135deg, var(--dark-green), var(--primary-green));
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  color: #fff;
  margin-bottom: var(--space-6);
  position: relative;
  overflow: hidden;
}

.app-summary-card::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 160px;
  height: 160px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}

.app-summary-card::after {
  content: '';
  position: absolute;
  bottom: -50px;
  right: 60px;
  width: 240px;
  height: 240px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 50%;
}

.app-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  position: relative;
  z-index: 1;
}

.app-summary-item-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  margin-bottom: var(--space-1);
}

.app-summary-item-value {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.app-summary-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 9999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.app-summary-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--light-gold);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ============================================================
   TIMELINE
   ============================================================ */

.timeline {
  position: relative;
  padding: 0;
  list-style: none;
  margin: 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  display: flex;
  gap: var(--space-4);
  padding-bottom: var(--space-6);
  position: relative;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
  z-index: 1;
  position: relative;
  border: 2px solid transparent;
  font-family: 'Material Symbols Outlined';
}

.timeline-dot.completed  {
  background: var(--success-light);
  color: var(--success);
  border-color: var(--success);
}

.timeline-dot.current {
  background: var(--primary-green);
  color: #fff;
  border-color: var(--primary-green);
  box-shadow: 0 0 0 4px rgba(11, 93, 42, 0.15);
  animation: pulse-ring 2.5s infinite;
}

.timeline-dot.pending {
  background: var(--white);
  color: var(--muted);
  border-color: var(--border);
}

.timeline-dot.rejected {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0px rgba(11, 93, 42, 0.3); }
  100% { box-shadow: 0 0 0 8px rgba(11, 93, 42, 0); }
}

.timeline-body {
  flex: 1;
  padding-top: 8px;
}

.timeline-title {
  font-weight: 600;
  font-size: 0.925rem;
  color: var(--dark-green);
  margin: 0 0 var(--space-1) 0;
}

.timeline-title.muted {
  color: var(--muted);
  font-weight: 500;
}

.timeline-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: var(--space-1);
}

.timeline-note {
  font-size: 0.8rem;
  color: var(--text);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  margin-top: var(--space-2);
  font-style: italic;
}

/* ============================================================
   NOTIFICATION ITEMS
   ============================================================ */

.notification-item {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.notification-item:hover {
  background: var(--background);
}

.notification-item.unread {
  background: var(--primary-green-light);
}

.notification-item.unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary-green);
}

.notification-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.notification-icon.success { background: var(--success-light); color: var(--success); }
.notification-icon.warning { background: var(--warning-light); color: var(--warning); }
.notification-icon.info    { background: var(--info-light);    color: var(--info); }
.notification-icon.danger  { background: var(--danger-light);  color: var(--danger); }

.notification-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--dark-green);
  margin-bottom: 2px;
}

.notification-message {
  font-size: 0.825rem;
  color: var(--muted);
  line-height: 1.5;
}

.notification-time {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  margin-top: 2px;
}

/* ============================================================
   PROFILE FORM ENHANCEMENTS
   ============================================================ */

.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-6);
  background: linear-gradient(135deg, var(--dark-green), var(--primary-green));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 3px solid rgba(255,255,255,0.5);
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
}

.profile-avatar-name {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.profile-avatar-since {
  color: rgba(255,255,255,0.7);
  font-size: var(--font-size-xs);
}

/* ============================================================
   QUICK ACTIONS GRID
   ============================================================ */

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.quick-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-xs);
}

.quick-action-card:hover {
  border-color: var(--primary-green);
  background: var(--primary-green-light);
  color: var(--primary-green);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.quick-action-icon {
  font-size: 1.75rem;
}

/* ============================================================
   MOBILE SIDEBAR TOGGLE
   ============================================================ */

.user-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  width: 50px;
  height: 50px;
  background: var(--primary-green);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  z-index: 100;
  box-shadow: var(--shadow-md);
  align-items: center;
  justify-content: center;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
  .stat-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .app-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .user-portal-layout {
    grid-template-columns: 1fr;
  }

  .user-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    width: 100%;
    max-width: 280px;
    box-shadow: var(--shadow-lg);
  }

  .user-sidebar.open {
    display: flex;
  }

  .user-sidebar-toggle {
    display: flex;
  }

  .user-portal-content {
    padding: var(--space-4);
  }

  .stat-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  .app-summary-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .dashboard-page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .stat-cards-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Material Symbols Icon Font Support */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined', sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: inherit;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  vertical-align: middle;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
