/* ===========================
   Page-Specific Styles
   =========================== */

/* === Dashboard Page === */
.dashboard-welcome {
  background: var(--gradient-hero);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-2xl);
  margin-bottom: var(--space-xl);
  position: relative;
  overflow: hidden;
}

.dashboard-welcome__art {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 240px;
  height: 130px;
  z-index: 1;
  overflow: visible;
}

.dashboard-welcome__art img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: right center;
}

.dashboard-welcome__title {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.dashboard-welcome__sub {
  font-size: var(--font-size-md);
  color: var(--color-text-secondary);
}

/* Budget overview card */
.budget-overview {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border-light);
  margin-bottom: var(--space-xl);
}

.budget-overview__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.budget-overview__label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
}

.budget-overview__amount {
  font-size: var(--font-size-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.budget-overview__divider {
  height: 1px;
  background: var(--color-border-light);
  margin: var(--space-md) 0;
}

/* Recent receipts section */
.recent-section {
  margin-top: var(--space-xl);
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.recent-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  transition: all var(--transition-fast);
}

.recent-item:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-sm);
}

.recent-item__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(74, 123, 247, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.recent-item__info {
  flex: 1;
  min-width: 0;
}

.recent-item__name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-item__date {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.recent-item__amount {
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* === Add Receipt Page === */
.add-receipt-form {
  max-width: 640px;
  margin: 0 auto;
}

.add-receipt-form .card {
  padding: var(--space-xl);
}

.add-receipt-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.add-receipt-header__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-md);
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.add-receipt-header__title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
}

.add-receipt-header__sub {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-xs);
}

.add-receipt-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-top: var(--space-xl);
}

/* === Settings Page === */
.settings-section {
  margin-bottom: var(--space-xl);
}

.settings-section .card {
  padding: var(--space-xl);
}

.settings-section__title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.settings-section__description {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
}

.settings-actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.settings-info {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: rgba(74, 123, 247, 0.05);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  border: 1px solid rgba(74, 123, 247, 0.1);
}

/* === Upload Dropzone === */
.upload-dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  background: var(--color-bg);
  position: relative;
}

.upload-dropzone:hover {
  border-color: var(--color-primary-light);
  background: rgba(74, 123, 247, 0.03);
}

.upload-dropzone--active {
  border-color: var(--color-primary);
  background: rgba(74, 123, 247, 0.06);
  box-shadow: 0 0 0 3px rgba(74, 123, 247, 0.1);
}

.upload-dropzone--analyzing {
  border-color: var(--color-secondary);
  animation: analyzeGlow 1.5s ease-in-out infinite;
}

@keyframes analyzeGlow {
  0%, 100% { box-shadow: 0 0 0 3px rgba(124, 91, 240, 0.1); }
  50% { box-shadow: 0 0 0 6px rgba(124, 91, 240, 0.2); }
}

.upload-dropzone__icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-sm);
  opacity: 0.7;
}

.upload-dropzone__text {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xs);
}

.upload-dropzone__hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.upload-preview {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
}

.upload-preview img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.upload-preview__info {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-width: 0;
}

.upload-preview__info span {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === Category Chart Section === */
.category-chart-section {
  margin-top: var(--space-xl);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
}

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

  .dashboard-welcome {
    padding: var(--space-lg);
  }

  .add-receipt-actions {
    flex-direction: column;
  }

  .settings-actions {
    flex-direction: column;
  }
}

/* === PIN Overlay === */
.pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  transition: opacity 0.3s ease;
  padding: var(--space-lg);
}

.pin-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
  animation: pinCardIn 0.5s ease;
}

@keyframes pinCardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.pin-card__icon {
  font-size: 3.5rem;
  margin-bottom: var(--space-md);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.pin-card__title {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  background: linear-gradient(135deg, #4A7BF7, #7C5BF0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-sm);
}

.pin-card__subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
  line-height: 1.5;
}

.pin-card__form {
  margin-bottom: var(--space-lg);
  text-align: left;
}

.pin-card__label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.pin-card__input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xl);
  font-weight: 600;
  text-align: center;
  letter-spacing: 8px;
  background: var(--color-bg);
  color: var(--color-text);
  transition: all var(--transition-fast);
  font-family: var(--font-family);
}

.pin-card__input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(74, 123, 247, 0.15);
  outline: none;
}

.pin-card__error {
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(239, 68, 68, 0.08);
  border-radius: var(--radius-sm);
  color: var(--color-danger);
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-align: center;
}

.pin-card__actions {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.pin-card__skip {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  cursor: pointer;
  padding: var(--space-sm);
  transition: color var(--transition-fast);
  font-family: var(--font-family);
}

.pin-card__skip:hover {
  color: var(--color-primary);
}

/* === Sync Indicator (nav) === */
.sync-indicator {
  font-size: 1rem;
  opacity: 0.4;
  transition: all var(--transition-fast);
  cursor: default;
  padding: var(--space-xs);
}

.sync-indicator--synced {
  opacity: 1;
  animation: syncPulse 2s ease-in-out;
}

@keyframes syncPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* === Cloud Sync Settings Section === */
.sync-status-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: rgba(74, 123, 247, 0.05);
  border-radius: var(--radius-md);
  border: 1px solid rgba(74, 123, 247, 0.1);
  margin-bottom: var(--space-md);
}

.sync-status-card__icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.sync-status-card__info {
  flex: 1;
  min-width: 0;
}

.sync-status-card__title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
}

.sync-status-card__detail {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

@media (max-width: 480px) {
  .pin-card {
    padding: var(--space-xl) var(--space-lg);
  }
  
  .pin-card__actions {
    flex-direction: column;
  }
}

/* Bosco page refinements */
.dashboard-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 36px;
  margin-bottom: 24px;
  background: #eaf4ff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.dashboard-welcome__text {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 2;
}
.dashboard-welcome__title {
  color: #071747;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 8px;
}
.dashboard-welcome__sub {
  color: #354c75;
  font-size: 0.95rem;
  line-height: 1.5;
}
.dashboard-welcome__art {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 240px;
  height: 130px;
  overflow: visible;
  z-index: 1;
  flex: none;
}
.dashboard-welcome__art[hidden] {
  display: none !important;
}
.dashboard-welcome__art img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: right center;
}

.budget-overview {
  padding: 22px 24px;
  margin-bottom: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.budget-overview__label {
  color: #58708f;
  font-weight: 600;
  font-size: 0.9rem;
}
.budget-overview__amount {
  color: #071747;
  font-weight: 700;
  font-size: 1.25rem;
}
.progress-bar {
  background: #e8f0f9;
  height: 10px;
  border-radius: 9999px;
  overflow: hidden;
}
.progress-bar__fill--blue { background: #1677ed; }
.progress-bar__fill--green { background: #10b981; }
.progress-bar__fill--orange { background: #f59e0b; }
.progress-bar__fill--red { background: #f43f5e; }

.recent-section,
.category-chart-section {
  margin-top: 24px;
}
.dashboard-grid {
  gap: 24px;
}
.recent-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  transition: all var(--transition-fast);
}
.recent-item:hover {
  background: #f8fbff;
  border-color: #bdd3eb;
  box-shadow: 0 2px 8px rgba(20, 65, 120, 0.04);
}
.recent-item__name {
  color: #071747;
  font-weight: 600;
  font-size: 0.925rem;
}
.recent-item__date {
  color: #58708f;
  font-size: 0.775rem;
}
.recent-item__amount {
  color: #071747;
  font-weight: 700;
  font-size: 1rem;
}
.recent-item__icon {
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #1677ed;
  border-radius: 10px;
}

.add-receipt-form {
  max-width: 760px;
}
.add-receipt-form .card {
  padding: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.add-receipt-header {
  text-align: left;
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: 50px 1fr;
  column-gap: 14px;
  align-items: center;
}
.add-receipt-header__icon {
  width: 50px;
  height: 50px;
  margin: 0;
  grid-row: 1 / 3;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #1677ed;
  border-radius: 14px;
  font-size: 1.45rem;
}
.add-receipt-header__title {
  color: #071747;
  font-weight: 700;
  font-size: 1.35rem;
}
.add-receipt-header__sub {
  color: #58708f;
  margin-top: 2px;
}
.upload-dropzone {
  padding: 34px 24px;
  background: #f8fbff;
  border: 1.5px dashed #cbdcf0;
  border-radius: 14px;
  transition: all var(--transition-fast);
}
.upload-dropzone:hover {
  background: #eff6ff;
  border-color: #1677ed;
}
.upload-dropzone--active {
  background: #eaf4ff;
  border-color: #1677ed;
}
.upload-dropzone--analyzing {
  border-color: #1677ed;
  background: #eff6ff;
}
.add-receipt-actions {
  margin-top: 24px;
}

.settings-section {
  margin-bottom: 20px;
}
.settings-section .card {
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.settings-section__title {
  color: #071747;
  font-weight: 700;
  font-size: 1.15rem;
}
.settings-section__description {
  color: #58708f;
  margin-bottom: 18px;
}
.settings-info {
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #1e40af;
  border-radius: 12px;
  padding: 14px 18px;
}

.pin-overlay {
  background: rgba(7, 23, 71, 0.45);
  backdrop-filter: blur(4px);
}
.pin-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  box-shadow: 0 20px 48px rgba(7, 23, 71, 0.16);
}
.pin-card__title {
  background: none;
  color: #071747;
  -webkit-text-fill-color: currentColor;
  font-weight: 800;
}

@media (max-width: 768px) {
  .dashboard-welcome {
    padding: 22px 24px;
    gap: 14px;
  }
  .dashboard-welcome__title {
    font-size: 1.4rem;
  }
  .dashboard-welcome__art {
    width: 135px;
    height: 90px;
    right: 14px;
  }
  .add-receipt-form .card,
  .settings-section .card {
    padding: 20px;
  }
  .add-receipt-header {
    grid-template-columns: 44px 1fr;
  }
  .add-receipt-header__icon {
    width: 44px;
    height: 44px;
  }
  .add-receipt-actions {
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .dashboard-welcome {
    padding: 18px 20px;
  }
  .dashboard-welcome__title {
    font-size: 1.25rem;
  }
  .dashboard-welcome__art {
    display: none !important;
  }
  .budget-overview {
    padding: 18px;
  }
}