/* Reset and Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1e88e5;
  --primary-dark: #1565c0;
  --secondary: #00c853;
  --accent: #ff6d00;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-light: #666666;
  --border: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Splash Screen */
#splash-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #1e88e5 0%, #0d47a1 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

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

.splash-logo {
  width: 120px;
  height: 120px;
  background: white;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: bold;
  color: #1e88e5;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  margin-bottom: 24px;
}

.splash-title {
  color: white;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

.splash-subtitle {
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  text-align: center;
  max-width: 280px;
  line-height: 1.5;
}

.splash-loader {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-top: 32px;
}

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

/* App Container */
#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 64px; /* Bottom nav height */
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.app-header .logo-text {
  font-size: 20px;
  font-weight: 700;
}

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

.header-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s;
}

.header-btn:active {
  background: rgba(255,255,255,0.35);
}

/* Content Area */
.app-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Section Title */
.section-title {
  font-size: 18px;
  font-weight: 700;
  padding: 16px 16px 8px;
  color: var(--text);
}

/* Quick Actions Grid */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 16px 16px;
}

.action-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
  width: 100%;
}

.action-card:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-lg);
}

.action-card .icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.action-card.blue .icon { background: #e3f2fd; }
.action-card.green .icon { background: #e8f5e9; }
.action-card.orange .icon { background: #fff3e0; }
.action-card.purple .icon { background: #f3e5f5; }
.action-card.red .icon { background: #ffebee; }
.action-card.teal .icon { background: #e0f2f1; }

.action-card .label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.action-card .desc {
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.3;
}

/* Feature Cards */
.feature-list {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature-item {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s;
  border: none;
  width: 100%;
  text-align: left;
}

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

.feature-item .icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.feature-item .info {
  flex: 1;
}

.feature-item .info .title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.feature-item .info .subtitle {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.feature-item .arrow {
  color: var(--text-light);
  font-size: 18px;
}

/* Banner Card */
.banner-card {
  margin: 0 16px 16px;
  background: linear-gradient(135deg, #1e88e5 0%, #0d47a1 100%);
  border-radius: 20px;
  padding: 20px;
  color: white;
  box-shadow: var(--shadow-lg);
}

.banner-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.banner-card p {
  font-size: 13px;
  opacity: 0.9;
  line-height: 1.5;
  margin-bottom: 14px;
}

.banner-btn {
  background: white;
  color: #1e88e5;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s;
}

.banner-btn:active {
  transform: scale(0.97);
}

/* WebView */
#webview-container {
  display: none;
  flex-direction: column;
  height: 100%;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 200;
  background: white;
}

#webview-container.active {
  display: flex;
}

#webview-header {
  background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
  color: white;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#webview-header .back-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}

#webview-header .webview-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#webview-frame {
  flex: 1;
  border: none;
  width: 100%;
}

#webview-loader {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#webview-loader.active {
  display: flex;
}

#webview-loader .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e0e0e0;
  border-top-color: #1e88e5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: white;
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
  z-index: 100;
  border-top: 1px solid var(--border);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 16px;
  border: none;
  background: none;
  color: var(--text-light);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.2s;
}

.nav-item .nav-icon {
  font-size: 22px;
}

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

/* Install Banner */
#install-banner {
  display: none;
  position: fixed;
  bottom: 70px;
  left: 16px;
  right: 16px;
  background: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 150;
  align-items: center;
  gap: 12px;
}

#install-banner.active {
  display: flex;
}

.install-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #1e88e5, #0d47a1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  flex-shrink: 0;
}

.install-text {
  flex: 1;
}

.install-text .title {
  font-size: 15px;
  font-weight: 600;
}

.install-text .desc {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.install-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

.install-close {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

/* Offline Indicator */
#offline-indicator {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: #ff6d00;
  color: white;
  text-align: center;
  padding: 6px;
  font-size: 13px;
  font-weight: 600;
  z-index: 300;
}

#offline-indicator.active {
  display: block;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 2px;
}

/* Responsive */
@media (min-width: 600px) {
  .quick-actions {
    grid-template-columns: repeat(3, 1fr);
  }
}
