:root {
  --background-color: #f7f7fb;
  --surface-color: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 14px;
  --transition: all 0.2s ease;
}

/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.6;
}

/* ===== LAYOUT COMPONENTS ===== */
.dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr;
}

.header {
  grid-area: header;
  padding: 32px;
  padding-bottom: 0;
  display: flex;
  align-items: center;
}

.sidebar {
  width: 280px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  padding: 2rem 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: fixed;
  height: 100vh;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.sidebar.hidden {
  transform: translateX(-100%);
}
.visible {
  display: block;
}

.main-content {
  display: flex;
  width: 100%;
  gap: 32px;
  grid-area: main;
  padding: 32px;
  overflow-y: auto;
}

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

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #667eea;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background 0.3s ease;
}

.menu-toggle:hover {
  background: rgba(102, 126, 234, 0.1);
}
.logo {
  padding: 0 2rem 2rem;
}

.logo h2 {
  color: #2563eb;
  font-weight: 700;
  font-size: 1.5rem;
}

.separator {
  display: block;
  width: 80%;
  height: 1px;
  border-bottom: 1px solid #0d163a;
  padding: 16px;
  margin-bottom: 32px;
  opacity: 30%;
  margin-left: 30px;
}

.nav {
  height: 100%;
}
.nav-menu {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  list-style: none;
}

.nav-item {
  margin-bottom: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 2rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.nav-link:hover,
.nav-link.active {
  background-color: var(--background-color);
  color: #2563eb;
  border-left-color: #2563eb;
}

.nav-icon {
  width: 24px;
  height: 24px;
  margin-right: 0.75rem;
}

/* ===== HEADER STYLES ===== */

.header-actions {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.search-container {
  position: relative;
  flex: 1;
}

.search-input {
  width: 100%;
  height: 64px;
  padding: 13px 20px 13px 46px;
  border: none;
  border-radius: 100px;
  background: var(--surface-color);
  font-size: 0.875rem;
  transition: var(--transition);
  font-size: 1rem;
  line-height: 24px;
  font-weight: 400;
}

.search-input:focus {
  outline: 1px solid #2563eb;
  border: none;
  box-shadow: none;
}

.search-icon {
  position: absolute;
  left: 20px;
  top: 49%;
  transform: translateY(-50%);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1e40af);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
}

/* ===== MAIN CONTENT STYLES ===== */
.dashboard-detail {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  background-color: var(--surface-color);
}
.dashboard-detail h1 {
  font-size: 20px;
  font-weight: 700;
}

.dashboard-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 24px;
}

.stat-card {
  background: var(--surface-color);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  background-color: #4745a4;
  color: white;
  transform: translateY(-2px);
}

.stat-card:hover .stat-title,
.stat-card:hover .stat-title2,
.stat-card:hover .stat-value {
  color: white;
}

.stat-header {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}
.stat-title-container {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.stat-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.stat-title2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  opacity: 60%;
}

.stat-icon svg {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
}

.stat-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
}
.chart-container {
  width: 100%;
  background: var(--surface-color);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.chart-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.filter-dropdown {
  position: relative;
}

.filter-select {
  padding: 0.5rem 2rem 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--surface-color);
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1rem;
}

.filter-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.chart-canvas {
  width: 100%;
  height: 400px;
}

.transactions-section {
  background: var(--surface-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.section-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--background-color);
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.transactions-list {
  padding: 1rem 0;
}

.transaction-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

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

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

.transaction-info {
  display: flex;
  align-items: center;
}

.transaction-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  font-weight: 600;
  font-size: 0.875rem;
}

.transaction-details h4 {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.transaction-details p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.transaction-amount {
  font-weight: 600;
  font-size: 1rem;
}

.amount-positive {
  color: #22c55e;
}

.amount-negative {
  color: #ef4444;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
  .dashboard {
    grid-template-areas:
      "header"
      "main";
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .search-input {
    width: 200px;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .header-actions {
    justify-content: space-between;
  }

  .search-input {
    width: 100%;
    max-width: 300px;
  }

  .main-content {
    padding: 1rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .chart-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .stat-value {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .header-title h1 {
    font-size: 1.5rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .chart-container {
    padding: 1rem;
  }

  .transaction-item {
    padding: 0.75rem 1rem;
  }

  .transaction-icon {
    width: 32px;
    height: 32px;
    margin-right: 0.75rem;
  }
}

/* ===== LOADING STATES ===== */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  border-top-color: #2563eb;
  animation: spin 1s ease-in-out infinite;
}

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

/* ===== UTILITY CLASSES ===== */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}
.mt-1 {
  margin-top: 3px;
}
.mb-0 {
  margin-bottom: 0;
}
.mb-1 {
  margin-bottom: 0.5rem;
}
.mb-2 {
  margin-bottom: 1rem;
}
.w-100 {
  width: 100%;
}

.flex {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.user-info {
  display: flex;
  gap: 10px;
  width: 350px;
  background-color: var(--surface-color);
  border-radius: 100px;
  padding: 8px;
  height: 64px;
  align-items: center;
}
.user-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 1px solid #dedede;
  border-radius: 100px;
  width: 66px;
  cursor: pointer;
}

.right-stat {
  width: 347px;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  padding: 16px;
  background-color: var(--surface-color);
}

.right-stat-header {
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(13, 22, 58, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.right-stat-header h1 {
  font-size: 20px;
  font-weight: 700;
}
.right-stat-header span {
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  color: #4745a4;
  cursor: pointer;
}
.right-stat-container {
  display: flex;
  flex-direction: column;
  gap: 25px;
  margin-top: 20px;
}
.right-stat-item {
  width: 100%;
  display: flex;
  gap: 8px;
  padding: 4px;
}
.right-stat-item img {
  width: 48px;
  height: 48px;
  border-radius: 100%;
}
.right-stat-item div {
  width: 100%;
  display: flex;
  justify-content: space-between;
}
.right-stat-item span {
  display: flex;
  flex-direction: column;
}
.right-stat-item h1 {
  font-size: 18px;
  font-weight: 600;
}
.right-stat-item p {
  font-size: 12px;
  font-weight: 600;
  color: rgba(13, 22, 58, 0.5);
}
.right-stat-item h2 {
  font-size: 12px;
  font-weight: 600;
  color: rgba(59, 187, 110, 1);
}
.progress-container {
  width: 100%;
  background-color: #e0e0e0;
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}
.progress-bar {
  height: 100%;
  background-color: #4caf50;
  width: 0;
  transition: width 0.3s ease-in-out;
}
.right-stat-saving-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.right-stat-saving-item div {
  display: flex;
  justify-content: space-between;
}

.right-stat-saving-item h1 {
  font-size: 16px;
  font-weight: 500;
}
.right-stat-saving-item h2 {
  font-size: 12px;
  font-weight: 400;
}
.right-stat-saving-item h3 {
  font-size: 20px;
  font-weight: 600;
}
.right-stat-saving-item h4 {
  font-size: 18px;
  font-weight: 600;
}
.right-stat-saving-item span {
  font-size: 12px;
  font-weight: 600;
  color: rgba(13, 22, 58, 0.5);
}

/* ===== MOBILE MENU STYLES ===== */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.visible {
    transform: translateX(0);
  }
  .menu-toggle {
    display: block;
  }
  .header {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .header-left {
    justify-content: space-between;
    width: 100%;
  }

  .header-title h1 {
    font-size: 1.5rem;
  }

  .header-actions {
    justify-content: space-between;
  }

  .search-input {
    width: 100%;
    max-width: 300px;
  }
}

/* ===== LOADING ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card {
  animation: fadeInUp 0.6s ease forwards;
}

.stat-card:nth-child(1) {
  animation-delay: 0.1s;
}
.stat-card:nth-child(2) {
  animation-delay: 0.2s;
}
.stat-card:nth-child(3) {
  animation-delay: 0.3s;
}
.stat-card:nth-child(4) {
  animation-delay: 0.4s;
}

/* ===== ENHANCED HOVER EFFECTS ===== */
.transaction-item {
  cursor: pointer;
}

.transaction-item:active {
  transform: scale(0.98);
}

/* ===== FOCUS STYLES ===== */
.nav-link:focus,
.filter-select:focus {
  outline: 1px solid #2563eb;
}

/* ===== PRINT STYLES ===== */
@media (max-width: 480px) {
  .sidebar {
    width: 100%;
  }
}
@media print {
  .sidebar,
  .header {
    display: none;
  }

  .main-content {
    grid-area: auto;
    padding: 0;
  }

  .stat-card,
  .chart-container,
  .transactions-section {
    box-shadow: none;
    border: 1px solid var(--border-color);
  }
}
