/* Basic layout rules */
html, body {
    touch-action: manipulation;
    overflow-x: hidden;
}

/* This helps prevent iOS Safari from zooming on inputs */
input, textarea, select, button {
    font-size: 16px;  /* Minimum font size to prevent zoom on iOS */
}

/* Add basic styling for markdown content */
.markdown-content pre {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1rem 0;
}
.markdown-content code {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: monospace;
}
.markdown-content pre code {
    background-color: transparent;
    padding: 0;
}
.markdown-content p {
    margin-bottom: 1rem;
}
.markdown-content h1, 
.markdown-content h2, 
.markdown-content h3, 
.markdown-content h4, 
.markdown-content h5, 
.markdown-content h6 {
    font-weight: bold;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}
.markdown-content h1 { font-size: 1.5rem; }
.markdown-content h2 { font-size: 1.4rem; }
.markdown-content h3 { font-size: 1.3rem; }
.markdown-content h4 { font-size: 1.2rem; }
.markdown-content h5 { font-size: 1.1rem; }
.markdown-content h6 { font-size: 1rem; }
.markdown-content ul, 
.markdown-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}
.markdown-content ul { list-style-type: disc; }
.markdown-content ol { list-style-type: decimal; }
.markdown-content blockquote {
    border-left: 4px solid rgba(0, 0, 0, 0.2);
    padding-left: 1rem;
    margin-left: 0;
    margin-right: 0;
    font-style: italic;
}
.markdown-content table {
    border-collapse: collapse;
    margin: 1rem 0;
    width: 100%;
}
.markdown-content table th,
.markdown-content table td {
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
}
.markdown-content hr {
    margin: 1rem 0;
}

/* Adjust styles for dark mode */
[data-theme="dark"] .markdown-content pre,
[data-theme="dark"] .markdown-content code {
    background-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .markdown-content blockquote {
    border-left-color: rgba(255, 255, 255, 0.2);
}
[data-theme="dark"] .markdown-content table th,
[data-theme="dark"] .markdown-content table td {
    border-color: rgba(255, 255, 255, 0.2);
}

/* Mobile-first responsive adjustments */
.chat-header {
    font-size: 0.75rem;
}

.chat-footer time {
    font-size: 0.65rem;
}

.chat-bubble {
    max-width: 85%;
    padding: 0.75rem;
    font-size: 0.875rem;
}

@media (min-width: 640px) {
    .chat-header {
        font-size: 0.875rem;
    }
    
    .chat-footer time {
        font-size: 0.75rem;
    }
    
    .chat-bubble {
        max-width: 80%;
        padding: 1rem;
        font-size: 1rem;
    }
}

/* Fix responsive text for very small screens */
@media (max-width: 350px) {
    .xs-hidden {
        display: none;
    }
}

/* Image upload and preview styles */
.img-preview {
    max-width: 300px;
    max-height: 300px;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
}

.upload-preview {
    position: relative;
    margin-top: 0.5rem;
}

.upload-preview .remove-img {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    padding: 0.25rem;
    color: white;
    cursor: pointer;
    width: 1.5rem;
    height: 1.5rem;
    text-align: center;
    line-height: 1rem;
}

.message-with-image {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.message-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 0.5rem;
    object-fit: contain;
}

/* Add z-index fix for theme selector dropdown */
.dropdown-content {
    z-index: 1000 !important;
    position: absolute !important;
}

/* Ensure proper dropdown positioning */
.dropdown {
    position: relative !important;
}

/* Mommy mode styles */
.mommy-mode-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
}

.mommy-push-to-talk {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ff6b9d, #ff3377);
    box-shadow: 0 0 15px rgba(255, 75, 125, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 30px;
    border: none;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
}

.mommy-push-to-talk:active {
    transform: scale(0.95);
    box-shadow: 0 0 10px rgba(255, 75, 125, 0.5);
}

.mommy-push-to-talk.recording {
    animation: pulse 1.5s infinite;
    background: linear-gradient(145deg, #ff3377, #ff0055);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 15px rgba(255, 75, 125, 0.8);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 75, 125, 1);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 15px rgba(255, 75, 125, 0.8);
        transform: scale(1);
    }
}

.audio-waves {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
    margin-bottom: 20px;
}

.wave-bar {
    width: 6px;
    height: 20px;
    margin: 0 3px;
    background-color: #ff3377;
    border-radius: 3px;
    animation: wave 0.5s infinite ease-in-out alternate;
}

.wave-bar:nth-child(2) {
    animation-delay: 0.1s;
    height: 35px;
}

.wave-bar:nth-child(3) {
    animation-delay: 0.2s;
    height: 50px;
}

.wave-bar:nth-child(4) {
    animation-delay: 0.3s;
    height: 35px;
}

.wave-bar:nth-child(5) {
    animation-delay: 0.4s;
    height: 20px;
}

@keyframes wave {
    0% {
        transform: scaleY(0.5);
    }
    100% {
        transform: scaleY(1);
    }
}

.mommy-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    color: white;
    cursor: pointer;
}

.mommy-status {
    font-size: 1rem;
    margin-bottom: 10px;
    text-align: center;
    min-height: 24px;
}

/* Voice selector in mommy mode */
.mommy-voice-selector {
    margin-top: 10px;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 15px;
    display: inline-block;
}

.mommy-voice-selector select {
    background-color: transparent;
    color: white;
    border: none;
    font-size: 0.85rem;
    outline: none;
}

/* Additional indicator for recording state */
.recording-indicator {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 15px;
    border-radius: 15px;
    background-color: rgba(255, 255, 255, 0.2);
    font-size: 0.85rem;
    transition: opacity 0.3s ease;
}

/* Settings panel styles */
.settings-panel {
    max-width: 500px;
    margin: 0 auto;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.settings-section {
    margin-bottom: 1.5rem;
}

.settings-heading {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

/* Brand styling for CUBYAI */
.app-brand {
    display: inline-flex;
    align-items: center;
    font-weight: bold;
}

.brand-cuby {
    color: hsl(var(--p));  /* primary color from theme */
}

.brand-ai {
    color: hsl(var(--s));  /* secondary color from theme */
}

/* Improved styling for thinking content */
.thinking-content {
    border-left: 3px solid hsl(var(--in));
    background-color: rgba(var(--in-rgb), 0.05);
    padding: 1rem;
    margin-top: 0.75rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    width: 100%;
}

.thinking-toggle {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-bottom: 0.5rem;
}

/* Make sure the button is aligned right but content takes full width */
.thinking-toggle button {
    align-self: flex-end;
}

/* Add pulsing glow effect for thinking button */
.thinking-toggle .btn-info {
    animation: thinking-pulse 2s infinite;
    position: relative;
}

/* Enhanced pulsing effect that follows theme colors */
@keyframes thinking-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--in-rgb), 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(var(--in-rgb), 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(var(--in-rgb), 0);
    }
}

/* Add class for active thinking state with more pronounced effect */
.thinking-active {
    animation: thinking-active-pulse 1.5s infinite !important;
    transition: all 0.3s ease;
}

@keyframes thinking-active-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--in-rgb), 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 10px 3px rgba(var(--in-rgb), 0.5);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(var(--in-rgb), 0.6);
        transform: scale(1);
    }
}

.thinking-header {
    font-weight: bold;
    color: hsl(var(--in));
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Side panel styles */
.side-panel {
  width: 250px;
  overflow-y: auto;
}

/* Mobile side panel state */
.side-panel-mobile-closed {
  transform: translateX(-100%);
}

.side-panel-mobile-open {
  transform: translateX(0);
}

/* Desktop behavior - always visible */
@media (min-width: 1024px) { /* lg breakpoint in Tailwind */
  .side-panel {
    transform: translateX(0) !important;
  }
  
  /* Add background overlay when side panel is open on mobile */
  .side-panel-overlay {
    display: none;
  }
}

/* Mobile background overlay */
.side-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 40;
}