/**
 * ChatArea Modern Menu & Shouts Stylesheet
 * Responsive Instagram-style Feed, Dual-Mode AJAX Enhancements,
 * and 100% Graceful Keypad Device Fallbacks.
 */

/* ==========================================================================
   Share Box Card
   ========================================================================== */
.ca-share-box-wrap {
  margin: 10px auto 14px auto;
  max-width: 640px;
  width: 100%;
  box-sizing: border-box;
}

.ca-share-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  box-sizing: border-box;
}

.ca-share-header-title {
  font-size: 12px;
  font-weight: bold;
  color: #475569;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ca-shout-input-wrap {
  width: 100%;
  box-sizing: border-box;
}

#caShoutInput {
  width: 100%;
  min-height: 48px;
  max-height: 120px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: #1e293b;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  outline: none;
  resize: vertical;
  box-sizing: border-box;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

#caShoutInput:focus {
  background: #ffffff;
  border-color: #ec4899;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.12);
}

.ca-shout-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.ca-shout-form-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

#caShoutCounter {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
}

.ca-btn-history {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #475569;
  text-decoration: none;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
}
.ca-btn-history:hover {
  background: #e2e8f0;
}

.ca-btn-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #ec4899 0%, #e11d48 100%);
  color: #ffffff;
  font-size: 12px;
  font-weight: bold;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(236, 72, 153, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.ca-btn-share:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(236, 72, 153, 0.35);
}
.ca-btn-share:active {
  transform: translateY(1px);
}
.ca-btn-share:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

#caShoutFeedback {
  margin-top: 8px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  text-align: center;
  font-weight: 600;
  display: none;
}
#caShoutFeedback.ca-success {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
  display: block;
}
#caShoutFeedback.ca-error {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  display: block;
}

/* ==========================================================================
   Instagram-Style Shout Feed & Cards
   ========================================================================== */
.ca-shout-feed {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
}

.ca-shout-card {
  background: #ffffff;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  box-sizing: border-box;
}

.ca-shout-card:hover {
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.ca-shout-header {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  text-align: center;
}

.ca-shout-user-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ca-avatar-icon {
  width: 24px;
  height: 24px;
  vertical-align: middle;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  flex-shrink: 0;
}

.ca-shout-nick {
  font-size: 13px;
  text-decoration: none;
}
.ca-shout-nick:hover {
  text-decoration: underline;
}

.ca-shout-time {
  font-size: 11px;
  color: #94a3b8;
  font-weight: normal;
}

.ca-shout-header-right {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ca-status-dot {
  width: 10px;
  height: 10px;
  vertical-align: middle;
  margin-right: 2px;
}

.ca-del-btn {
  opacity: 0.6;
  transition: opacity 0.15s ease;
  display: inline-flex;
  align-items: center;
}
.ca-del-btn:hover {
  opacity: 1;
}

.ca-shout-body {
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  color: #1e293b;
  word-break: break-word;
  background: #ffffff;
  text-align: center;
}

.ca-shout-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 12px;
  background: #ffffff;
  border-top: 1px solid #f8fafc;
  flex-wrap: wrap;
  gap: 10px;
  text-align: center;
}

.ca-shout-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ca-act-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.ca-act-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: translateY(-1px);
}

.ca-act-btn:active {
  transform: translateY(1px);
}

.ca-act-btn.ca-liked {
  background: #fee2e2;
  color: #e11d48;
  border-color: #fecaca;
  font-weight: 700;
}

.ca-act-btn.ca-disliked {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
  font-weight: 700;
}

.ca-act-btn.ca-vote-locked {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}
.ca-act-btn.ca-vote-locked:hover {
  background: #f1f5f9;
  color: #475569;
  transform: none;
}

.ca-btn-icon {
  font-size: 12px;
  line-height: 1;
}

.ca-shout-who-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ca-who-sep {
  color: #cbd5e1;
  font-size: 10px;
}

.ca-who-link {
  font-size: 11px;
  color: #64748b;
  text-decoration: none;
  padding: 2px 5px;
  border-radius: 4px;
  transition: all 0.15s ease;
}
.ca-who-link:hover {
  color: #0f172a;
  background: #f1f5f9;
  text-decoration: none;
}
.ca-who-liked:hover {
  color: #e11d48;
  background: #fee2e2;
}
.ca-who-disliked:hover {
  color: #b45309;
  background: #fef3c7;
}

/* Voter Modal Tabs */
.ca-voter-tabs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.ca-voter-tab {
  -webkit-appearance: none;
  appearance: none;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #64748b;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s ease;
}

.ca-voter-tab:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.ca-voter-tab.active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
}

.ca-voter-tab[data-tab="like"].active {
  background: #e11d48;
  border-color: #e11d48;
  color: #ffffff;
}

.ca-voter-tab[data-tab="dislike"].active {
  background: #b45309;
  border-color: #b45309;
  color: #ffffff;
}

/* Animations */
@keyframes caHeartPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.ca-heart-pop {
  animation: caHeartPulse 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes caCardSlideIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ca-card-new {
  animation: caCardSlideIn 0.4s ease-out;
}

/* ==========================================================================
   Load More & Collapse Shouts Feed Buttons
   ========================================================================== */
.ca-load-more-wrap {
  margin: 12px auto 16px auto;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ca-btn-load-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 24px;
  background: #f1f5f9;
  color: #334155;
  font-size: 12px;
  font-weight: bold;
  text-decoration: none;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.ca-btn-load-more:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.ca-btn-load-more:active {
  transform: translateY(1px);
}

.ca-btn-load-more:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.ca-btn-collapse-shouts {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 24px;
  background: #ffffff;
  color: #64748b;
  font-size: 12px;
  font-weight: bold;
  text-decoration: none;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.ca-btn-collapse-shouts:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.08);
}

.ca-btn-collapse-shouts:active {
  transform: translateY(1px);
}

.ca-no-more-shouts {
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
  padding: 6px 12px;
}

/* ==========================================================================
   Modern Modal & Bottom Sheet (For Who Liked, Comments, etc.)
   ========================================================================== */
.ca-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  box-sizing: border-box;
}

.ca-modal-overlay.ca-modal-open {
  opacity: 1;
  pointer-events: auto;
}

.ca-modal-box {
  background: #ffffff;
  border-radius: 16px;
  max-width: 380px;
  width: 100%;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transform: scale(0.92) translateY(8px);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.ca-modal-overlay.ca-modal-open .ca-modal-box {
  transform: scale(1) translateY(0);
}

.ca-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #edf2f7;
  font-size: 13px;
  font-weight: bold;
  color: #1e293b;
}

.ca-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.ca-modal-close:hover {
  color: #0f172a;
  background: #e2e8f0;
}

.ca-modal-body {
  padding: 12px 16px;
  overflow-y: auto;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-sizing: border-box;
}

.ca-modal-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.ca-modal-user-row .ca-avatar-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.ca-modal-user-row:hover {
  background: #f1f5f9;
}

.ca-modal-user-nick {
  font-size: 13px;
  font-weight: bold;
  text-decoration: none;
}

.ca-modal-empty {
  text-align: center;
  padding: 20px 10px;
  color: #94a3b8;
  font-size: 12px;
}

.ca-modal-loading {
  text-align: center;
  padding: 24px 10px;
  color: #64748b;
  font-size: 12px;
}

/* Modal Replies & Comment Styles */
.ca-modal-shout-preview {
  background: #f8fafc;
  border-left: 3px solid #6366f1;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #334155;
}

.ca-modal-shout-preview-author {
  font-weight: bold;
  margin-bottom: 2px;
  font-size: 11px;
}

.ca-modal-shout-preview-text {
  line-height: 1.4;
  word-break: break-word;
}

.ca-modal-replies-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 6px;
}

.ca-modal-reply-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  animation: caCardSlideIn 0.25s ease-out;
}

.ca-modal-reply-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.ca-modal-reply-content {
  flex: 1;
  min-width: 0;
}

.ca-modal-reply-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
  font-size: 11px;
}

.ca-modal-reply-nick {
  font-weight: bold;
  text-decoration: none;
}

.ca-modal-reply-time {
  color: #94a3b8;
  font-size: 10px;
}

.ca-modal-reply-text {
  font-size: 12px;
  color: #1e293b;
  line-height: 1.4;
  word-break: break-word;
}

.ca-modal-reply-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid #edf2f7;
  padding-top: 8px;
  margin-top: auto;
}

.ca-modal-reply-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  resize: none;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ca-modal-reply-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.ca-modal-reply-actions {
  display: flex;
  justify-content: flex-end;
}

.ca-modal-reply-submit {
  padding: 6px 14px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  font-size: 12px;
  font-weight: bold;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.ca-modal-reply-submit:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.ca-modal-reply-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
   Keypad Device & Extreme Mode Graceful Fallback (<= 320px)
   ========================================================================== */
@media screen and (max-width: 320px) {
  .ca-share-box-wrap {
    margin: 4px auto;
  }
  .ca-share-card {
    padding: 6px;
    border-radius: 4px;
  }
  #caShoutInput {
    min-height: 40px;
    font-size: 12px;
    padding: 4px 6px;
  }
  .ca-shout-form-footer {
    margin-top: 4px;
    gap: 4px;
  }
  .ca-btn-share {
    padding: 4px 10px;
    font-size: 11px;
  }
  .ca-shout-feed {
    gap: 6px;
  }
  .ca-shout-card {
    border-radius: 4px;
    box-shadow: none;
    border: 1px solid #cbd5e1;
  }
  .ca-shout-header, .ca-shout-footer {
    padding: 4px 6px;
  }
  .ca-shout-body {
    padding: 6px;
    font-size: 12px;
  }
  .ca-act-btn {
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 4px;
  }
}
