/* ============================================================
   Kinobo Monthly - Light Tech Design System
   ============================================================ */

:root {
  --primary: #3b82f6;
  --primary-light: #eff6ff;
  --primary-dark: #1d4ed8;
  --primary-muted: #93c5fd;
  --accent: #06b6d4;
  --accent-light: #ecfeff;
  --bg: #f8fafc;
  --bg-white: #ffffff;
  --text: #0f172a;
  --text-light: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(59,130,246,0.08);
  --shadow-lg: 0 12px 32px rgba(59,130,246,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --font-main: 'Inter', 'Noto Sans JP', -apple-system, sans-serif;
  --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }
body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ============================================================
   Header
   ============================================================ */
.header {
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
  color: white;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: white;
}
.logo-icon {
  width: 36px;
  height: 36px;
  background: rgba(59,130,246,0.3);
  border: 1px solid rgba(59,130,246,0.5);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.logo-sub {
  font-size: 0.6rem;
  opacity: 0.6;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.lang-switcher {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 3px;
}
.lang-btn {
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.6);
  padding: 4px 12px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition);
}
.lang-btn.active {
  background: var(--primary);
  color: white;
}
.lang-btn:hover:not(.active) {
  background: rgba(255,255,255,0.15);
  color: white;
}

/* ============================================================
   Chat Layout
   ============================================================ */
.chat-container {
  max-width: 900px;
  margin: 0 auto;
  height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  scroll-behavior: smooth;
}

/* Welcome Card */
.welcome-card {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-light) 100%);
  border: 1px solid #dbeafe;
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  text-align: center;
}
.welcome-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid white;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.welcome-card h2 {
  font-size: 1.15rem;
  color: var(--primary-dark);
  margin-bottom: 6px;
}
.welcome-card p {
  font-size: 0.88rem;
  color: var(--text-light);
  line-height: 1.7;
}

/* Quick Options */
.quick-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}
.quick-btn {
  background: white;
  border: 1px solid #dbeafe;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--primary-dark);
  transition: var(--transition);
  white-space: nowrap;
  font-family: var(--font-main);
}
.quick-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.quick-btn:active {
  transform: scale(0.96);
  transition: 0.05s;
}

/* Messages */
.message {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  animation: fadeInUp 0.3s ease;
}
.message.user {
  flex-direction: row-reverse;
}
.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.msg-avatar.user-avatar {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
}
.msg-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-wrap;
}
.message:not(.user) .msg-bubble {
  background: white;
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}
.message.user .msg-bubble {
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: white;
  border-top-right-radius: 4px;
}

/* Message Timestamp */
.msg-timestamp {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}
.message.user .msg-timestamp {
  text-align: right;
}

/* Scroll to bottom button */
.scroll-bottom-btn {
  position: absolute;
  bottom: 140px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: white;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: var(--transition);
  color: var(--text-light);
  font-size: 1.1rem;
}
.scroll-bottom-btn.visible { display: flex; }
.scroll-bottom-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary-muted);
}

/* Property Cards */
.property-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
.property-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  transition: var(--transition);
  cursor: pointer;
}
.property-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--primary-muted);
}
.property-card-image {
  width: 120px;
  min-height: 100px;
  object-fit: cover;
  flex-shrink: 0;
}
.property-card-body {
  padding: 12px;
  flex: 1;
  min-width: 0;
}
.property-card-name {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--text);
}
.property-card-info {
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.5;
}
.property-card-price {
  color: var(--primary);
  font-weight: 700;
  font-size: 1rem;
  margin-top: 4px;
}
.property-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.property-tag {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.typing-dots {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-top-left-radius: 4px;
  padding: 14px 20px;
  display: flex;
  gap: 5px;
  align-items: center;
}
.typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--primary-muted);
  border-radius: 50%;
  animation: typing 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Chat Input
   ============================================================ */
.chat-input-area {
  padding: 12px 16px 16px;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
}
.input-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.option-chip {
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  color: var(--primary-dark);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: var(--font-main);
}
.option-chip:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.option-chip:active {
  transform: scale(0.96);
  transition: 0.05s;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-family: var(--font-main);
  resize: none;
  outline: none;
  max-height: 100px;
  line-height: 1.5;
  transition: var(--transition);
}
.chat-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}
.send-btn:disabled {
  background: var(--primary-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  animation: pulse-send 1.5s infinite;
}
@keyframes pulse-send {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
.send-btn:disabled svg {
  animation: spin-send 1.2s linear infinite;
}
@keyframes spin-send {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.send-btn svg {
  width: 20px;
  height: 20px;
}

/* ============================================================
   Contact Form Modal
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.3s ease;
}
.modal h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text);
}
.modal-field {
  margin-bottom: 14px;
}
.modal-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 4px;
}
.modal-field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: var(--font-main);
  outline: none;
  transition: var(--transition);
}
.modal-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.modal-actions button {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-main);
}
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: white;
  color: var(--text-light);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }

/* ============================================================
   Property Detail Modal
   ============================================================ */
.property-modal {
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
.property-modal-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
  margin: -32px -32px 20px -32px;
  width: calc(100% + 64px);
}
.property-modal h3 { margin-bottom: 4px; }
.property-modal-address {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 16px;
}
.property-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.property-modal-item { font-size: 0.85rem; }
.property-modal-item label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.property-modal-equip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}
.property-modal-nearby {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.6;
}

/* ============================================================
   Chat Footer Links Bar
   ============================================================ */
.chat-footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 8px 16px;
  background: var(--bg);
  border-top: 1px solid var(--border-light);
  font-size: 0.72rem;
}
.chat-footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}
.chat-footer-links a:hover { color: var(--primary); }

/* ============================================================
   Rating Stars
   ============================================================ */
.rating-card {
  background: var(--primary-light);
  border: 1px solid #dbeafe;
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
  margin-top: 12px;
  animation: fadeInUp 0.3s ease;
}
.rating-card p {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 10px;
}
.rating-stars {
  display: flex;
  justify-content: center;
  gap: 6px;
}
.rating-star {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  opacity: 0.4;
}
.rating-star:hover, .rating-star.active {
  opacity: 1;
  transform: scale(1.2);
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 40px 24px;
  font-size: 0.82rem;
  line-height: 1.8;
}
.footer-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
}
.footer h4 {
  color: white;
  font-size: 0.85rem;
  margin-bottom: 12px;
  font-weight: 600;
}
.footer a {
  color: #94a3b8;
  text-decoration: none;
  transition: var(--transition);
}
.footer a:hover { color: var(--primary-muted); }
.footer-bottom {
  max-width: 1000px;
  margin: 24px auto 0;
  padding-top: 20px;
  border-top: 1px solid #1e293b;
  text-align: center;
  font-size: 0.75rem;
}

/* ============================================================
   Static Pages
   ============================================================ */
.page-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px;
}
.page-container h1 {
  font-size: 1.5rem;
  margin-bottom: 24px;
  color: var(--text);
}
.page-container h2 {
  font-size: 1.1rem;
  margin-top: 28px;
  margin-bottom: 12px;
  color: var(--text);
}
.page-container p, .page-container li {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.8;
  margin-bottom: 8px;
}
.page-container ul, .page-container ol { padding-left: 20px; }
.page-container table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}
.page-container th, .page-container td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  font-size: 0.85rem;
}
.page-container th {
  background: var(--primary-light);
  font-weight: 600;
  color: var(--primary-dark);
}

/* ============================================================
   History / Admin Pages
   ============================================================ */
.login-card {
  max-width: 380px;
  margin: 60px auto;
  background: white;
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-card h2 { font-size: 1.1rem; margin-bottom: 20px; }
.login-card input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 1rem;
  text-align: center;
  letter-spacing: 8px;
  margin-bottom: 16px;
  outline: none;
}
.login-card input:focus { border-color: var(--primary); }
.login-card button {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.login-card button:hover { background: var(--primary-dark); }
.login-error { color: #ef4444; font-size: 0.85rem; margin-bottom: 12px; }

.sessions-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.sessions-table th {
  background: linear-gradient(135deg, #1e3a5f, #0f172a);
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 600;
}
.sessions-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
  color: var(--text-light);
}
.sessions-table tr:hover td { background: var(--primary-light); }
.sessions-table a { color: var(--primary); text-decoration: none; font-weight: 600; }
.sessions-table a:hover { text-decoration: underline; }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
}
.status-badge.active { background: #dcfce7; color: #16a34a; }
.status-badge.closed { background: #dbeafe; color: #2563eb; }

.chat-log { max-width: 700px; margin: 20px auto; }
.chat-log .msg-row { display: flex; gap: 8px; margin-bottom: 12px; align-items: flex-start; }
.chat-log .msg-row.user { flex-direction: row-reverse; }
.chat-log .msg-role { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); min-width: 60px; }
.chat-log .msg-content {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.6;
  max-width: 80%;
  white-space: pre-wrap;
}
.chat-log .msg-row.user .msg-content { background: var(--primary-light); border-color: #bfdbfe; }
.chat-log .msg-time { font-size: 0.7rem; color: var(--text-muted); }

/* ============================================================
   Tech Grid
   ============================================================ */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.tech-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.tech-card h4 { font-size: 0.9rem; color: var(--primary); margin-bottom: 8px; }
.tech-card p { font-size: 0.82rem; color: var(--text-light); margin: 0; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .header-inner { padding: 10px 16px; }
  .logo-text { font-size: 0.95rem; }
  .logo-sub { display: none; }
  .chat-messages { padding: 12px 10px; }
  .msg-bubble { max-width: 85%; }
  .property-card { flex-direction: column; }
  .property-card-image { width: 100%; height: 120px; }
  .welcome-card { padding: 20px; }
  .footer-inner { grid-template-columns: 1fr; }
  .quick-options { justify-content: flex-start; }
  .property-modal { padding: 20px; }
  .property-modal-image { margin: -20px -20px 16px -20px; width: calc(100% + 40px); }
  .property-modal-grid { grid-template-columns: 1fr; }
  .chat-footer-links { flex-wrap: wrap; gap: 10px; }
}
