/* ============================================
   PAGES.CSS - Page-Specific Styles
   ============================================ */

/* ========== LOGIN PAGE ========== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: var(--bg-color);
}

.login-card {
  width: 100%;
  max-width: 320px;
  text-align: center;
  padding: 40px 30px;
}

.login-card h1 {
  font-size: 32px;
  margin-bottom: 10px;
  color: #fff;
}

.login-card p {
  color: var(--text-muted);
  margin-bottom: 40px;
  font-size: 14px;
}

.floating-wallet {
  font-size: 60px;
  margin-bottom: 30px;
  display: block;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 10px 20px rgba(156, 136, 255, 0.3));
}

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* ========== HOME PAGE ========== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.app-header h2 {
  font-size: 24px;
  background: linear-gradient(135deg, #fff 0%, #9c88ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-controls {
  display: flex;
  gap: 10px;
}

/* RPG Health Bar */
.rpg-container {
  margin-bottom: 10px;
}

.health-bar-container {
  width: 100%;
  height: 28px;
  background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  border: 2px solid rgba(156, 136, 255, 0.25);
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.health-bar-container::after {
  content: "";
  position: absolute;
  top: 0;
  left: -30%;
  width: 30%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.25),
    transparent
  );
  animation: shimmerBounce 3s ease-in-out infinite;
  z-index: 3;
  border-radius: 20px;
}

.health-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #e74c3c, #f1c40f, #2ecc71);
  width: 50%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  border-radius: 18px;
}

.hp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: bold;
  color: white;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
  z-index: 2;
  letter-spacing: 2px;
}

/* RPG Balance */
.rpg-balance {
  text-align: center;
  font-size: 32px;
  font-weight: 800;
  margin: 15px 0;
  color: #fff;
  text-shadow: 
    0 0 10px rgba(156, 136, 255, 0.6),
    0 0 20px rgba(156, 136, 255, 0.4),
    0 0 40px rgba(156, 136, 255, 0.2);
  letter-spacing: 1px;
}

/* Roast Box */
.roast-box {
  background: rgba(30, 30, 30, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #e0e0e0;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 25px;
  font-size: 15px;
  line-height: 1.5;
  font-style: italic;
  text-align: center;
  border: 1px solid rgba(156, 136, 255, 0.15);
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(156, 136, 255, 0.05);
}

/* Money Display */
.money {
  font-size: 28px;
  letter-spacing: 1px;
  margin: 10px 0;
  font-weight: 700;
  text-align: center;
  display: block;
  text-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
}

.money.plus {
  color: var(--success-color);
}

.money.minus {
  color: var(--danger-color);
}

/* ========== STATISTICS PAGE ========== */
.stats-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--box-shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
}

/* Chart Wrapper with Percentage Labels */
.chart-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 10px 0;
}

.chart-pct {
  font-size: 18px;
  font-weight: 700;
  min-width: 50px;
  text-align: center;
}

.chart-pct.left {
  color: var(--danger-color);
}

.chart-pct.right {
  color: var(--success-color);
}

.chart-container {
  flex: 1;
  max-width: 500px;
}

/* Bounce Animation for Toggle Buttons */
@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.92); }
}

.tx-type-btn:active,
.avg-toggle-btn:active {
  animation: bounce 0.15s ease-out;
}

.stats-toggle-container {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 3px;
  position: relative;
}

.stats-toggle-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all var(--transition-normal);
  z-index: 1;
  position: relative;
}

.stats-toggle-btn.active {
  color: #fff;
  background: var(--accent-color);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-sm);
}

.stat-item {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-full-width {
  grid-column: span 2;
}

.stat-icon {
  font-size: 24px;
  margin-bottom: var(--spacing-xs);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--spacing-xs);
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.stat-value.income { color: var(--success-color); }
.stat-value.expense { color: var(--danger-color); }

/* ========== ADD TRANSACTION PAGE ========== */
.add-form-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--box-shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Transaction Type Toggle */
.tx-type-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: var(--spacing-lg);
  position: relative;
  overflow: hidden;
}

.tx-type-toggle .toggle-slide-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: linear-gradient(135deg, #9c88ff, #8e78ff);
  border-radius: 10px;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 10px rgba(156, 136, 255, 0.4);
  z-index: 0;
}

.tx-type-toggle.expense-active .toggle-slide-indicator {
  transform: translateX(100%);
}

.tx-type-btn {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 10px;
  transition: color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 1;
  position: relative;
}

.tx-type-btn.active {
  color: #fff;
  background: transparent;
  box-shadow: none;
}

/* Category Selector */
.category-select-wrapper {
  display: flex;
  gap: 8px;
}

.category-select {
  flex: 1;
  padding: 12px 15px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.category-select:hover {
  border-color: rgba(156, 136, 255, 0.5);
}

.category-select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(156, 136, 255, 0.2);
}

.category-select option {
  background: #1a1a1a;
  color: #fff;
}

.category-select optgroup {
  color: var(--accent-color);
  font-weight: 600;
}

.add-category-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(156, 136, 255, 0.3);
  background: rgba(156, 136, 255, 0.15);
  color: var(--accent-color);
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-category-btn:hover {
  background: rgba(156, 136, 255, 0.25);
  transform: scale(1.05);
}

/* ========== MEDIA INPUT SECTION ========== */
.media-input-section {
  margin: 20px 0;
}

.media-input-section label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.media-buttons {
  display: flex;
  gap: 10px;
}

.media-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 15px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #fff;
}

.media-btn span {
  font-size: 24px;
}

.media-btn small {
  font-size: 11px;
  color: #888;
}

.media-btn:hover {
  background: rgba(156, 136, 255, 0.15);
  border-color: rgba(156, 136, 255, 0.3);
}

.media-btn:active {
  transform: scale(0.95);
}

/* OCR Preview */
.ocr-preview {
  position: relative;
  margin-top: 15px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ocr-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 10px;
}

.ocr-status {
  text-align: center;
}

.ocr-status span {
  font-size: 13px;
  color: #888;
}

.ocr-progress-bar {
  margin-top: 8px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.ocr-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #9c88ff, #2ecc71);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.ocr-cancel-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(231, 76, 60, 0.8);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.ocr-cancel-btn:hover {
  background: #e74c3c;
  transform: scale(1.1);
}

/* Voice Recording Indicator */
.voice-indicator {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 15px;
  padding: 15px 20px;
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.2), rgba(231, 76, 60, 0.1));
  border-radius: 12px;
  border: 1px solid rgba(231, 76, 60, 0.3);
}

.voice-pulse {
  width: 16px;
  height: 16px;
  background: #e74c3c;
  border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.voice-indicator span {
  flex: 1;
  font-size: 14px;
  color: #fff;
}

.voice-stop-btn {
  padding: 8px 16px;
  background: rgba(231, 76, 60, 0.8);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.voice-stop-btn:hover {
  background: #e74c3c;
}

/* ========== WALLETS PAGE ========== */
.total-balance-card {
  background: linear-gradient(135deg, #9c88ff, #7c5ce7);
  border-radius: var(--radius-xl);
  padding: 30px 25px;
  text-align: center;
  margin-bottom: 25px;
  box-shadow: 
    0 10px 40px rgba(156, 136, 255, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1);
}

.total-balance-label {
  display: block;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.total-balance-amount {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.wallet-section {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.wallet-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
}

.wallet-section-header h3 {
  margin: 0;
  font-size: 16px;
  color: #fff;
  border: none;
  padding: 0;
}

.btn-add-wallet {
  background: var(--accent-light);
  color: var(--accent-color);
  border: 1px solid rgba(156, 136, 255, 0.3);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-add-wallet:hover {
  background: rgba(156, 136, 255, 0.25);
}

.wallet-list {
  margin-bottom: 0;
}

/* Avg Toggle Buttons (Harian/Mingguan) */
.avg-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}

.avg-toggle .toggle-slide-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: linear-gradient(135deg, #9c88ff, #8e78ff);
  border-radius: 8px;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 10px rgba(156, 136, 255, 0.4);
  z-index: 0;
}

.avg-toggle.weekly-active .toggle-slide-indicator {
  transform: translateX(100%);
}

.avg-toggle-btn {
  flex: 1;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  color: #666;
  transition: color 0.3s ease;
  position: relative;
  z-index: 1;
}

.avg-toggle-btn:hover {
  color: #999;
}

.avg-toggle-btn.active {
  color: #fff;
  background: transparent;
}

.wallet-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.wallet-empty-icon {
  font-size: 48px;
  display: block;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

.wallet-empty-state p {
  margin: 0;
  font-size: 14px;
}

/* Wallet Modal */
.wallet-modal {
  width: 320px;
}

.wallet-form {
  width: 100%;
  text-align: left;
}

.wallet-form .form-control {
  margin-bottom: var(--spacing-md);
}

.wallet-form label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wallet-form input {
  width: 100%;
  box-sizing: border-box;
}

.wallet-icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wallet-icon-option {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 2px solid transparent;
}

.wallet-icon-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.wallet-icon-option.selected {
  border-color: var(--accent-color);
  background: var(--accent-light);
}

.wallet-modal-actions {
  flex-direction: row !important;
  gap: 10px;
  padding: 15px 20px 20px;
  border-top: none !important;
}

.wallet-modal-actions button {
  flex: 1;
  padding: 12px;
  border-radius: 10px !important;
  font-size: 14px;
}

.wallet-save-btn {
  background: linear-gradient(135deg, #9c88ff, #8e78ff) !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600;
}

.wallet-save-btn:hover {
  box-shadow: 0 4px 15px rgba(156, 136, 255, 0.3);
}

/* Wallet Swipe Actions (Hidden by default, revealed on hover/swipe) */
.wallet-list li {
  position: relative;
  overflow: hidden;
}

.wallet-actions-slide {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  display: flex;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.wallet-edit-btn,
.wallet-delete-btn {
  height: 100%;
  width: 60px;
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.wallet-edit-btn {
  background: linear-gradient(135deg, #9c88ff, #8e78ff);
  color: #fff;
}

.wallet-edit-btn:hover {
  background: linear-gradient(135deg, #8e78ff, #7c5ce7);
}

.wallet-delete-btn {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
}

.wallet-delete-btn:hover {
  background: linear-gradient(135deg, #c0392b, #a53125);
}

/* Show on hover or mobile swipe */
.wallet-list li:hover .li-content,
.wallet-list li.active-mobile .li-content {
  transform: translateX(-120px);
}

.wallet-list li:hover .wallet-actions-slide,
.wallet-list li.active-mobile .wallet-actions-slide {
  transform: translateX(0);
}

/* Custom Icon Styling */
.wallet-custom-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 4px;
}

/* Custom Icon Upload */
.custom-icon-upload {
  margin-top: 12px;
}

.upload-btn {
  display: inline-block;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #888;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

.upload-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(156, 136, 255, 0.5);
  color: #9c88ff;
}

.custom-icon-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.custom-icon-preview img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}

.remove-icon-btn {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.remove-icon-btn:hover {
  background: rgba(231, 76, 60, 0.4);
}

/* ========== SETTINGS PAGE ========== */
.settings-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: var(--spacing-lg);
  box-shadow: var(--box-shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.settings-item:active {
  background: rgba(255, 255, 255, 0.06);
}

.settings-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.settings-icon {
  font-size: 24px;
  width: 40px;
  text-align: center;
}

.settings-label {
  font-size: 15px;
  font-weight: 500;
  color: #fff;
}

.settings-desc {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.settings-action {
  color: var(--text-muted);
  font-size: 18px;
}

/* Filter Container */
.filter-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: var(--spacing-lg) 0;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--spacing-md);
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.vertical-filter {
  flex-direction: column;
}

.full-width-select {
  width: 100%;
}

/* Chart Container */
.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--box-shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  height: 280px;
}
