/* ===============================
   CHAT PAGE – FINAL MERGED CSS
================================*/

/* Chat wrapper */
.chat-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
}

/* Chat Box */
.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Suggestions Row */
.suggestions {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    margin-bottom: 12px;
}

.chip {
    background: var(--card);
    padding: 8px 14px;
    border-radius: 18px;
    border: 1px solid var(--subtext);
    font-size: 13px;
    white-space: nowrap;
    color: var(--text);
    cursor: pointer;
}

/* Message Bubbles */
.user-bubble,
.ai-bubble {
    max-width: 75%;
    padding: 12px 15px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.4;
    animation: pop .25s ease-out;
}

@keyframes pop {
    from { transform: scale(0.95); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.user-bubble {
    align-self: flex-end;
    background: var(--primary);
    color: white;
}

.ai-bubble {
    align-self: flex-start;
    background: var(--card);
    color: var(--text);
    border: 1px solid rgba(0,0,0,0.1);
}

/* Dark mode AI bubble fix */
body.dark .ai-bubble {
    background: #1b1b1d;
    border-color: rgba(255,255,255,0.12);
}

/* Typing indicator */
.typing-indicator {
    align-self: flex-start;
    padding: 10px 14px;
    background: var(--card);
    border-radius: 18px;
    width: fit-content;
    display: flex;
    gap: 5px;
}

.dot {
    height: 8px;
    width: 8px;
    background: var(--subtext);
    border-radius: 50%;
    animation: blink 1s infinite;
}

.dot:nth-child(2) { animation-delay: .2s; }
.dot:nth-child(3) { animation-delay: .4s; }

@keyframes blink {
    0% { opacity: .3; }
    50% { opacity: 1; }
    100% { opacity: .3; }
}

/* Dark mode typing fix */
body.dark .typing-indicator {
    background: #1b1b1d;
}
body.dark .dot {
    background: #bbb;
}

/* Input Area */
.chat-input-area {
    position: fixed;
    bottom: 75px;
    left: 0;
    right: 0;
    background: var(--card);
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    box-shadow: 0 -4px 14px rgba(0,0,0,.15);
}

.chat-input-area input {
    flex: 1;
    padding: 12px;
    border-radius: 14px;
    background: var(--input);
    border: none;
    font-size: 15px;
    color: var(--text);
}

/* Dark mode input */
body.dark .chat-input-area input {
    background: #1d1d1f;
    color: var(--text);
}

.send-btn {
    width: 46px;
    height: 46px;
    background: var(--primary);
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

/* Floating Quick Challenge Button */
.floating-quick-btn {
    position: fixed;
    bottom: 140px;
    right: 20px;
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 14px;
    font-size: 14px;
    box-shadow: var(--shadow);
}

/* Challenge Card */
.challenge-card {
    background: var(--card);
    border-radius: 18px;
    padding: 16px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.08);
}

.challenge-title {
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 16px;
}

.challenge-text {
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--subtext);
}

.challenge-buttons {
    display: flex;
    gap: 10px;
}

.challenge-accept {
    flex: 1;
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 12px;
}

.challenge-skip {
    flex: 1;
    background: #e8e8e8;
    border: none;
    padding: 10px;
    border-radius: 12px;
}

/* Dark mode challenge */
body.dark .challenge-card { background: #1b1b1d; border-color: #333; }
body.dark .challenge-skip { background: #282828; color: #eee; }

/* Challenge Card */
.challenge-card {
    background: var(--card);
    border-radius: 16px;
    padding: 16px;
    margin-top: 12px;
    box-shadow: var(--shadow);
}

.challenge-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

.challenge-text {
    margin-bottom: 12px;
    color: var(--text);
}

/* Time buttons */
.time-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.time-btn {
    padding: 8px 14px;
    background: var(--input);
    border: 1px solid var(--subtext);
    border-radius: 12px;
    cursor: pointer;
    color: var(--text);
}

.time-btn:hover {
    background: var(--primary);
    color: white;
}

/* Timer card */
.timer-card {
    background: var(--card);
    padding: 18px;
    border-radius: 16px;
    margin-top: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}

.timer-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--input);
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.timer-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--text);
}

.timer-actions {
    margin-top: 14px;
    display: flex;
    gap: 12px;
}

.timer-btn {
    flex: 1;
    padding: 10px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
}

.timer-btn.primary {
    background: var(--primary);
    color: white;
}

.timer-btn.secondary {
    background: var(--input);
    color: var(--text);
}

/* POINTER CURSOR globally */
button, a, .chip, .nav-item {
    cursor: pointer;
}
/* Challenge Card */
.challenge-card {
    background: var(--card);
    padding: 22px;
    border-radius: 20px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    margin-top: 12px;
    animation: fadeInUp .35s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Title */
.challenge-title {
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Subtitle text */
.challenge-text {
    font-size: 15px;
    margin-bottom: 14px;
    color: var(--text);
}

/* Focus time label */
.focus-label {
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Time buttons */
.time-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.time-btn {
    background: var(--card);
    padding: 8px 14px;
    border-radius: 14px;
    border: 1px solid var(--subtext);
    cursor: pointer;
    transition: .2s;
    font-size: 14px;
}

.time-btn:hover {
    background: var(--primary);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
}

/* Custom input popup */
.custom-time-input {
    margin-top: 12px;
    display: none;
}

.custom-time-input input {
    width: 80px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--subtext);
}

.custom-time-input button {
    margin-left: 8px;
    padding: 6px 12px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
}

.chat-box {
    padding-bottom: 160px !important; /* prevents card from hiding */
}
.circle-timer-wrap {
    display: flex;
    justify-content: center;
    margin: 15px 0;
}

.circle-timer {
    position: relative;
    width: 80px;
    height: 80px;
}

.timer-svg {
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: var(--subtext);
    stroke-width: 6;
    opacity: 0.2;
}

.timer-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
/* Challenge Timer Bar */
.challenge-timer {
    width: 100%;
    height: 10px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 12px;
}

.challenge-progress {
    height: 100%;
    width: 100%;
    background: #7b5dff; /* Purple start */
    transition: width 1s linear, background 0.5s ease;
}

.challenge-progress-bar {
    width: 100%;
    height: 8px;
    background: #222;
    border-radius: 10px;
    margin-top: 8px;
    overflow: hidden;
}

.challenge-progress-fill {
    height: 100%;
    width: 100%;
    background: #7b5dff;
    transition: width 1s linear, background 0.3s ease;
}
.history-btn {
    background: #6b5cff;
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.history-modal.active {
    display: flex;
}

.history-content {
    width: 90%;
    max-width: 450px;
    background: #fff;
    padding: 20px;
    border-radius: 14px;
    max-height: 80vh;
    overflow-y: auto;
}

.history-list {
    margin-top: 15px;
    border-radius: 10px;
}

.history-item {
    padding: 12px;
    margin-bottom: 10px;
    background: #f5f5f5;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.history-item:hover {
    background: #e6e6ff;
}

.history-date {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 4px;
}

.danger-btn {
    background: #ff4f4f;
    color: #fff;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    margin-right: 10px;
    cursor: pointer;
}

.close-btn {
    background: #888;
    color: #fff;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
/* ===============================
   VOICE MIC BUTTON STATES
================================ */

#chatVoiceBtn {
  transition: background 0.25s ease, color 0.25s ease, transform 0.2s;
}

/* Hover */
#chatVoiceBtn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--primary);
}

/* 🎤 ACTIVE (listening) */
#chatVoiceBtn.active {
  background: rgba(255, 78, 78, 0.15); /* light red bg */
  color: #ff4e4e;
  animation: micPulse 1.5s infinite;
}

/* Mic pulse animation */
@keyframes micPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 78, 78, 0.6);
    transform: scale(1);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 78, 78, 0);
    transform: scale(1.05);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 78, 78, 0);
    transform: scale(1);
  }
}

/* Optional: small listening text */
#voiceStatus {
  font-size: 11px;
  margin-right: 4px;
  color: #ff4e4e;
}
.floating-history-btn {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
}
