/* -------------------------------------------------------------
 * 1:1 Reps Reselling Dashboard - CSS Stylesheet
 * Ultra-Premium Modern Minimal / iOS Glassmorphism Theme (Smoothy Version)
 * ------------------------------------------------------------- */

/* --- Fonts & Typography --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Premium Deep Space Colors */
  --bg-primary: #050508;
  --bg-secondary: #0c0c12;
  --glass-bg: rgba(14, 14, 20, 0.65);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-border-glow: rgba(255, 255, 255, 0.12);
  
  /* Accent Colors */
  --accent-color: #6366f1; /* Premium Royal Indigo */
  --accent-glow: rgba(99, 102, 241, 0.35);
  --accent-light: rgba(99, 102, 241, 0.08);
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  
  /* UI Status Colors with Soft Neon Glows */
  --color-shipped: #3b82f6; /* Vivid Blue */
  --color-shipped-glow: rgba(59, 130, 246, 0.15);
  
  --color-arrived: #eab308; /* Luxury Amber */
  --color-arrived-glow: rgba(234, 179, 8, 0.15);
  
  --color-listed: #a855f7;  /* Magic Amethyst */
  --color-listed-glow: rgba(168, 85, 247, 0.15);
  
  --color-sold: #10b981;    /* Emerald Jade */
  --color-sold-glow: rgba(16, 185, 129, 0.15);
  
  --color-profit: #10b981;
  --color-loss: #f43f5e;     /* Rose Red */
  --color-muted: #8e8e93;
  --color-text: #e5e7eb;
  --color-text-bold: #ffffff;

  /* Safe Area Variables */
  --safe-top: env(safe-area-inset-top, 24px);
  --safe-bottom: env(safe-area-inset-bottom, 24px);
  
  /* Physics Easings */
  --ease-smooth: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Base & Reset --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent; /* Remove default tap highlight */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Outfit", sans-serif;
  background-color: var(--bg-primary);
  color: var(--color-text);
  overflow-x: hidden;
  height: 100vh;
  height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  overscroll-behavior-y: none; /* Disable pull-to-refresh on Safari */
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* Container fitting Mobile Viewports */
.app-container {
  width: 100%;
  max-width: 480px; /* Constrain wide screens to premium mobile view */
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg-primary);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

/* --- App Splash & Loading --- */
#splash-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s;
}

.splash-logo {
  width: 100px;
  height: 100px;
  border-radius: 24px;
  background: linear-gradient(135deg, #1f1f23 0%, #0d0d0f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.splash-logo::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, transparent 70%);
  animation: rotateGlow 6s linear infinite;
}

.splash-logo span {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(to right, #ffffff, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  z-index: 1;
}

.splash-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--color-text-bold);
  margin-bottom: 8px;
}

.splash-subtitle {
  font-size: 13px;
  color: var(--color-muted);
  font-weight: 300;
}

.splash-loader {
  width: 100px;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  margin-top: 40px;
  overflow: hidden;
  position: relative;
}

.splash-progress {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), #10b981);
  border-radius: 2px;
  animation: fillProgress 1.8s cubic-bezier(0.1, 0.8, 0.1, 1) forwards;
}

@keyframes rotateGlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes fillProgress {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* --- Layout Elements --- */

/* Header Area */
header {
  padding: calc(var(--safe-top) + 12px) 20px 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to bottom, var(--bg-primary) 80%, transparent);
  z-index: 100;
  flex-shrink: 0;
}

header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text-bold);
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.header-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--glass-bg);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  cursor: pointer;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.header-btn:active {
  transform: scale(0.9);
  background-color: rgba(255, 255, 255, 0.1);
}

/* Main Scrollable Content */
main {
  flex: 1;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  padding: 0 20px calc(var(--safe-bottom) + 80px) 20px; /* extra pad for bottom navigation */
}

/* Hide scrollbar default, preserve scrolling */
main::-webkit-scrollbar {
  display: none;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-around;
  padding-top: 10px;
  padding-bottom: calc(var(--safe-bottom) + 6px);
  z-index: 999;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--color-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  gap: 4px;
  transition: color 0.2s ease;
  flex: 1;
  padding: 4px 0;
}

.nav-item i {
  font-size: 20px;
}

.nav-item.active {
  color: var(--color-text-bold);
}

.nav-item.active i {
  color: var(--accent-color);
}

/* --- Views Management --- */
.view {
  display: none;
  opacity: 0;
  transform: scale(0.985) translateY(10px);
}

.view.active {
  display: block;
  animation: smoothSlideUp 0.45s var(--ease-smooth) forwards;
}

@keyframes smoothSlideUp {
  0% {
    opacity: 0;
    transform: scale(0.98) translateY(14px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* --- Card & Components UI --- */
.card {
  background-color: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  padding: 16px;
  border-radius: 16px;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-bold);
  letter-spacing: -0.01em;
}

.stat-value.profit {
  color: var(--color-profit);
}

.stat-value.loss {
  color: var(--color-loss);
}

.stat-sub {
  font-size: 10px;
  margin-top: 4px;
  color: var(--color-muted);
}

.stat-sub.positive {
  color: var(--color-profit);
}

/* Big Hero Stat */
.hero-stat {
  text-align: center;
  padding: 12px 0;
}

.hero-stat .stat-label {
  justify-content: center;
  font-size: 12px;
}

.hero-stat .stat-value {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* Section Title */
.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-bold);
  margin: 20px 0 12px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-link {
  font-size: 12px;
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}

/* --- Search & Filter Bar --- */
.search-filter-wrapper {
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
}

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

.search-bar i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
  font-size: 16px;
}

.search-input {
  width: 100%;
  background-color: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 12px 16px 12px 40px;
  color: var(--color-text-bold);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.search-input:focus {
  border-color: var(--accent-color);
}

.filter-btn {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background-color: var(--glass-bg);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:active {
  transform: scale(0.92);
}

.filter-options {
  display: none;
  background-color: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 16px;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  animation: slideFadeIn 0.2s ease forwards;
}

.filter-options.active {
  display: grid;
}

.select-control {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--color-text-bold);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  width: 100%;
}

/* --- Inventory & List UI --- */
.inventory-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-row {
  background-color: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s;
}

.item-row:active {
  transform: scale(0.98);
  background-color: rgba(255, 255, 255, 0.05);
}

.item-img {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.03);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--glass-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
}

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

.item-header-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-bold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 6px;
}

.item-meta {
  font-size: 11px;
  color: var(--color-muted);
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
}

.item-brand {
  font-weight: 500;
  color: var(--color-text);
}

.item-price-profit {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.item-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-bold);
}

.item-profit {
  font-size: 12px;
  font-weight: 700;
}

.item-profit.positive {
  color: var(--color-profit);
}

.item-profit.negative {
  color: var(--color-loss);
}

/* Status Badge Styles */
.status-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-block;
}

.badge-shipped {
  background-color: rgba(59, 130, 246, 0.12);
  color: var(--color-shipped);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-arrived {
  background-color: rgba(234, 179, 8, 0.12);
  color: var(--color-arrived);
  border: 1px solid rgba(234, 179, 8, 0.2);
}

.badge-listed {
  background-color: rgba(168, 85, 247, 0.12);
  color: var(--color-listed);
  border: 1px solid rgba(168, 85, 247, 0.2);
}

.badge-sold {
  background-color: rgba(16, 185, 129, 0.12);
  color: var(--color-sold);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Empty State UI */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--color-muted);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-bold);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 12px;
  max-width: 240px;
  line-height: 1.5;
}

/* --- Skeleton Loading --- */
.skeleton-row {
  height: 80px;
  border-radius: 16px;
  background: linear-gradient(90deg, #16161a 25%, #22222a 50%, #16161a 75%);
  background-size: 200% 100%;
  animation: loadingShimmer 1.5s infinite;
  border: 1px solid var(--glass-border);
}

@keyframes loadingShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- FX / Currency Converter --- */
.fx-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.fx-rate-row {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fx-currency-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fx-flag {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  background-color: var(--accent-light);
  color: var(--accent-color);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.fx-currency-name {
  display: flex;
  flex-direction: column;
}

.fx-cur-code {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-bold);
}

.fx-cur-desc {
  font-size: 10px;
  color: var(--color-muted);
}

.fx-rate-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fx-rate-input {
  width: 80px;
  background-color: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 6px 10px;
  text-align: right;
  color: var(--color-text-bold);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  outline: none;
}

.fx-rate-input:focus {
  border-color: var(--accent-color);
}

.fx-symbol {
  font-size: 12px;
  color: var(--color-muted);
}

.api-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 8px 12px;
  border-radius: 10px;
  background-color: rgba(255, 255, 255, 0.02);
  font-size: 11px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.dot-online {
  background-color: var(--color-profit);
  box-shadow: 0 0 8px var(--color-profit);
}

.dot-offline {
  background-color: var(--color-loss);
  box-shadow: 0 0 8px var(--color-loss);
}

/* Quick JPY Calculator */
.calc-wrapper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.calc-input {
  background-color: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 10px;
  font-family: inherit;
  color: var(--color-text-bold);
  outline: none;
  font-size: 12px;
}

.calc-btn {
  background-color: var(--accent-color);
  border: none;
  border-radius: 10px;
  color: white;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* --- Insights & Analysis UI --- */
.insight-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.insight-metric-row:last-child {
  border-bottom: none;
}

.insight-label-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.insight-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  font-size: 14px;
}

.insight-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
}

.insight-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-bold);
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.ranking-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(255,255,255,0.02);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.02);
}

.ranking-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ranking-index {
  font-weight: 700;
  color: var(--color-muted);
  width: 14px;
}

.ranking-name {
  font-weight: 500;
  color: var(--color-text-bold);
}

.ranking-right {
  font-weight: 700;
  color: var(--color-profit);
}

/* --- Modals --- */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1100;
  display: none;
  justify-content: center;
  align-items: flex-end; /* iPhone standard bottom sheet style */
}

.modal-overlay.active {
  display: flex;
}

.modal-sheet {
  width: 100%;
  max-height: 85%;
  background-color: #121215;
  border-top: 1px solid var(--glass-border);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 20px 20px calc(var(--safe-bottom) + 20px) 20px;
  overflow-y: auto;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-bold);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  cursor: pointer;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
}

/* Forms in Modal */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.input-control {
  width: 100%;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px;
  color: var(--color-text-bold);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.input-control:focus {
  border-color: var(--accent-color);
}

.btn-primary {
  width: 100%;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.btn-primary:active {
  transform: scale(0.96);
}

.btn-danger {
  width: 100%;
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-loss);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 14px;
  padding: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  transition: transform 0.1s;
}

.btn-danger:active {
  transform: scale(0.96);
}

/* --- Floating Add Button --- */
.floating-add-btn {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 76px);
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-color) 0%, #4f46e5 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.35);
  border: none;
  cursor: pointer;
  z-index: 900;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 480px) {
  .floating-add-btn {
    right: calc(50% - 220px);
  }
}

.floating-add-btn:active {
  transform: scale(0.9) rotate(90deg);
}

/* --- Toast Notifications --- */
#toast-container {
  position: absolute;
  top: calc(var(--safe-top) + 20px);
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 380px;
  z-index: 10000;
  pointer-events: none;
}

.toast {
  background: rgba(22, 22, 26, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  color: var(--color-text-bold);
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  transform: translateY(-20px);
  opacity: 0;
  animation: toastFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastFadeIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.toast.fade-out {
  animation: toastFadeOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastFadeOut {
  to {
    transform: translateY(-10px);
    opacity: 0;
  }
}

.toast i {
  font-size: 16px;
}

.toast-success i {
  color: var(--color-profit);
}

.toast-error i {
  color: var(--color-loss);
}

.toast-info i {
  color: var(--accent-color);
}

/* Settings List */
.settings-group {
  margin-bottom: 24px;
}

.settings-list {
  background-color: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  overflow: hidden;
}

.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--glass-border);
  cursor: pointer;
  transition: background-color 0.2s;
}

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

.settings-item:active {
  background-color: rgba(255, 255, 255, 0.05);
}

.settings-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-item-left i {
  font-size: 18px;
  color: var(--accent-color);
}

.settings-item-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-bold);
}

.settings-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-muted);
}

/* File Actions buttons */
.file-btn {
  display: none;
}

/* Active tab animations */
.item-status-select {
  border-radius: 8px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  border: none;
  background-color: rgba(255,255,255,0.06);
  color: var(--color-text-bold);
  outline: none;
}

.item-status-select option {
  background-color: var(--bg-secondary);
}

/* ==========================================================================
   Ultra-Premium & Smoothy UI Additions (Collapse, Mode Toggle, FX Preview)
   ========================================================================== */

/* 1. Realtime JPY Currency Converter Preview Bubble */
.jpy-preview-bubble {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-profit);
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.12);
  animation: pulseBubble 2s infinite ease-in-out;
  transition: opacity 0.3s var(--ease-smooth);
}

.jpy-preview-bubble.hidden {
  opacity: 0;
  pointer-events: none;
}

@keyframes pulseBubble {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); background: rgba(16, 185, 129, 0.09); }
  100% { transform: scale(1); }
}

/* 2. Collapsible Custom Accordion (Smooth Grid Auto-transition) */
.collapsible-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  cursor: pointer;
  margin: 16px 0 10px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-color);
  transition: background 0.2s var(--ease-smooth), border-color 0.2s var(--ease-smooth);
}

.collapsible-trigger:active {
  background: rgba(255, 255, 255, 0.05);
  transform: scale(0.99);
}

.collapsible-trigger i {
  transition: transform 0.3s var(--ease-smooth);
}

.collapsible-trigger.active i {
  transform: rotate(180deg);
  color: var(--color-text-bold);
}

.collapsible-trigger.active {
  color: var(--color-text-bold);
  border-color: rgba(255, 255, 255, 0.15);
}

.collapsible-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  overflow: hidden;
}

.collapsible-wrapper.active {
  grid-template-rows: 1fr;
}

.collapsible-inner {
  min-height: 0;
  transition: visibility 0.35s;
  visibility: hidden;
  padding: 6px 2px;
}

.collapsible-wrapper.active .collapsible-inner {
  visibility: visible;
}

/* 3. View Mode Toggle Switch Style */
.view-mode-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
  margin-left: auto;
}

.view-mode-btn {
  border: none;
  background: transparent;
  color: var(--color-muted);
  width: 36px;
  height: 36px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease-smooth);
}

.view-mode-btn.active {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* 4. Minimal Mode Layout for Inventory Lists */
.inventory-list.minimal .item-row {
  padding: 16px;
  border-radius: 18px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s var(--ease-smooth), border-color 0.2s;
  display: flex;
  align-items: center;
  gap: 16px;
}

.inventory-list.minimal .item-row:active {
  transform: scale(0.985);
  border-color: var(--accent-glow);
}

.inventory-list.minimal .item-img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.inventory-list.minimal .item-info {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.inventory-list.minimal .item-header-line {
  margin-bottom: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.inventory-list.minimal .item-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-bold);
  letter-spacing: -0.01em;
}

.inventory-list.minimal .item-meta {
  display: none; /* Hide detailed info in minimal mode */
}

.inventory-list.minimal .item-price-profit {
  margin-top: 0;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.inventory-list.minimal .item-price {
  font-size: 14px;
  font-weight: 800;
  color: var(--color-text-bold);
}

.inventory-list.minimal .item-profit {
  font-size: 11px;
  font-weight: 700;
}

/* Modal Bottom Sheet Drag indicator */
.modal-drag-indicator {
  width: 40px;
  height: 5px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  align-self: center;
  margin-bottom: 12px;
  flex-shrink: 0;
}

/* ==========================================================================
   PWA Enforcement Block Screen (Ultra-Premium iOS Glassmorphism styling)
   ========================================================================== */
#pwa-block-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.pwa-block-content {
  width: 100%;
  max-width: 400px;
  text-align: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 40px 24px;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
  animation: smoothSlideUp 0.6s var(--ease-smooth) forwards;
}

.pwa-block-logo {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  background: linear-gradient(135deg, #1f1f23 0%, #0d0d0f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
  box-shadow: 0 15px 35px rgba(0,0,0,0.5);
  margin: 0 auto 24px auto;
  position: relative;
  overflow: hidden;
}

.pwa-block-logo::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, transparent 70%);
  animation: rotateGlow 6s linear infinite;
}

.pwa-block-logo span {
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(to right, #ffffff, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  z-index: 1;
}

.pwa-block-title {
  font-family: 'Outfit', -apple-system, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-bold);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.pwa-block-desc {
  font-size: 13px;
  color: var(--color-muted);
  line-height: 1.6;
  margin-bottom: 32px;
  padding: 0 8px;
}

.pwa-instructions {
  text-align: left;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 24px;
}

.pwa-instructions h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-bold);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-instructions h3 i {
  color: var(--accent-color);
  width: 16px;
  height: 16px;
}

.pwa-instructions ol {
  padding-left: 18px;
  font-size: 12px;
  color: var(--color-text);
  line-height: 1.8;
}

.pwa-instructions ol li {
  margin-bottom: 10px;
}

.pwa-instructions ol li strong {
  color: var(--accent-color);
}

.pwa-instructions i {
  display: inline-flex;
  vertical-align: middle;
}

/* ==========================================================================
   Password Authentication Screen (Ultra-Premium Glassmorphism styling)
   ========================================================================== */
#password-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  opacity: 1;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s;
}

#password-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.password-card {
  width: 100%;
  max-width: 380px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 40px 24px 30px 24px;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
  transition: transform 0.4s var(--ease-smooth);
}

.password-card.shake {
  animation: shakeError 0.5s ease-in-out;
  border-color: var(--color-loss);
  box-shadow: 0 0 25px rgba(244, 63, 94, 0.2);
}

.password-logo {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  background: linear-gradient(135deg, #1f1f23 0%, #0d0d0f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
  box-shadow: 0 15px 30px rgba(0,0,0,0.5);
  margin: 0 auto 24px auto;
  position: relative;
  overflow: hidden;
}

.password-logo::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  animation: rotateGlow 6s linear infinite;
}

.password-logo span {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(to right, #ffffff, var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  z-index: 1;
}

.password-title {
  font-family: 'Outfit', -apple-system, sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-bold);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

.password-subtitle {
  font-size: 12px;
  color: var(--color-muted);
  line-height: 1.6;
  margin-bottom: 28px;
}

.password-input-wrap {
  margin-bottom: 20px;
}

#app-password-input {
  text-align: center;
  font-size: 16px;
  letter-spacing: 0.2em;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  transition: all 0.3s;
}

#app-password-input:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent-color);
  box-shadow: 0 0 15px var(--accent-glow);
  letter-spacing: 0.2em;
}

/* Custom Premium Checkbox for Remember Me */
.remember-me-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.remember-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--color-text);
  position: relative;
}

.remember-checkbox-label input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.custom-checkbox {
  width: 20px;
  height: 20px;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  position: relative;
  transition: all 0.25s var(--ease-smooth);
}

.remember-checkbox-label:hover input ~ .custom-checkbox {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.remember-checkbox-label input:checked ~ .custom-checkbox {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  box-shadow: 0 0 10px var(--accent-glow);
}

.custom-checkbox::after {
  content: "";
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.remember-checkbox-label input:checked ~ .custom-checkbox::after {
  display: block;
}

.remember-text {
  font-weight: 500;
  transition: color 0.2s;
}

.remember-checkbox-label input:checked ~ .remember-text {
  color: var(--color-text-bold);
}

.auth-submit-btn {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 24px;
}

.password-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 11px;
  color: var(--color-muted);
  line-height: 1.4;
  text-align: left;
}

.password-hint i {
  color: var(--color-arrived);
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.password-hint span {
  font-weight: 500;
}

/* Shake Keyframe Animation */
@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
  20%, 40%, 60%, 80% { transform: translateX(6px); }
}


