/* Input Area Styles */
.chat-input-container {
    padding: 30px;
    background: var(--bg-primary);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(20px);
    position: relative;
    z-index: 10;
}

.chat-input-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.1), transparent);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
    margin-bottom: 25px;
}

.quick-action {
    padding: 14px 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.quick-action::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.quick-action:hover::before {
    left: 100%;
}

.quick-action:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(0, 123, 255, 0.2);
}

.quick-action:active {
    transform: translateY(-1px);
    transition: var(--transition-fast);
}

.chat-input-form {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.input-wrapper {
    flex: 1;
    position: relative;
    z-index: 5;
    overflow: visible;
}

.input-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50px;
    padding: 2px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
    z-index: -1;
}

.input-wrapper:focus-within::before {
    opacity: 1;
}

.chat-input {
    width: 100%;
    padding: 18px 25px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 50px;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
    resize: none;
    min-height: 60px;
    max-height: 180px;
    box-shadow: var(--shadow-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    line-height: 1.5;
    position: relative;
    z-index: 5;
    overflow: visible;
    box-sizing: border-box;
    vertical-align: top;
}

.chat-input::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

.chat-input:focus {
    border-color: #007bff;
    box-shadow: var(--shadow-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.send-button {
    padding: 18px 35px;
    background: var(--user-gradient);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    height: 60px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    min-width: 120px;
}

.send-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.send-button:hover::before {
    width: 300px;
    height: 300px;
}

.send-button:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.send-button:active {
    transform: translateY(-1px);
    transition: var(--transition-fast);
}

.send-button:disabled {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--shadow-sm);
}

.send-button:disabled::before {
    display: none;
}

.agent-button {
    padding: 18px 35px;
    background: linear-gradient(135deg, #6f42c1, #5a2d91);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    height: 60px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    min-width: 140px;
    margin-left: 12px;
}

.agent-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.agent-button:hover::before {
    width: 300px;
    height: 300px;
}

.agent-button:hover {
    background: linear-gradient(135deg, #5a2d91, #4c2577);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.agent-button:active {
    transform: translateY(-1px);
    transition: var(--transition-fast);
}

.agent-button:disabled {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--shadow-sm);
}

.agent-button:disabled::before {
    display: none;
}

.clear-button {
    padding: 18px 35px;
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    margin-left: 10px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.clear-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.clear-button:hover::before {
    width: 200px;
    height: 200px;
}

.clear-button:hover {
    background: linear-gradient(135deg, #5a6268, #495057);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Floating Action Button for Mobile */
.fab-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 1000;
    display: none;
}

.fab-main {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--user-gradient);
    border: none;
    box-shadow: 0 4px 16px rgba(0, 123, 255, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.fab-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.3s ease;
}

.fab-main:active::before {
    transform: scale(1);
}

.fab-main.expanded {
    transform: rotate(45deg);
    background: var(--warning-gradient);
}

.fab-actions {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001; /* Higher than fab-container */
    pointer-events: none; /* Initially don't capture clicks */
}

.fab-actions.expanded {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto; /* Capture clicks when expanded */
}

.fab-action {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 28px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: white;
    white-space: nowrap;
    transition: all 0.2s ease;
    transform: scale(0.8);
    opacity: 0;
    position: relative; /* Ensure position is set for z-index */
    z-index: 1002; /* Higher than fab-actions */
    -webkit-tap-highlight-color: rgba(0,0,0,0); /* Remove tap highlight on mobile */
    touch-action: manipulation; /* Improve touch behavior */
    user-select: none; /* Prevent text selection */
    -webkit-touch-callout: none; /* Prevent callout on long press */
}

.fab-actions.expanded .fab-action {
    transform: scale(1);
    opacity: 1;
}

.fab-actions.expanded .fab-action:nth-child(1) { transition-delay: 0.05s; }
.fab-actions.expanded .fab-action:nth-child(2) { transition-delay: 0.1s; }
.fab-actions.expanded .fab-action:nth-child(3) { transition-delay: 0.15s; }
.fab-actions.expanded .fab-action:nth-child(4) { transition-delay: 0.2s; }
.fab-actions.expanded .fab-action:nth-child(5) { transition-delay: 0.25s; }
.fab-actions.expanded .fab-action:nth-child(6) { transition-delay: 0.3s; }

.fab-action:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.fab-action:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #4c51bf 0%, #553c9a 100%);
}

.fab-action-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.fab-action-text {
    font-size: 13px;
    max-width: 140px;
    text-align: left;
}

.fab-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.fab-backdrop.expanded {
    opacity: 1;
    visibility: visible;
}

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    .chat-input-container {
        padding: 6px;
        background: var(--bg-primary);
        border-top: 1px solid rgba(0,0,0,0.1);
    }
    
    /* Hide quick actions completely on mobile - replaced with FAB */
    .quick-actions {
        display: none;
    }
    
    /* Show FAB on mobile */
    .fab-container {
        display: block;
    }
    
    /* Mobile-optimized input form */
    .chat-input-form {
        display: flex;
        gap: 6px;
        align-items: stretch;
    }
    
    .input-wrapper {
        flex: 1;
    }
    
    .chat-input {
        width: 100%;
        min-height: 36px;
        max-height: 100px;
        padding: 8px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 18px;
        border: 1px solid rgba(0,0,0,0.15);
        background: var(--bg-secondary);
        box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
        resize: none;
        outline: none;
    }
    
    .chat-input:focus {
        border-color: #007bff;
        box-shadow: 0 0 0 2px rgba(0,123,255,0.1), inset 0 1px 2px rgba(0,0,0,0.08);
    }
    
    .send-button {
        height: 36px;
        min-width: 60px;
        padding: 0 12px;
        font-size: 0.85rem;
        border-radius: 18px;
        flex-shrink: 0;
        background: var(--user-gradient);
        color: white;
        border: none;
        font-weight: 600;
    }
    
    .clear-button {
        height: 36px;
        min-width: 50px;
        padding: 0 10px;
        font-size: 0.8rem;
        border-radius: 18px;
        flex-shrink: 0;
        background: var(--text-light);
        color: white;
        border: none;
    }
}

@media (max-width: 480px) {
    /* Even more compact for iPhone */
    .chat-input-container {
        padding: 4px;
    }
    
    .chat-input-form {
        gap: 4px;
    }
    
    .chat-input {
        min-height: 32px;
        padding: 6px 10px;
        font-size: 16px;
        border-radius: 16px;
    }
    
    .send-button {
        height: 32px;
        min-width: 50px;
        padding: 0 8px;
        font-size: 0.8rem;
        border-radius: 16px;
    }
    
    .clear-button {
        height: 32px;
        min-width: 40px;
        padding: 0 6px;
        font-size: 0.75rem;
        border-radius: 16px;
    }
    
    /* Adjust FAB for smaller screens */
    .fab-container {
        bottom: 70px;
        right: 16px;
    }
    
    .fab-main {
        width: 52px;
        height: 52px;
        font-size: 22px;
    }
    
    .fab-action {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .fab-action-text {
        font-size: 12px;
        max-width: 120px;
    }
    
    .fab-action-icon {
        font-size: 16px;
    }
}

/* Touch-friendly improvements for mobile */
@media (max-width: 768px) {
    /* Show shorter text on mobile */
    .quick-action-text {
        display: inline;
    }
    
    /* Prevent zoom on input focus for iOS */
    .chat-input {
        -webkit-appearance: none;
        touch-action: manipulation;
    }
    
    /* Improve scrolling on mobile */
    .chat-messages {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    /* Better button feedback on touch */
    .send-button:active,
    .clear-button:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* Landscape orientation adjustments for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-header {
        padding: 10px 15px;
    }
    
    .chat-header h1 {
        font-size: 1.1rem;
    }
    
    .chat-header p {
        font-size: 0.8rem;
    }
    
    .status-indicator,
    .model-info {
        font-size: 0.7rem;
        padding: 4px 8px;
        margin-top: 6px;
    }
    
    .quick-actions {
        margin-bottom: 10px;
    }
    
    .quick-action {
        padding: 6px 10px;
        font-size: 0.7rem;
    }
    
    .chat-input-container {
        padding: 8px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --bg-tertiary: #404040;
        --text-primary: #ffffff;
        --text-secondary: #b0b0b0;
        --text-light: #808080;
    }
    
    .chat-input {
        background: var(--bg-secondary);
        color: var(--text-primary);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .message.assistant .message-content {
        background: var(--bg-secondary);
        border-color: rgba(255, 255, 255, 0.1);
        color: var(--text-primary);
    }
    
    .quick-action {
        background: linear-gradient(135deg, #404040, #2d2d2d);
        color: var(--text-primary);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .quick-action:hover {
        background: linear-gradient(135deg, #4a4a4a, #373737);
    }
}
