/* DESIGN SYSTEM & CONSTANTS */
:root {
  --bg-color: #08090c;
  --bg-card: rgba(22, 26, 36, 0.5);
  --bg-card-hover: rgba(22, 26, 36, 0.7);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-glow: rgba(255, 255, 255, 0.15);
  
  /* Brand colors */
  --primary-glow: radial-gradient(circle at top left, rgba(82, 97, 238, 0.15), transparent);
  --accent-cake: linear-gradient(135deg, #ff4785, #ff7b00);
  --accent-topi: linear-gradient(135deg, #00c6ff, #0072ff);
  --accent-buff: linear-gradient(135deg, #00f2fe, #4facfe);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-highlight: #34d399; /* Emerald */
  
  /* Spacers & Radii */
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --font-family-title: 'Outfit', sans-serif;
  --font-family-body: 'Inter', sans-serif;
  
  --safe-top: env(safe-area-inset-top, 24px);
  --safe-bottom: env(safe-area-inset-bottom, 24px);
}

/* BASE STYLES */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family-body);
  overflow-x: hidden;
  height: 100vh;
  position: relative;
  background-image: 
    var(--primary-glow),
    radial-gradient(circle at bottom right, rgba(0, 242, 254, 0.05), transparent 60%);
  background-attachment: fixed;
}

/* Glassmorphism utility */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-glow);
}

.hidden {
  display: none !important;
}

/* SCREEN MANAGEMENT */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  z-index: 10;
  opacity: 1;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
}

/* PASSCODE SCREEN STYLING */
#passcode-screen {
  background-color: #07080a;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  padding: calc(var(--safe-top) + 20px) 24px calc(var(--safe-bottom) + 20px) 24px;
  z-index: 100;
}

.passcode-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 360px;
}

.app-brand {
  text-align: center;
  margin-bottom: 40px;
}

.app-icon-ring {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-lg);
  padding: 3px;
  background: linear-gradient(135deg, rgba(82, 97, 238, 0.4), rgba(0, 242, 254, 0.4));
  margin: 0 auto 20px auto;
  box-shadow: 0 10px 30px rgba(82, 97, 238, 0.3);
}

.pin-app-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-lg) - 3px);
}

.app-brand h1 {
  font-family: var(--font-family-title);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  background: linear-gradient(to right, #ffffff, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.passcode-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

/* Dot indicators */
.dots-container {
  display: flex;
  gap: 16px;
  margin-bottom: 50px;
  height: 16px;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dot.active {
  background-color: #34d399;
  border-color: #34d399;
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.6);
  transform: scale(1.2);
}

.dots-container.shake {
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

/* Pin Keypad */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px 24px;
  width: 100%;
  justify-items: center;
}

.key-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  font-family: var(--font-family-title);
  font-size: 28px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  backdrop-filter: blur(10px);
}

.key-btn:active {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(0.92);
}

.key-btn.secondary-btn {
  font-size: 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
}

.key-btn.secondary-btn:active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

/* SCREEN SLIDE ANIMATION */
.screen-slide-up {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

/* MAIN DASHBOARD STYLING */
#app-screen {
  padding: calc(var(--safe-top) + 12px) 20px calc(var(--safe-bottom) + 20px) 20px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 1.5px;
  background: linear-gradient(135deg, #00f2fe, #4facfe);
}

.header-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.greeting-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.greeting-title {
  font-family: var(--font-family-title);
  font-size: 18px;
  font-weight: 700;
}

.header-action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-action-btn:active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.12);
  transform: scale(0.95);
}

/* HERO SECTION */
.hero-section {
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(82, 97, 238, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

.hero-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.hero-value {
  font-family: var(--font-family-title);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 24px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.hero-value .currency {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
}

.hero-stats {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.8fr;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 18px;
}

.stat-col {
  display: flex;
  flex-direction: column;
}

.stat-col.divider {
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0 12px;
}

.stat-title {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-number {
  font-family: var(--font-family-title);
  font-size: 14px;
  font-weight: 700;
}

.text-highlight {
  color: var(--text-highlight);
}

/* ALLOCATION BAR */
.allocation-section {
  margin-bottom: 24px;
}

.section-title {
  font-family: var(--font-family-title);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-main);
}

.allocation-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.05);
  margin-bottom: 12px;
}

.bar-segment {
  height: 100%;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.bar-segment.cake { background: var(--accent-cake); }
.bar-segment.topi { background: var(--accent-topi); }
.bar-segment.buff { background: var(--accent-buff); }

.allocation-legend {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.dot-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-indicator.cake { background: #ff4785; }
.dot-indicator.topi { background: #0072ff; }
.dot-indicator.buff { background: #00f2fe; }

.legend-details {
  display: flex;
  flex-direction: column;
}

.legend-name {
  font-size: 11px;
  font-weight: 500;
}

.legend-amt {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-family-title);
  margin-top: 2px;
}

.legend-pct {
  font-size: 9px;
  color: var(--text-muted);
}

/* ALERT BOX */
.alert-section {
  margin-bottom: 24px;
}

.alert-card {
  padding: 16px;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.1), rgba(16, 185, 129, 0.03));
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  gap: 16px;
}

.alert-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(52, 211, 153, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-highlight);
  flex-shrink: 0;
}

.alert-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.alert-title {
  font-size: 11px;
  color: var(--text-highlight);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.alert-desc {
  font-size: 13px;
  font-weight: 600;
  margin-top: 2px;
}

.alert-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* FILTERS SECTION */
.filters-section {
  margin-bottom: 20px;
}

.filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-pills::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-btn.active {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15);
}

/* TIMELINE LIST */
.timeline-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.timeline-count-badge {
  font-size: 11px;
  background-color: rgba(255, 255, 255, 0.06);
  padding: 4px 10px;
  border-radius: 12px;
  color: var(--text-muted);
}

.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Month Card */
.month-card {
  border-radius: var(--radius-md);
  overflow: hidden;
}

.month-header {
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.month-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.month-name {
  font-family: var(--font-family-title);
  font-size: 17px;
  font-weight: 700;
}

.month-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.month-value-col {
  display: flex;
  align-items: center;
  gap: 12px;
}

.month-payout {
  font-family: var(--font-family-title);
  font-size: 16px;
  font-weight: 700;
  text-align: right;
}

.month-payout .amt {
  color: var(--text-main);
}

.month-payout .label {
  font-size: 9px;
  color: var(--text-muted);
  display: block;
  font-weight: 500;
}

.arrow-icon {
  color: var(--text-muted);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.month-card.open .arrow-icon {
  transform: rotate(180deg);
  color: var(--text-main);
}

/* Expanded list of contracts */
.month-details {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  background-color: rgba(0, 0, 0, 0.15);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.month-card.open .month-details {
  max-height: 500px;
  overflow-y: auto;
}

.contract-item {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

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

.contract-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contract-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.contract-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.contract-badge.cake { background: rgba(255, 71, 133, 0.15); color: #ff4785; }
.contract-badge.topi { background: rgba(0, 114, 255, 0.15); color: #00c6ff; }
.contract-badge.buff { background: rgba(0, 242, 254, 0.15); color: #00f2fe; }

.contract-date {
  font-size: 13px;
  font-weight: 600;
}

.contract-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.contract-value {
  text-align: right;
}

.contract-payout {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-family-title);
}

.contract-payout-subtitle {
  font-size: 10px;
  color: var(--text-muted);
}

/* APP FOOTER */
.app-footer {
  margin-top: 40px;
  text-align: center;
  padding-bottom: var(--safe-bottom);
}

.app-footer p {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.15);
  letter-spacing: 0.5px;
}
