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

:root {
  --whatsapp-green: #25D366;
  --whatsapp-dark-green: #128C7E;
  --whatsapp-teal: #075E54;
  --whatsapp-light-green: #DCF8C6;
  --chat-bg: #ECE5DD;
  --header-bg: #075E54;
  --message-out: #DCF8C6;
  --message-in: #FFFFFF;
  --text-primary: #111B21;
  --text-secondary: #667781;
  --border-color: #E9EDEF;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #075E54 0%, #128C7E 50%, #25D366 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* Phone Frame */
.phone-frame {
  width: 100%;
  max-width: 420px;
  height: 90vh;
  max-height: 800px;
  background: var(--chat-bg);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Chat Container */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--chat-bg);
}

/* Header */
.chat-header {
  background: var(--header-bg);
  color: white;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

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

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--whatsapp-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-info h1 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 2px;
}

.header-info .status {
  font-size: 12px;
  opacity: 0.8;
}

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

.icon-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.date-divider {
  text-align: center;
  margin: 10px 0;
}

.date-divider span {
  background: rgba(255, 255, 255, 0.9);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Message Bubbles */
.message {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 8px;
  position: relative;
  word-wrap: break-word;
  line-height: 1.4;
  font-size: 14px;
}

.message.incoming {
  background: var(--message-in);
  align-self: flex-start;
  border-top-left-radius: 0;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.message.outgoing {
  background: var(--message-out);
  align-self: flex-end;
  border-top-right-radius: 0;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.message-text {
  color: var(--text-primary);
  white-space: pre-wrap;
}

.message-time {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: right;
  margin-top: 4px;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-items: center;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Input Area */
.chat-input {
  background: #F0F2F5;
  padding: 10px 16px;
  flex-shrink: 0;
}

.input-container {
  display: flex;
  gap: 10px;
  align-items: center;
}

#messageInput {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  background: white;
  outline: none;
}

#messageInput::placeholder {
  color: var(--text-secondary);
}

.send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--whatsapp-green);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: background 0.2s, transform 0.1s;
}

.send-btn:hover:not(:disabled) {
  background: var(--whatsapp-dark-green);
}

.send-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.send-btn:disabled {
  background: #CCC;
  cursor: not-allowed;
}

/* Cart Toggle - Right Middle */
.cart-toggle {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--whatsapp-teal);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, background 0.2s;
  z-index: 1000;
}

.cart-toggle:hover {
  transform: translateY(-50%) scale(1.1);
  background: var(--whatsapp-dark-green);
}

.cart-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #FF5252;
  color: white;
  font-size: 12px;
  font-weight: 600;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Cart Sidebar */
.cart-sidebar {
  position: absolute;
  top: 0;
  right: -300px;
  width: 280px;
  height: 100%;
  background: white;
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  z-index: 2000;
}

.cart-sidebar.open {
  right: 0;
}

.cart-header {
  background: var(--header-bg);
  color: white;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-header h2 {
  font-size: 18px;
  font-weight: 500;
}

.close-cart {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.empty-cart {
  color: var(--text-secondary);
  text-align: center;
  padding: 40px 20px;
}

.cart-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.cart-item-name {
  font-weight: 500;
  margin-bottom: 4px;
}

.cart-item-details {
  font-size: 13px;
  color: var(--text-secondary);
}

.cart-item-price {
  font-weight: 600;
  color: var(--whatsapp-teal);
  margin-top: 4px;
}

.cart-total {
  padding: 16px;
  border-top: 2px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 600;
  background: #F8F9FA;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar,
.cart-items::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.cart-items::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.cart-items::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

/* Welcome Message */
.welcome-message {
  text-align: center;
  padding: 20px;
  margin: 20px 0;
}

.welcome-logo {
  max-width: 200px;
  height: auto;
  margin-bottom: 16px;
}

.welcome-message h2 {
  color: var(--text-primary);
  font-size: 18px;
  margin-bottom: 8px;
}

.welcome-message p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Quick Actions */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.quick-action {
  padding: 8px 16px;
  background: white;
  border: 1px solid var(--whatsapp-green);
  border-radius: 20px;
  color: var(--whatsapp-teal);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-action:hover {
  background: var(--whatsapp-green);
  color: white;
}

/* Responsive */
@media (max-width: 480px) {
  body {
    padding: 0;
  }

  .phone-frame {
    max-width: 100%;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }

  /* Position cart icon higher on mobile to avoid chat input */
  .cart-toggle {
    top: 40%;
    right: 10px;
    width: 50px;
    height: 50px;
  }
}

/* Main Container */
.demo-container {
  display: flex;
  height: 100vh;
  width: 100%;
  background: linear-gradient(135deg, #075E54 0%, #128C7E 50%, #25D366 100%);
  justify-content: center;
  align-items: center;
}

.chat-main {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* Toast-Style POS */
.pos-header {
  background: #2c3e50;
  color: white;
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.pos-header h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
}

.pos-header .time {
  font-size: 18px;
  font-weight: 400;
}

.orders-display {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 25px;
  align-content: start;
}

.order-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: slideIn 0.3s ease-out;
  height: fit-content;
}

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

.order-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 2px solid #eee;
}

.order-number {
  font-size: 28px;
  font-weight: bold;
  color: #2c3e50;
}

.order-timer {
  background: #e74c3c;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  min-width: 45px;
  text-align: center;
}

.order-items {
  margin: 20px 0;
}

.order-item {
  padding: 10px 0;
  font-size: 16px;
  color: #333;
  display: flex;
  justify-content: space-between;
}

.order-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 2px solid #eee;
}

.order-total {
  font-weight: bold;
  font-size: 18px;
  color: #2c3e50;
}

.pickup-time {
  background: #3498db;
  color: white;
  padding: 5px 12px;
  border-radius: 15px;
  font-size: 14px;
  font-weight: 500;
}

.no-orders {
  grid-column: 1 / -1;
  text-align: center;
  color: #999;
  font-size: 20px;
  padding: 60px;
  background: white;
  border-radius: 12px;
  margin: 20px;
}

/* Phone frame adjustments */
.chat-main .phone-frame {
  width: 100%;
  max-width: 450px;
  height: calc(100vh - 40px);
  margin: auto;
}

/* Mobile-First Responsive Design */
@media (max-width: 1024px) {
  .kitchen-sidebar {
    width: 280px;
    left: -280px;
  }

  .kitchen-sidebar.open {
    left: 0;
  }
}

/* Kitchen Toggle Button - Left Middle */
.kitchen-toggle {
  position: fixed;
  top: 50%;
  left: 20px;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF6B6B, #FF5252);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(255, 82, 82, 0.3);
  transition: transform 0.2s, background 0.2s, opacity 0.5s;
  z-index: 1000;
  opacity: 0;
}

.kitchen-toggle[style*="display: flex"] {
  animation: slideInLeft 0.5s ease-out forwards, pulse 2s infinite 0.5s;
  opacity: 1;
}

@keyframes slideInLeft {
  from {
    transform: translateY(-50%) translateX(-100px);
    opacity: 0;
  }
  to {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 4px 12px rgba(255, 82, 82, 0.3);
  }
  50% {
    box-shadow: 0 4px 20px rgba(255, 82, 82, 0.5);
  }
  100% {
    box-shadow: 0 4px 12px rgba(255, 82, 82, 0.3);
  }
}

.kitchen-toggle:hover {
  transform: translateY(-50%) scale(1.1);
  background: linear-gradient(135deg, #FF5252, #FF4444);
}

.kitchen-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #4CAF50;
  color: white;
  font-size: 12px;
  font-weight: 600;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Kitchen Sidebar - Left Side */
.kitchen-sidebar {
  position: absolute;
  top: 0;
  left: -320px;
  width: 300px;
  height: 100%;
  background: white;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
  transition: left 0.3s ease;
  display: flex;
  flex-direction: column;
  z-index: 2000;
}

.kitchen-sidebar.open {
  left: 0;
}

.kitchen-header {
  background: #2c3e50;
  color: white;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.kitchen-header h2 {
  font-size: 18px;
  font-weight: 500;
  margin: 0;
}

.kitchen-header .time {
  font-size: 14px;
  opacity: 0.9;
}

.close-kitchen {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
}

.kitchen-orders {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f5f5f5;
}

/* Reuse order card styles for kitchen sidebar */
.kitchen-orders .order-card {
  background: white;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.kitchen-orders .no-orders {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 20px;
  font-size: 14px;
}

/* Animation for smooth expansion */
@keyframes expandIcon {
  0% {
    transform: translateY(-50%) scale(1);
  }
  100% {
    transform: translateY(-50%) scale(1);
  }
}

/* Ensure floating icon stays above other content */
.floating-icon-container:hover {
  z-index: 10000;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  /* Position kitchen toggle on left side, higher to avoid chat input */
  .kitchen-toggle {
    top: 40%;
    left: 10px;
    width: 55px;
    height: 55px;
  }

  /* Adjust cart toggle for tablets */
  .cart-toggle {
    top: 40%;
    right: 15px;
    width: 55px;
    height: 55px;
  }

  .kitchen-sidebar {
    width: 75vw;
    max-width: 300px;
    left: -75vw;
  }

  .kitchen-sidebar.open {
    left: 0;
  }
}

@media (max-width: 480px) {
  .chat-main {
    padding: 0;
  }

  .chat-main .phone-frame {
    border-radius: 0;
    height: 100vh;
    max-width: 100%;
  }

  /* Kitchen toggle positioned left, above middle to avoid input */
  .kitchen-toggle {
    top: 35%;
    left: 5px;
    width: 45px;
    height: 45px;
  }

  /* Cart toggle positioned right, above middle to avoid input */
  .cart-toggle {
    top: 35%;
    right: 5px;
    width: 45px;
    height: 45px;
  }

  .cart-count,
  .kitchen-count {
    width: 18px;
    height: 18px;
    font-size: 10px;
    top: -3px;
    right: -3px;
  }

  .kitchen-sidebar {
    width: 85vw;
    max-width: 100%;
    left: -85vw;
  }

  .kitchen-sidebar.open {
    left: 0;
  }
}
