:root {
  --bg-dark: #08090d;
  --bg-panel: rgba(14, 17, 26, 0.95);
  --bg-input: #121622;
  --bg-user-msg: rgba(0, 240, 255, 0.1);
  --bg-ai-msg: rgba(255, 255, 255, 0.03);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  
  --neon-cyan: #00f0ff;
  --neon-purple: #9d4edd;
  
  --text-main: #f0f3f8;
  --text-muted: #838d9e;
  
  --font-primary: 'Plus Jakarta Sans', sans-serif;
  --font-heading: 'Space Grotesk', sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-primary);
  height: 100dvh;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.app-container {
  width: 100%;
  max-width: 800px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  position: relative;
}

/* Header */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(8, 9, 13, 0.8);
  backdrop-filter: blur(12px);
  z-index: 10;
  flex-shrink: 0;
}

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

.logo-mini {
  width: 40px;
  height: 40px;
}

.logo-mini img {
  width: 100%;
  height: 100%;
}

.model-info h2 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.model-info h2 span {
  color: var(--neon-cyan);
}

.model-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  transition: color 0.2s;
}

.icon-btn:hover {
  color: var(--neon-cyan);
}

/* Obszar Wiadomości */
.chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  padding-bottom: 100px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  scroll-behavior: smooth;
}

.chat-box::-webkit-scrollbar {
  width: 6px;
}
.chat-box::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 90%;
}

.message.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.ai-message {
  align-self: flex-start;
}

.avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
}

.avatar img {
  width: 80%;
  height: 80%;
}

.bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.ai-message .bubble {
  background: var(--bg-ai-msg);
  border: 1px solid var(--border-subtle);
  border-top-left-radius: 4px;
}

.user-message .bubble {
  background: var(--bg-user-msg);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-top-right-radius: 4px;
  color: #fff;
}

/* Pole wprowadzania - teraz używa fixed i bezpiecznie unosi się nad klawiaturą */
.chat-input-area {
  padding: 12px 16px;
  background: var(--bg-dark);
  border-top: 1px solid var(--border-subtle);
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-sizing: border-box;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.input-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 8px 12px;
  transition: border-color 0.3s;
}

.input-form:focus-within {
  border-color: var(--neon-cyan);
}

.action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  padding: 8px;
  cursor: pointer;
  transition: color 0.2s;
}

.action-btn:hover {
  color: var(--neon-purple);
}

.textarea-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
}

textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
  outline: none;
  max-height: 120px;
  padding: 8px 0;
}

.send-btn {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

/* Podgląd zdjęcia przed wysłaniem */
.image-preview-container {
  position: absolute;
  bottom: 100%;
  left: 20px;
  margin-bottom: 10px;
  width: 100px;
  height: 100px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--neon-cyan);
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  background: var(--bg-dark);
}

.image-preview-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-image-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.6);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}
