/* ========================================
   REUSABLE COMPONENTS
   Buttons, Modals, Forms, Status Indicators
   ======================================== */

/* ========================================
   BUTTONS
   ======================================== */

/* Hamburger Menu Button */
.hamburger-btn {
    position: absolute;
    bottom: 30px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
    transform: translateY(8px);
}

.hamburger-btn span {
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 2px;
}

/* Back Button */
.back-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Refresh Button */
.refresh-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    margin-left: 8px;
}

.refresh-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.refresh-button.refreshing {
    background: rgba(102, 126, 234, 0.6);
    transition: background 0.15s ease;
}

/* Scroll to Bottom Button */
.scroll-to-bottom-btn {
    position: absolute;
    bottom: 120px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.scroll-to-bottom-btn.visible {
    display: flex;
}

.scroll-to-bottom-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* Send Button */
.send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    width: 56px;
    height: 56px;
    border-radius: 28px;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Voice Button */
.voice-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 56px;
    padding: 0;
    transition: transform 0.2s;
    line-height: 1;
    flex-shrink: 0;
}

.voice-btn:hover:not(:disabled) {
    transform: scale(1.1);
}

.voice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.voice-btn.recording {
    animation: pulse-btn 1.5s ease-in-out infinite;
}

@keyframes pulse-btn {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* ========================================
   MODALS
   ======================================== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 3000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
}

.modal-content h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
}

.modal-content p {
    font-size: 18px;
    color: #333;
    margin-bottom: 16px;
}

.modal-input,
.modal-textarea {
    width: 100%;
    font-size: 18px;
    padding: 14px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    margin-bottom: 16px;
    font-family: inherit;
    outline: none;
}

.modal-input:focus,
.modal-textarea:focus {
    border-color: #667eea;
}

.modal-textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-button {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.modal-button:active {
    transform: scale(0.95);
}

.modal-button.cancel {
    background: #f0f0f0;
    color: #666;
}

.modal-button.create {
    background: #667eea;
    color: white;
}

.modal-button.delete {
    background: #ff4444;
    color: white;
}

.modal-button:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
}

.modal-button:disabled:active {
    transform: none;
}

/* ========================================
   FORMS & INPUTS
   ======================================== */

.text-input-container {
    flex: 1;
    position: relative;
}

.text-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 18px;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    outline: none;
    transition: all 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.text-input:focus {
    border-color: #667eea;
}

.text-input:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* ========================================
   SEARCH COMPONENTS
   ======================================== */

.search-bar-container {
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.search-bar {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 12px;
    padding: 10px 16px;
    gap: 10px;
}

.search-icon {
    font-size: 18px;
    color: #999;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    outline: none;
    color: #333;
}

.search-input::placeholder {
    color: #999;
}

.search-clear-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 0;
    display: none;
}

.search-clear-btn.visible {
    display: block;
}

.search-results-count {
    padding: 8px 20px;
    font-size: 14px;
    color: #666;
    background: #fafafa;
    border-bottom: 1px solid #e0e0e0;
}

/* ========================================
   STATUS INDICATORS
   ======================================== */

.status-bar {
    background: rgba(102, 126, 234, 0.1);
    padding: 12px 20px;
    font-size: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.status-bar.disconnected {
    background: rgba(234, 179, 8, 0.2);
}

.talk-status-bar {
    background: rgba(102, 126, 234, 0.1);
    padding: 16px 20px;
    font-size: 22px;
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    color: #333;
    position: relative;
}

.talk-status-bar.disconnected {
    background: rgba(234, 179, 8, 0.2);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.disconnected {
    background: #eab308;
    animation: none;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.listening-indicator, .refining-indicator {
    display: none;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea20, #764ba220);
    border: 2px solid #667eea;
    border-radius: 20px;
    width: fit-content;
    animation: slideIn 0.3s ease-out;
    align-self: flex-end;
    font-size: 18px;
}

.listening-indicator.active, .refining-indicator.active {
    display: block;
}

.processing-indicator {
    display: none;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea10, #764ba210);
    border: 2px solid #667eea;
    border-radius: 20px;
    width: fit-content;
    animation: slideIn 0.3s ease-out;
    align-self: flex-start;
    font-size: 18px;
}

.processing-indicator.active {
    display: block;
}

.listening-pulse {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pulse-icon {
    font-size: 20px;
    animation: pulse-mic 1.5s ease-in-out infinite;
}

@keyframes pulse-mic {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

.listening-text {
    font-size: 18px;
    color: #667eea;
    font-weight: 600;
}

/* Slide in animation (reusable) */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   MENU COMPONENTS
   ======================================== */

.hamburger-menu {
    position: absolute;
    top: 60px;
    left: 16px;
    right: 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    padding: 16px 0;
    display: none;
    z-index: 1000;
}

.hamburger-menu.active {
    display: block;
}

.menu-item {
    padding: 16px 24px;
    color: #333;
    cursor: pointer;
    transition: background 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 18px;
    font-weight: 500;
}

.menu-item:hover {
    background: #f3f4f6;
}

.menu-item.info {
    cursor: default;
    font-size: 16px;
    color: #666;
    font-weight: 400;
}

.menu-item.info:hover {
    background: none;
}

.menu-divider {
    height: 1px;
    background: #e5e5e5;
    margin: 8px 0;
}

/* ========================================
   EMPTY STATE
   ======================================== */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 16px;
}

.empty-state.hidden {
    display: none;
}

/* ========================================
   REFRESH MODAL
   ======================================== */

.refresh-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.refresh-modal.hidden {
    display: none;
}

.refresh-modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.refresh-modal-content p {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    color: #374151;
}

.refresh-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #4F46E5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
