/* GLOBAL STYLES */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #667eea;
  --success: #4caf50;
  --warning: #ff9800;
  --danger: #f44336;
  --bg: #f5f5f5;
  --card-bg: #fff;
  --text-primary: #212121;
  --text-secondary: #757575;
  --border: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
}

.first-access-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.first-access-card {
  width: 100%;
  max-width: 460px;
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 28px;
}

.first-access-card h1 {
  margin-bottom: 4px;
  color: var(--primary);
}

.first-access-subtitle {
  color: var(--text-secondary);
  font-weight: 700;
  margin-bottom: 6px;
}

.first-access-text {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 14px;
}

#firstAccessForm label {
  display: block;
  margin-bottom: 6px;
  margin-top: 12px;
}

#firstAccessForm input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.password-row {
  display: flex;
  gap: 8px;
}

.password-row input {
  flex: 1;
}

.powered-by {
  text-align: center;
  color: #9a9a9a;
  font-size: 12px;
  padding: 16px 0;
  margin-top: 20px;
}

/* MODAL */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 30px;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateY(-30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* BUTTONS */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-block;
}
.btn-primary:hover { background: #5568d3; box-shadow: var(--shadow); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary.full-width { width: 100%; }

.btn-secondary {
  background: var(--border);
  color: var(--text-primary);
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: #d0d0d0; }

/* CARDS */
.card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

/* MAIN APP LAYOUT */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  background: var(--primary);
  color: white;
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: center;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1 {
  font-size: 20px;
  margin: 0;
}

.app-content {
  flex: 1;
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.tab-nav {
  display: flex;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}

.tab-nav-item {
  flex: 1;
  padding: 10px 4px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  text-align: center;
  line-height: 1.3;
}

.tab-nav-item .tab-icon { font-size: 20px; display: block; margin-bottom: 2px; }
.tab-nav-item.active { color: var(--primary); }
.tab-nav-item.active .tab-icon-wrap { border-bottom: 3px solid var(--primary); }

.tab-content {
  display: none;
  padding-bottom: 100px;
  animation: fadeIn 0.2s;
}
.tab-content.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* DASHBOARD COMPONENTS */
.meta-card {
  background: linear-gradient(135deg, var(--primary), #5568d3);
  color: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 12px;
}
.meta-label { font-size: 13px; opacity: 0.9; margin-bottom: 8px; }
.meta-value { font-size: 32px; font-weight: bold; margin-bottom: 12px; }

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.3);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  background: white;
  transition: width 0.3s ease;
  width: 0%;
}
.progress-percent { font-size: 12px; opacity: 0.9; }

.total-card {
  background: linear-gradient(135deg, var(--success), #45a049);
  color: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 12px;
}
.total-label { font-size: 13px; opacity: 0.9; margin-bottom: 8px; }
.total-value { font-size: 32px; font-weight: bold; }

/* PLATFORM SELECTOR */
.platform-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  border: 2px solid var(--border);
  background: var(--bg);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 80px;
}
.platform-btn:hover { border-color: var(--primary); background: #f0f4ff; }
.platform-btn.selected {
  border-color: var(--primary);
  background: #e8eef7;
  box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}
.platform-icon { font-size: 28px; margin-bottom: 6px; }
.platform-name { font-size: 11px; font-weight: 600; color: var(--text-primary); }

/* PLATFORM LIST (summary rows) */
.platform-list { display: flex; flex-direction: column; gap: 8px; }
.platform-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.platform-row:last-child { border-bottom: none; }
.platform-value { font-weight: 700; color: var(--text-primary); }

/* INFO BOXES */
.info-box {
  background: #e3f2fd;
  border-left: 4px solid var(--primary);
  padding: 12px;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* DELIVERY LIST */
.delivery-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px;
  background: var(--bg);
  border-radius: 6px;
  border-left: 4px solid var(--primary);
  margin-bottom: 8px;
}
.delivery-info { flex: 1; }
.delivery-platform { font-weight: 600; font-size: 13px; color: var(--primary); margin-bottom: 4px; }
.delivery-value { font-size: 16px; font-weight: bold; margin-bottom: 2px; }
.delivery-time { font-size: 12px; color: var(--text-secondary); }
.delivery-actions { display: flex; gap: 6px; margin-left: 8px; }

.btn-edit, .btn-delete {
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.btn-edit { background: var(--primary); color: white; }
.btn-delete { background: var(--danger); color: white; }

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* GREETING */
.greeting { margin-bottom: 16px; }
.greeting h2 { font-size: 20px; margin-bottom: 4px; }

/* CALENDAR */
.calendar { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }

/* INSTALL BANNER */
#installBanner {
  position: fixed;
  bottom: 68px;
  left: 0; right: 0;
  background: #1976d2;
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 98;
  font-size: 13px;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
}
#installBanner button {
  background: white;
  color: #1976d2;
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  margin-left: 8px;
}
#installBanner .dismiss-btn {
  background: transparent;
  color: rgba(255,255,255,0.7);
  font-weight: 400;
  font-size: 18px;
  padding: 2px 8px;
}

/* RESPONSIVE */
@media (max-width: 480px) {
  .app-header h1 { font-size: 17px; }
  .meta-value, .total-value { font-size: 26px; }
}
