/* ═══════════════════════════════════════════
   Customer Portal Styles
   ═══════════════════════════════════════════ */

/* ── Site Header ── */
.site-header {
  background: white; border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: flex; align-items: center; gap: 0.5rem; font-size: 1.1rem; font-weight: 700; color: var(--gray-900); text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo-icon { height: 64px; width: auto; max-width: 220px; object-fit: contain; }
.header-nav { display: flex; gap: 0.75rem; align-items: center; }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
  color: white; padding: 3.5rem 1.5rem; text-align: center;
}
.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 0.75rem; }
.hero p { font-size: 1.1rem; opacity: 0.9; margin-bottom: 1.5rem; }

.support-status-banner {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: rgba(255,255,255,0.15); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px; padding: 0.5rem 1.2rem; font-size: 0.9rem;
}
.support-status-banner.online { background: rgba(22,163,74,0.2); border-color: rgba(22,163,74,0.4); }
.support-status-banner.offline { background: rgba(107,114,128,0.2); border-color: rgba(107,114,128,0.4); }

/* ── Main Grid ── */
.main-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
  padding-top: 2rem; padding-bottom: 3rem;
}
@media (max-width: 768px) {
  .main-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.8rem; }
}

/* ── Site Footer ── */
.site-footer {
  background: white; border-top: 1px solid var(--gray-200);
  padding: 1.25rem 0; text-align: center;
  font-size: 0.85rem; color: var(--gray-500);
}

/* ═══════════════════════════════════════════
   Chat Widget
   ═══════════════════════════════════════════ */
.chat-widget { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1000; }

/* Launcher */
.chat-launcher {
  width: 56px; height: 56px; border-radius: 50%; background: var(--primary);
  border: none; cursor: pointer; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s; position: relative;
}
.chat-launcher:hover { transform: scale(1.08); box-shadow: 0 12px 24px rgba(79,70,229,0.4); }
.launcher-icon { font-size: 1.5rem; }
.chat-badge {
  position: absolute; top: -4px; right: -4px; background: #EF4444;
  color: white; border-radius: 50%; width: 20px; height: 20px;
  font-size: 0.7rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}

/* Window */
.chat-window {
  position: absolute; bottom: 70px; right: 0; width: 360px;
  background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200); overflow: hidden; display: flex; flex-direction: column;
  max-height: 540px; animation: chatSlideIn 0.2s ease;
}
@keyframes chatSlideIn { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: none; } }

.chat-header {
  background: var(--primary); color: white; padding: 1rem 1.1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.chat-header-info { display: flex; align-items: center; gap: 0.75rem; }
.chat-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.25); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.chat-title { font-weight: 700; font-size: 0.95rem; }
.chat-subtitle { font-size: 0.8rem; opacity: 0.85; }
.chat-subtitle.online { color: #86EFAC; }
.chat-subtitle.offline { color: #D1D5DB; }
.chat-close { background: none; border: none; color: rgba(255,255,255,0.8); cursor: pointer; font-size: 1rem; padding: 0.25rem; border-radius: 4px; }
.chat-close:hover { color: white; background: rgba(255,255,255,0.15); }

/* Chat panels */
.chat-panel { padding: 1.1rem; flex: 1; overflow-y: auto; }
.chat-welcome { margin-bottom: 1rem; }
.chat-welcome p { color: var(--gray-700); font-size: 0.95rem; }

/* Messages */
.chat-messages { flex: 1; overflow-y: auto; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.msg-list { display: flex; flex-direction: column; gap: 0.5rem; }
.msg { display: flex; }
.msg-customer { justify-content: flex-end; }
.msg-agent { justify-content: flex-start; }
.msg-bubble { max-width: 82%; padding: 0.55rem 0.9rem 0.5rem; border-radius: 12px; word-break: break-word; overflow-wrap: break-word; }
.msg-customer .msg-bubble { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.msg-agent .msg-bubble { background: var(--gray-100); color: var(--gray-900); border-bottom-left-radius: 4px; }
.msg-text { font-size: 0.9rem; line-height: 1.45; white-space: pre-line; }
.msg-meta { font-size: 0.72rem; opacity: 0.7; margin-top: 0.25rem; white-space: nowrap; }
.msg-customer .msg-meta { text-align: right; }
.msg-system { justify-content: center; margin: 0.1rem 0; }
.msg-system-text { font-size: 0.72rem; color: var(--gray-500); padding: 0.1rem 0; }

/* Input */
.chat-input-area { padding: 0.75rem; border-top: 1px solid var(--gray-200); display: flex; gap: 0.5rem; align-items: center; }
.chat-input-area .attach-btn { font-size: 1.2rem; cursor: pointer; opacity: 0.6; flex-shrink: 0; line-height: 1; }
.chat-input-area .attach-btn:hover { opacity: 1; }
.chat-input-area input {
  flex: 1; padding: 0.5rem 0.75rem; border: 1.5px solid var(--gray-300);
  border-radius: var(--radius); font-size: 0.875rem;
}
.chat-input-area input:focus { outline: none; border-color: var(--primary); }
.chat-file-msg img { max-width: 190px; max-height: 130px; border-radius: 6px; display: block; margin-top: 0.2rem; }
.chat-file-link { color: inherit; text-decoration: underline; font-size: 0.875rem; word-break: break-all; }

/* Typing indicator */
.typing-indicator { display: flex; align-items: center; gap: 4px; padding: 0.4rem 0; }
.typing-indicator span { width: 7px; height: 7px; background: var(--gray-400); 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); } 30% { transform: translateY(-5px); } }

/* Offline note */
.offline-note { padding: 1.25rem; text-align: center; color: var(--gray-700); font-size: 0.9rem; line-height: 1.7; }
.offline-note p + p { margin-top: 0.5rem; }

@media (max-width: 480px) {
  .chat-window { width: calc(100vw - 1rem); right: -0.5rem; bottom: 65px; }
  .chat-widget { bottom: 1rem; right: 1rem; }
  .site-header .header-inner { flex-wrap: wrap; height: auto; min-height: 56px; padding: 0.5rem 0.75rem; gap: 0.5rem; }
  .header-nav { gap: 0.5rem; }
  .hero h1 { font-size: 1.5rem; }
  .hero { padding: 2rem 1rem; }
  .container { padding: 0 0.75rem; }
  .form-row { grid-template-columns: 1fr; }
  .card { padding: 1rem; }
}

@media (max-width: 360px) {
  .header-nav .btn { padding: 0.35rem 0.6rem; font-size: 0.78rem; }
  .chat-window { width: calc(100vw - 0.5rem); right: -0.25rem; }
}
