/* ==========================================
   NEW FEATURES STYLES - FABs, Chat, Notes, Toasts
   ========================================== */

/* ==========================================
   FLOATING ACTION BUTTONS (FABs)
   ========================================== */
.fab-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2000;
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

.fab-icon {
    font-size: 1.5rem;
}

.fab-notes {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.fab-notes:hover {
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.5);
}

.fab-chat {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.fab-chat:hover {
    box-shadow: 0 8px 30px rgba(14, 165, 233, 0.5);
}

.fab-chat.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* ==========================================
   AI CHAT PANEL
   ========================================== */
.chat-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-height: 500px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 2500;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 16px 16px 0 0;
    gap: 8px;
}

.chat-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-title {
    font-weight: 700;
    font-size: 1rem;
    color: white;
}

.model-indicator {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-select {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
}

.model-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.chat-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 250px;
    max-height: 320px;
}

.chat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.chat-welcome .welcome-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
}

.chat-welcome h4 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.chat-message {
    display: flex;
    gap: 10px;
    animation: fadeInUp 0.3s ease;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.message-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.message-content {
    font-size: 0.9rem;
    line-height: 1.5;
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.chat-message.user .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.typing-indicator {
    display: flex;
    gap: 10px;
    align-items: center;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.chat-error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-send:hover {
    transform: scale(1.1);
}

/* ==========================================
   NOTE MODAL
   ========================================== */
.note-modal.active {
    display: flex;
}

.note-modal-content {
    max-width: 500px;
    width: 100%;
}

.note-context-badge {
    display: inline-block;
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 16px;
}

.note-textarea {
    width: 100%;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

.note-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.note-textarea::placeholder {
    color: var(--text-muted);
}

/* ==========================================
   NOTES VIEW
   ========================================== */
.notes-container {
    max-width: 800px;
    margin: 0 auto;
}

.notes-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.notes-count {
    font-size: 1rem;
    color: var(--text-secondary);
}

.notes-count span {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-light);
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.note-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.note-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.note-context {
    font-size: 0.85rem;
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.15);
    padding: 4px 12px;
    border-radius: 12px;
}

.note-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.note-content {
    color: var(--text-reading);
    line-height: 1.7;
    font-size: 0.95rem;
}

.note-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(239, 68, 68, 0.2);
}

.empty-notes {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-notes .empty-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-notes h3 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.fab-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.8rem;
    vertical-align: middle;
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
#toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 3000;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    border-left: 4px solid var(--primary);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.hide {
    transform: translateX(120%);
    opacity: 0;
}

.toast-success {
    border-left-color: var(--success);
}

.toast-error {
    border-left-color: var(--danger);
}

.toast-warning {
    border-left-color: var(--warning);
}

.toast-info {
    border-left-color: var(--primary);
}

.toast-icon {
    font-size: 1.3rem;
}

.toast-message {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* ==========================================
   STREAK STYLING
   ========================================== */
.streak-pill {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(245, 158, 11, 0.2) 100%) !important;
    border: 1px solid rgba(239, 68, 68, 0.3);
    animation: fireGlow 2s ease-in-out infinite;
}

@keyframes fireGlow {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
    }

    50% {
        box-shadow: 0 0 16px rgba(245, 158, 11, 0.5);
    }
}

/* ==========================================
   ENTRANCE ANIMATIONS
   ========================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   RESPONSIVE FAB & CHAT
   ========================================== */
@media (max-width: 500px) {
    .chat-panel {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 90px;
    }

    .fab-container {
        right: 16px;
        bottom: 16px;
    }

    .fab {
        width: 50px;
        height: 50px;
    }
}

/* ==========================================
   FULL PAGE CHAT STYLES
   ========================================== */

/* Layout */
.chat-layout {
    display: flex;
    height: calc(100vh - 100px);
    /* Adjust based on navbar/padding */
    gap: 20px;
    margin-top: -20px;
    /* Offset section padding */
}

/* Sidebar */
.chat-sidebar {
    width: 280px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-sidebar-header h2 {
    font-size: 1.1rem;
    margin: 0;
}

.chat-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.history-item.active {
    background: rgba(14, 165, 233, 0.15);
    border: 1px solid rgba(14, 165, 233, 0.3);
}

.history-icon {
    font-size: 1.2rem;
}

.history-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-title {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-main-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.model-selector-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.model-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.model-select-lg {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

.model-select-lg:hover {
    border-color: var(--primary);
}

.model-select-lg option {
    background: var(--bg-card);
}

/* Chat Messages Large */
.chat-messages-lg {
    flex: 1;
    overflow-y: auto;
    padding: 24px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-welcome-lg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    opacity: 0.8;
}

.welcome-icon-lg {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: bounce 2s infinite;
}

.chat-welcome-lg h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 30px;
    max-width: 600px;
}

.suggestion-chips button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-chips button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Input Area Large */
.chat-input-area-lg {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.input-wrapper-lg {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

#full-chat-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 50px 16px 20px;
    color: var(--text-primary);
    font-size: 1rem;
    resize: none;
    line-height: 1.5;
    max-height: 150px;
    font-family: inherit;
    transition: border-color 0.2s;
}

#full-chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

.send-btn-lg {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.send-btn-lg:hover {
    transform: scale(1.1);
    background: var(--secondary);
}

.disclaimer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 10px;
}

/* Message Styles override/extension */
.chat-message-lg {
    display: flex;
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.chat-message-lg.user {
    flex-direction: row-reverse;
}

.message-avatar-lg {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.message-bubble-lg {
    background: rgba(255, 255, 255, 0.05);
    padding: 16px 24px;
    border-radius: 16px;
    line-height: 1.6;
    border: 1px solid transparent;
}

.chat-message-lg.user .message-bubble-lg {
    background: rgba(14, 165, 233, 0.15);
    border-color: rgba(14, 165, 233, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .chat-layout {
        flex-direction: column;
        height: auto;
    }

    .chat-sidebar {
        width: 100%;
        height: 150px;
    }

    .chat-main {
        height: 60vh;
    }
}

/* ==========================================
   THINKING INDICATOR (Pensando...)
   ========================================== */
.thinking-message {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 16px 20px;
    border-radius: 16px;
    min-width: 150px;
}

.thinking-text {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    animation: pulse 1.5s ease-in-out infinite;
}

.thinking-icon {
    font-size: 1.2rem;
    animation: think 2s ease-in-out infinite;
}

@keyframes think {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }
}

.thinking-message .typing-dots {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

/* ==========================================
   ERROR MESSAGE STYLING
   ========================================== */
.error-message .message-bubble-lg,
.error-message .message-bubble {
    background: rgba(239, 68, 68, 0.15) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: #fca5a5;
}

.message-bubble-lg strong,
.message-bubble strong {
    color: #f87171;
}

/* ==========================================
   FILE UPLOAD BUTTONS & PREVIEW
   ========================================== */
.upload-buttons {
    display: flex;
    gap: 4px;
    align-items: center;
}

.upload-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-btn:hover {
    background: rgba(14, 165, 233, 0.15);
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.05);
}

.file-preview-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.3);
    border-radius: 12px;
    margin-bottom: 10px;
}

.file-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.attachment-preview-img {
    max-width: 60px;
    max-height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.attachment-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.audio-preview {
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio-icon {
    font-size: 1.5rem;
}

.clear-attachment-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.2);
    border: none;
    color: #f87171;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-attachment-btn:hover {
    background: rgba(239, 68, 68, 0.4);
}

.input-wrapper-lg {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ==========================================
   RECORDING BUTTON ANIMATION
   ========================================== */
.upload-btn.recording {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
    animation: recordingPulse 1.5s infinite;
}

@keyframes recordingPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}