* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  overflow: hidden;
  background: #f5f5f5;
  height: 100vh;
  width: 100vw;
}

.screen {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Shared Header & Menu */
.app-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 16px;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none; /* Let clicks pass through to map where empty */
}

.menu-btn {
  pointer-events: auto;
  background: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #333;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: white;
  z-index: 2001;
  transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.sidebar.active {
  transform: translateX(280px);
}

.sidebar-header {
  padding: 30px 20px;
  background: linear-gradient(135deg, #009EE3 0%, #0082C3 100%);
  color: white;
}

.user-info .user-name {
  font-size: 18px;
  font-weight: 700;
  display: block;
}

.user-info .user-email {
  font-size: 14px;
  opacity: 0.8;
}

.sidebar-menu {
  padding: 20px 0;
  flex: 1;
  overflow-y: auto;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  color: #333;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s;
}

.menu-item:active {
  background: #F5F5F5;
}

.menu-item.active {
  color: #009EE3;
  background: #F0F9FF;
  border-right: 3px solid #009EE3;
}

.menu-icon {
  width: 24px;
  text-align: center;
}

/* Internal Pages Layout */
.page-container {
  padding: 80px 16px 120px;
  height: 100vh;
  background: #f5f5f5;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: #333;
  margin-bottom: 20px;
}

.card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

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

/* Login/Register Screens */
#login-screen, #register-screen {
  background: linear-gradient(135deg, #009EE3 0%, #0082C3 100%);
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 400px;
}

.logo-section {
  text-align: center;
  margin-bottom: 40px;
}

.logo-section.small {
  margin-bottom: 30px;
}

.logo-circle {
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.app-name {
  color: white;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

.app-tagline {
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
}

.form-title {
  color: white;
  font-size: 28px;
  font-weight: 600;
}

.form-container {
  background: white;
  border-radius: 20px;
  padding: 30px 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.input-field {
  width: 100%;
  padding: 16px;
  border: 2px solid #E8E8E8;
  border-radius: 12px;
  font-size: 16px;
  margin-bottom: 16px;
  transition: all 0.3s;
}

.input-field:focus {
  outline: none;
  border-color: #009EE3;
  background: #F0F9FF;
}

.primary-btn {
  width: 100%;
  padding: 18px;
  background: #009EE3;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(0, 158, 227, 0.3);
}

.primary-btn:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(0, 158, 227, 0.3);
}

.switch-text {
  text-align: center;
  margin-top: 20px;
  color: #666;
  font-size: 14px;
}

.switch-text span {
  color: #009EE3;
  font-weight: 600;
  cursor: pointer;
}

/* Main Screen */
#main-screen {
  position: relative;
}

.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  padding: 12px 16px 16px 16px;
  border-radius: 0 0 24px 24px;
}

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

.header-logo {
  font-size: 20px;
  font-weight: 800;
  color: #333;
  letter-spacing: -0.5px;
  text-align: center;
  flex: 1;
}

.header-spacer {
  width: 44px;
}

.top-bar .menu-btn {
  background: #F5F5F5;
  box-shadow: none;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
}

.balance-section {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.balance-item {
  flex: 1;
  background: linear-gradient(135deg, #009EE3 0%, #0082C3 100%);
  padding: 12px;
  border-radius: 16px;
  color: white;
  min-width: 0;
}

.balance-label {
  display: block;
  font-size: 11px;
  opacity: 0.9;
  margin-bottom: 4px;
  white-space: nowrap;
}

.balance-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.balance-value.pending {
  color: #FFD700;
}

.action-buttons {
  display: flex;
  gap: 12px;
}

.action-btn {
  flex: 1;
  padding: 14px;
  background: #F5F5F5;
  border: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  transition: all 0.3s;
}

.action-btn:active {
  transform: scale(0.95);
  background: #E8E8E8;
}

/* Map */
#map {
  width: 100%;
  height: 100vh;
  position: relative;
}

.leaflet-container {
  background: linear-gradient(135deg, #E8F0F2 0%, #D4E4E8 100%);
}

.leaflet-tile-container {
  filter: none;
}

/* Status Panel */
.status-panel {
  position: absolute;
  top: 220px;
  left: 16px;
  right: 16px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 12px 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.status-panel.hidden {
  transform: translateY(-120%);
  opacity: 0;
  pointer-events: none;
}

.status-header {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  align-items: center;
}

.status-icon {
  font-size: 30px;
  animation: float 2s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.status-info h3 {
  font-size: 15px;
  margin-bottom: 2px;
  color: #333;
}

.status-info p {
  font-size: 13px;
  color: #666;
}

.status-progress {
  margin-top: 10px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #E8E8E8;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #009EE3, #00D4FF);
  border-radius: 10px;
  transition: width 0.3s;
  width: 0%;
}

.status-earnings {
  text-align: right;
  color: #00C853;
  font-weight: 700;
  font-size: 18px;
}

/* Deliveries Panel */
.deliveries-panel {
  position: absolute;
  bottom: 20px;
  left: 16px;
  right: 16px;
  z-index: 1000;
  background: white;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.1);
  max-height: 250px;
  overflow: hidden;
}

.panel-title {
  font-size: 16px;
  margin-bottom: 16px;
  color: #333;
}

.deliveries-list {
  max-height: 180px;
  overflow-y: auto;
}

.delivery-item {
  background: #F8F9FA;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.delivery-item:active {
  transform: scale(0.98);
  border-color: #009EE3;
  background: #F0F9FF;
}

.delivery-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.delivery-restaurant {
  font-weight: 600;
  color: #333;
  font-size: 15px;
}

.delivery-fee {
  color: #00C853;
  font-weight: 700;
  font-size: 15px;
}

.delivery-address {
  font-size: 13px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Bottom Action */
.bottom-action {
  position: absolute;
  bottom: 140px;
  left: 16px;
  right: 16px;
  z-index: 1000;
  transition: all 0.3s;
}

.bottom-action.hidden {
  transform: translateY(150%);
  opacity: 0;
  pointer-events: none;
}

.complete-btn {
  width: 100%;
  padding: 20px;
  background: linear-gradient(135deg, #00C853 0%, #00A843 100%);
  color: white;
  border: none;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 200, 83, 0.4);
  transition: all 0.3s;
}

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

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow: auto;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid #E8E8E8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  color: #333;
}

.close-modal {
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
}

.modal-body {
  padding: 20px;
}

.modal-balance {
  text-align: center;
  margin-bottom: 20px;
  font-size: 16px;
  color: #666;
}

.modal-balance strong {
  color: #009EE3;
  font-size: 20px;
}

/* Delivery Marker */
.delivery-marker {
  background: white;
  border: 3px solid #FF6B35;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
  animation: pulse 2s infinite;
}

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

/* Drone Marker */
.drone-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

.drone-glow {
  position: absolute;
  width: 50px;
  height: 50px;
  background: rgba(0, 158, 227, 0.4);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(0, 158, 227, 0.6);
  animation: drone-pulse 1.5s infinite;
  z-index: 1;
}

.drone-img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  z-index: 2;
  filter: drop-shadow(0 10px 10px rgba(0,0,0,0.3));
  animation: drone-fly 2s ease-in-out infinite;
}

@keyframes drone-pulse {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(2.0); opacity: 0; }
}

@keyframes drone-fly {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-10px) rotate(5deg); }
}

/* Destination Marker */
.destination-marker {
  position: relative;
}

.dest-pin {
  text-align: center;
  animation: bounce 2s ease-in-out infinite;
}

.dest-icon {
  font-size: 40px;
  filter: drop-shadow(0 4px 8px rgba(255, 0, 0, 0.4));
}

.dest-label {
  background: white;
  color: #FF4444;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 12px;
  margin-top: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Route Line Animation */
.route-line {
  animation: dash 20s linear infinite;
}

@keyframes dash {
  to {
    stroke-dashoffset: -1000;
  }
}

/* Restaurant Marker */
.restaurant-marker {
  position: relative;
}

.marker-pin {
  text-align: center;
  animation: pulse 2s ease-in-out infinite;
}

.marker-icon {
  font-size: 32px;
  background: white;
  border: 3px solid #FF6B35;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 8px rgba(255, 107, 53, 0.4));
}

/* Telegram Banner */
.top-bar .telegram-banner {
  width: 100%;
  margin-top: 8px;
  padding: 0;
  display: block;
}

.top-bar .telegram-banner-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #0088cc 0%, #0066aa 100%);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0, 136, 204, 0.3);
  width: 100%;
  box-sizing: border-box;
}

.top-bar .telegram-banner-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 136, 204, 0.4);
}

.top-bar .telegram-banner-icon {
  font-size: 16px;
  display: inline-block;
}

.top-bar .telegram-banner-text {
  flex: 1;
  text-align: center;
  display: inline-block;
}

.top-bar .telegram-banner-arrow {
  font-size: 16px;
  opacity: 0.8;
  display: inline-block;
}