/* Global Reset & Vars */
:root {
    --sidebar-width: 260px;
    --primary-color: #1677ff;
    /* Match unified auth primary blue */
    --primary-hover: #4096ff;
    --bg-color: #ffffff;
    --sidebar-bg: #f0f9ff;
    /* Light blue tint for sidebar */
    --text-primary: #1f2329;
    --text-secondary: #646a73;
    --border-color: #dee0e3;
    --hover-bg: #e6f7ff;
    /* Light blue hover */
    --running-capsule-bg: #ffffff;
    --running-capsule-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --gradient-bg: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    /* New gradient variable */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline: none;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    background: var(--gradient-bg);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

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

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

.anim-up {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.anim-delay-1 {
    animation-delay: 0.1s;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 16px;
    z-index: 10;
}

/* New Task Button */
.new-task-btn {
    width: 100%;
    background: rgba(22, 119, 255, 0.1);
    /* Light blue tint */
    border: none;
    border-radius: 20px;
    padding: 10px 16px;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.new-task-btn:hover {
    background: rgba(22, 119, 255, 0.2);
}

.plus-icon {
    font-size: 18px;
}

/* Sidebar Nav */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s;
    font-size: 14px;
}

.nav-item:hover {
    background: var(--hover-bg);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* History */
.sidebar-history {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-label {
    font-size: 12px;
    color: var(--text-secondary);
    padding-left: 12px;
    margin-bottom: 4px;
}

.history-item {
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.history-item:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.history-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delete-chat-btn {
    opacity: 0;
    padding: 4px;
    border-radius: 4px;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.history-item:hover .delete-chat-btn {
    opacity: 1;
}

.delete-chat-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #ff4d4f;
}

/* User Profile */
.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-profile:hover {
    background: var(--hover-bg);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: #ddd;
}

.user-avatar.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #666;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}


/* Main Content Area */
.main-content {
    flex: 1;
    position: relative;
    background: var(--gradient-bg);
    display: flex;
    flex-direction: column;
}

/* Home View */
.home-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.home-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 40px;
    color: var(--text-primary);
    text-align: center;
}

.home-mascot {
    position: absolute;
    top: 100px;
    right: 15%;
    display: none;
    /* Hide for now unless we have assets */
}

/* Feature Grid */
.home-features {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 30px;
    width: 100%;
}

.feature-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f2f3f5;
    border-radius: 20px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.feature-chip:hover {
    background: #fff;
    border-color: var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chip-icon {
    font-size: 16px;
}

/* Home Input */
.home-input-container {
    width: 100%;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s;
    position: relative;
}

.home-input-container:focus-within {
    border-color: var(--primary-color);
}

.home-input {
    width: 100%;
    border: none;
    resize: none;
    font-size: 16px;
    color: var(--text-primary);
    min-height: 24px;
    max-height: 150px;
    font-family: inherit;
}

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

.input-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.action-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: 4px;
}

.action-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.send-btn-home,
.send-btn-chat {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    /* Circle shape as requested in Image 1/3 */
    border: none;
    background: var(--hover-bg);
    /* Disabled look initially */
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s;
}

.send-btn-home.active,
.send-btn-chat.active {
    background: var(--primary-color);
}

/* Align send button to right */
.input-actions {
    justify-content: flex-end;
    gap: 10px;
}

.input-actions>button:first-child {
    margin-right: auto;
}

/* Push left actions to left */


/* Chat View */
.chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    background: #fff;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 20px 100px 20px;
    /* Padding bottom for input area */
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* Chat Input (Sticky Bottom) */
.chat-input-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: #fff;
    /* Opaque background to cover messages */
    border-top: 1px solid transparent;
    /* Or subtle border */
}

.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.02);
}

.chat-input {
    width: 100%;
    border: none;
    resize: none;
    font-size: 15px;
    max-height: 120px;
}

/* Running Status Capsule */
.running-status {
    position: absolute;
    bottom: 100px;
    /* Above input box */
    left: 50%;
    transform: translateX(-50%);
    background: var(--running-capsule-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--running-capsule-shadow);
    padding: 12px 24px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 20;
    font-size: 14px;
    color: var(--text-primary);
}

.status-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Suggested Questions */
.suggested-questions {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suggestion-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.suggestion-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.suggestion-pill {
    background: #f2f3f5;
    border: none;
    padding: 8px 16px;
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}

.suggestion-pill:hover {
    background: #e4e5e7;
}

.suggestion-pill::before {
    content: "⚡";
    /* Or icon from image */
    margin-right: 6px;
    opacity: 0.7;
}

/* Message Styles */
.message {
    display: flex;
    gap: 12px;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    flex-shrink: 0;
    background: #eee;
}

.msg-content {
    flex: 1;
    line-height: 1.6;
    font-size: 15px;
    color: var(--text-primary);
    background: #f7f7f8;
    padding: 12px;
    border-radius: 8px;
}

.message.user .msg-content {
    background: #eaf0ff;
}

/* Feedback FAB */
.feedback-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: transform 0.2s;
    z-index: 100;
}

.feedback-fab:hover {
    transform: scale(1.1);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}
/* ==================================================
   Mobile Responsiveness (new_frontend)
   ================================================== */
@media (max-width: 768px) {
    /* Layout */
    body {
        flex-direction: column;
        overflow: hidden; /* Prevent body scroll when drawer open */
    }

    /* Mobile Header */
    .mobile-header {
        display: flex;
        align-items: center;
        padding: 12px 16px;
        background: var(--bg-color);
        border-bottom: 1px solid var(--border-color);
        z-index: 20;
    }

    .mobile-menu-btn {
        background: none;
        border: none;
        color: var(--text-primary);
        cursor: pointer;
        padding: 8px;
        margin-left: -8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-logo {
        font-weight: 600;
        font-size: 18px;
        margin-left: 12px;
        color: var(--primary-color);
    }

    /* Sidebar as Drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        background: var(--bg-color);
        z-index: 30;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding-top: 24px;
        box-shadow: 4px 0 16px rgba(0,0,0,0.1);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 25;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Home Content Adjustments */
    .home-view {
        padding: 24px 16px;
    }

    .home-title {
        font-size: 22px;
        margin-bottom: 24px;
    }

    .home-features {
        flex-direction: column;
        gap: 8px;
    }

    .feature-chip {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 15px;
    }

    .home-mascot {
        display: none !important; /* Force hide on mobile to save space */
    }

    /* Input Area */
    .home-input-container {
        padding: 12px;
    }

    .home-input {
        font-size: 16px; /* Prevent iOS zoom */
        min-height: 48px;
    }
    
    .input-wrapper {
        margin: 0 16px;
    }

    /* Chat Area */
    .chat-messages {
        padding: 16px 16px 120px 16px;
    }

    .msg-avatar {
        width: 28px;
        height: 28px;
    }

    .msg-content {
        font-size: 14px;
        padding: 10px;
    }

    .suggested-questions {
        padding: 0 16px 20px 16px;
    }

    .suggestion-pill {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Hide mobile header on desktop */
@media (min-width: 769px) {
    .mobile-header, .sidebar-overlay {
        display: none !important;
    }
}
