@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Playfair+Display:ital,wght@0,500;0,600;0,700;1,500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

:root {
  /* Coffee Cafe Black & White Theme */
  --bg-color: #f4f2ee; /* Very light warm grey/cream */
  --surface: #ffffff;
  --surface-alt: #fcfbfa;
  --text-primary: #121110;
  --text-secondary: #6e6b68;
  --border-light: #e6e4df;
  --border-dark: #2a2826;
  --black: #121110;
  --white: #ffffff;
  --accent: #2a2826;
  
  --radius: 20px;
  --radius-sm: 10px;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 20px 48px rgba(0, 0, 0, 0.1);
  --transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  
  --receipt-bg: #fffdf9;
}

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

body {
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Background Effect */
.ambient-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(200, 195, 185, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(200, 195, 185, 0.15) 0%, transparent 50%);
  pointer-events: none;
}

.ambient-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  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='%23121110' 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");
  opacity: 0.8;
}

/* Main Layout */
.shell {
  width: min(1280px, 100vw - 48px);
  height: min(840px, 100vh - 48px);
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 32px;
  align-items: stretch;
  z-index: 1;
  animation: shellEnter 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  opacity: 0;
  transform: translateY(20px);
}

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

/* Panels */
.counter, .conversation {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}

.counter::before, .conversation::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: var(--black);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.counter:hover::before, .conversation:hover::before {
  transform: scaleX(1);
}

.counter {
  padding: 36px;
  gap: 36px;
}

/* Header / Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-light);
}

.logo-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--black);
  color: var(--white);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  transition: transform 0.4s ease;
  position: relative;
}

.counter:hover .logo-mark {
  transform: rotate(-5deg) scale(1.05);
}

/* Steam Animation inside logo */
.steam-icon line {
  animation: steamRise 3s infinite ease-in-out;
  transform-origin: bottom;
}

.steam-icon line:nth-child(2) {
  animation-delay: 0.5s;
}

.steam-icon line:nth-child(3) {
  animation-delay: 1s;
}

@keyframes steamRise {
  0% { transform: translateY(0) scaleY(1); opacity: 0.5; }
  50% { transform: translateY(-4px) scaleY(1.2); opacity: 1; }
  100% { transform: translateY(-8px) scaleY(1); opacity: 0; }
}


.brand-text h1 {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  margin: 0 0 4px 0;
  line-height: 1;
  letter-spacing: -0.5px;
  color: var(--black);
}

.status-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.3s;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #10B981;
  border-radius: 50%;
  position: relative;
}

.status-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid #10B981;
  animation: pulse 2s infinite cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes pulse {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

/* Controls */
.controls-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-wrapper label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

input {
  min-height: 52px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text-primary);
  padding: 0 16px;
  font-size: 15px;
  transition: var(--transition);
}

input:focus {
  outline: none;
  border-color: var(--black);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(0,0,0,0.04);
}

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

.secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

button {
  font-family: inherit;
  border: none;
  outline: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 15px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  min-height: 56px;
  background: var(--black);
  color: var(--white);
  font-size: 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.btn-primary:hover:not(:disabled)::after {
  opacity: 1;
}

.btn-primary svg {
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.btn-primary:hover:not(:disabled) svg {
  transform: translateX(4px);
}

.btn-secondary {
  min-height: 48px;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--black);
  background: var(--surface-alt);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  filter: grayscale(100%);
  transform: none !important;
  box-shadow: none !important;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-secondary);
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-alt);
  color: var(--black);
  border-color: var(--black);
  transform: rotate(15deg);
}

/* Order Panel / Receipt */
.order-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 16px;
  min-height: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  color: var(--black);
  margin: 0;
  font-weight: 600;
}

.receipt {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--receipt-bg);
  border: 1px dashed #d0c8b8;
  border-radius: 8px;
  padding: 24px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.01);
  overflow: hidden;
  position: relative;
  transition: var(--transition);
}

.receipt:hover {
  box-shadow: inset 0 0 30px rgba(0,0,0,0.02), 0 4px 12px rgba(0,0,0,0.02);
}

.receipt::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    #e6e1d6 4px,
    #e6e1d6 8px
  );
}

.receipt-header {
  text-align: center;
  text-transform: uppercase;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px dashed #d0c8b8;
}

pre {
  flex: 1;
  margin: 0;
  overflow: auto;
  color: var(--black);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  font-family: 'Space Mono', monospace;
}

.receipt-footer {
  text-align: center;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed #d0c8b8;
}

/* Conversation */
.chat-header {
  padding: 28px 36px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.room-badge {
  font-size: 11px;
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  padding: 4px 10px;
  border-radius: 12px;
  color: var(--text-secondary);
  font-family: 'Space Mono', monospace;
}

.room-badge:empty {
  display: none;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  scroll-behavior: smooth;
  background: linear-gradient(to bottom, var(--surface), var(--surface-alt));
}

.message {
  max-width: 80%;
  padding: 18px 24px;
  line-height: 1.6;
  font-size: 15px;
  animation: slideUpFade 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  opacity: 0;
  transform: translateY(15px);
  position: relative;
}

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

.message.you {
  align-self: flex-end;
  background: var(--black);
  color: var(--white);
  border-radius: 24px 24px 4px 24px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.message.brew {
  align-self: flex-start;
  background: var(--surface);
  color: var(--black);
  border: 1px solid var(--border-light);
  border-radius: 24px 24px 24px 4px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.03);
}

.message.brew::before {
  content: 'Barista';
  position: absolute;
  top: -24px;
  left: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.message.you::before {
  content: 'You';
  position: absolute;
  top: -24px;
  right: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.message.system {
  align-self: center;
  color: var(--text-secondary);
  background: var(--surface);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 20px;
  border: 1px dashed var(--border-light);
  border-radius: 20px;
  max-width: 90%;
  text-align: center;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
  margin: 8px 0;
}
::-webkit-scrollbar-thumb {
  background: #dcd7ce;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #beb9b0;
}

/* Responsive */
@media (max-width: 900px) {
  body {
    align-items: flex-start;
    padding: 16px;
    overflow: auto;
  }
  .shell {
    grid-template-columns: 1fr;
    height: auto;
    width: 100%;
    gap: 24px;
  }
  .counter {
    padding: 24px;
  }
  .conversation {
    height: 600px;
  }
}
