@import url('https://fonts.googleapis.com/css2?family=Righteous&display=swap');

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: #14161C;
    color: #F4F4F4;
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
}

.container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    background: linear-gradient(135deg, #23252C 0%, #1a1c22 100%);
    padding: 20px;
    width: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    transition: width 0.3s ease;
    position: relative;
    min-height: 100vh;
    overflow-y: auto; /* Change from hidden to auto */
    overflow-x: visible; /* Ensure horizontal visibility */
    max-height: 100vh; /* Prevent sidebar from being too tall */
}

.sidebar.collapsed {
    width: 70px;
    padding: 20px 10px; /* Adjust padding for collapsed state */
}

.logo {
    font-family: 'Righteous', cursive;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 30px;
    color: #72D8EF;
    text-align: center;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .logo {
    opacity: 0;
}


.sidebar .nav-button {
    background-color: transparent !important;
    border: none;
    color: #F4F4F4 !important;
    padding: 12px 16px;
    margin: 4px 0;
    text-align: left;
    width: 100%;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    display: flex !important; /* Force flex display */
    align-items: center;
    gap: 10px;
    position: relative;
    flex-shrink: 0; /* Prevent buttons from shrinking */
    min-height: 44px; /* Ensure minimum height */
}

.sidebar .nav-button:hover, 
.sidebar .nav-button.active {
    background-color: #72D8EF !important;
    color: #14161C !important;
    transform: translateX(5px);
}

.toggle-sidebar {
    background: #72D8EF;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    color: #14161C;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-top: auto; /* Push it to the bottom */
    margin-bottom: 10px;
    flex-shrink: 0; /* Prevent it from shrinking */
}

/* Make sure it stays visible when sidebar collapses */
.sidebar.collapsed .toggle-sidebar {
    display: block; /* Ensure it stays visible */
    background: #72D8EF; /* Maintain color */
    color: #14161C;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-container {
    position: relative; /* Add this if not already present */
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Chat Section */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    max-width: 100%;
    transition: max-width 0.3s ease;
}

.chat-container.with-workspace {
    max-width: 25%; /* Less space for chat when workspace is active */
}

.chat-container.with-workspace.fullscreen {
    display: none; /* Hide chat completely in fullscreen mode */
}

.chat-header {
    background: linear-gradient(135deg, #23252C 0%, #2a2d35 100%);
    padding: 20px;
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid rgba(114, 216, 239, 0.2);
}

.chat-title {
    font-size: 20px;
    font-weight: 600;
    color: #72D8EF;
    margin: 0;
}

.chat-subtitle {
    font-size: 14px;
    color: #888;
    margin: 5px 0 0 0;
}

.chat-main {
    background-color: #23252C;
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

/* Predefined Questions - Development Only */
.predefined-questions {
    display: flex;
    gap: 8px;
    padding: 15px;
    background-color: rgba(20, 22, 28, 0.5);
    border-bottom: 1px solid rgba(244, 244, 244, 0.1);
    overflow-x: auto;
    scrollbar-width: none;
}

.predefined-questions::-webkit-scrollbar {
    display: none;
}

.predefined-question {
    background-color: #14161C;
    border: 1px solid #444;
    border-radius: 20px;
    padding: 8px 16px;
    color: #F4F4F4;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

.predefined-question:hover {
    background-color: #72D8EF;
    color: #14161C;
    transform: translateY(-2px);
}

.dev-badge {
    background: #ff6b35;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    margin-right: 10px;
    animation: pulse 2s infinite;
}

/* ADD these styles for the control button */
.ai-control-btn {
    padding: 8px 14px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    border-radius: 5px;
    font-size: 12px;
    transition: all 0.3s ease;
}

.ai-mode {
    background-color: #2d89ef;
    color: white;
}

.ai-mode:hover {
    background-color: #1e5bb8;
}

.user-mode {
    background-color: #ff9800;
    color: white;
}

.user-mode:hover {
    background-color: #e68900;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Chat Area */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}

.chat-area::-webkit-scrollbar {
    width: 6px;
}

.chat-area::-webkit-scrollbar-track {
    background: transparent;
}

.chat-area::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.message {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    background: linear-gradient(135deg, #72D8EF 0%, #5ab0bf 100%);
    color: #14161C;
    margin-left: auto;
}

.message.assistant {
    background: linear-gradient(135deg, #2a2d35 0%, #23252C 100%);
    color: #F4F4F4;
    border: 1px solid rgba(114, 216, 239, 0.2);
}

.message.question {
    margin-top: 15px;
}

.message.response {
    color: lightgreen;
}

/* Chat Input */
.chat-input-section {
    padding: 15px 20px;
    background: rgba(20, 22, 28, 0.8);
    border-top: 1px solid rgba(244, 244, 244, 0.1);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    position: relative;
}

.input-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.attach-button {
    background: rgba(114, 216, 239, 0.1);
    border: 1px solid #72D8EF;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    color: #72D8EF;
    font-size: 16px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attach-button:hover {
    background: #72D8EF;
    color: #14161C;
}

textarea {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    border-radius: 22px;
    border: 1px solid #444;
    padding: 12px 50px 12px 16px;
    background-color: #14161C;
    color: #F4F4F4;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    transition: border-color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #72D8EF;
}

.send-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #72D8EF 0%, #5ab0bf 100%);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: #14161C;
    font-weight: bold;
    transition: all 0.3s ease;
}

.send-button:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(114, 216, 239, 0.4);
}

/* Attached Files */
.attached-files {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attached-file {
    background: rgba(114, 216, 239, 0.1);
    border: 1px solid #72D8EF;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    color: #72D8EF;
    display: flex;
    align-items: center;
    gap: 6px;
}

.attached-file .remove-file {
    background: none;
    border: none;
    color: #72D8EF;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attached-file .remove-file:hover {
    background: #72D8EF;
    color: #14161C;
}

/* Workspace Area */
.workspace-area {
    width: 0;
    opacity: 0;
    background: linear-gradient(135deg, #23252C 0%, #2a2d35 100%);
    border-radius: 12px;
    margin-left: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    position: relative;
}

.workspace-area.active {
    width: 75% !important; /* Force width with !important */
    opacity: 1 !important; /* Force opacity with !important */
    min-width: 400px; /* Ensure minimum width */
    display: flex !important; /* Force display */
}

.workspace-area.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    z-index: 2000;
}

.workspace-header {
    padding: 20px;
    border-bottom: 1px solid rgba(244, 244, 244, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.workspace-title {
    font-size: 18px;
    font-weight: 600;
    color: #72D8EF;
    margin: 0;
}

.close-workspace {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.3s ease;
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-workspace:hover {
    color: #F4F4F4;
    background: rgba(244, 244, 244, 0.1);
    border-radius: 4px;
}

/* ADD workspace controls */
.workspace-controls {
    position: absolute;
    top: 20px;
    right: 60px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.workspace-control-btn {
    background: rgba(114, 216, 239, 0.1);
    border: 1px solid #72D8EF;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: #72D8EF;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.workspace-control-btn:hover {
    background: #72D8EF;
    color: #14161C;
}



/* Tabs */
.tabs {
    display: flex;
    padding: 0 20px;
    background: rgba(20, 22, 28, 0.5);
    border-bottom: 1px solid rgba(244, 244, 244, 0.1);
}

.tab-button {
    background: none;
    border: none;
    color: #888;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.tab-button:hover, .tab-button.active {
    color: #72D8EF;
    border-bottom-color: #72D8EF;
}

.tab-content {
    flex: 1;
    display: none;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

.workspace-content {
    padding: 20px;
}

.workspace-content h3 {
    color: #72D8EF;
    margin-bottom: 15px;
}

/* Task Steps */
.task-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-step {
    background: rgba(20, 22, 28, 0.5);
    border-left: 3px solid #72D8EF;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    transition: all 0.3s ease;
}

.task-step.completed {
    border-left-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.task-step.active {
    border-left-color: #FF9800;
    background: rgba(255, 152, 0, 0.1);
}

.task-step-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.task-step-description {
    font-size: 14px;
    color: #ccc;
}

/* Files Section */
.files-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.files-upload-area {
    border: 2px dashed #444;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: border-color 0.3s ease;
}

.files-upload-area:hover {
    border-color: #72D8EF;
}

.upload-button {
    background: linear-gradient(135deg, #72D8EF 0%, #5ab0bf 100%);
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    color: #14161C;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.upload-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(114, 216, 239, 0.4);
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    background: rgba(20, 22, 28, 0.5);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.3s ease;
}

.file-item:hover {
    border-color: #72D8EF;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-icon {
    font-size: 18px;
}

.file-details {
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 600;
    font-size: 14px;
}

.file-size {
    font-size: 12px;
    color: #888;
}

.file-actions {
    display: flex;
    gap: 8px;
}

.file-action {
    background: none;
    border: none;
    color: #72D8EF;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.file-action:hover {
    background: rgba(114, 216, 239, 0.1);
}

/* Action Buttons */
.action-buttons {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.action-button {
    background: linear-gradient(135deg, #72D8EF 0%, #5ab0bf 100%);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    color: #14161C;
    font-size: 18px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(114, 216, 239, 0.3);
}

.action-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(114, 216, 239, 0.5);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background-color: #23252C;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #444;
    width: 80%;
    max-width: 800px;
    border-radius: 12px;
    color: #F4F4F4;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #F4F4F4;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .chat-container.with-workspace {
        max-width: 100%;
    }
    
    .workspace-area.active {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        height: 100%;
        z-index: 1000;
        margin: 0;
        border-radius: 0;
    }
    
    .predefined-questions {
        flex-direction: column;
        gap: 5px;
    }
    
    .predefined-question {
        white-space: normal;
        text-align: center;
    }
}

/* Utility Classes */
.loading { 
    opacity: 0.6; 
    pointer-events: none; 
}

.plain-text {
    white-space: pre-wrap;
}

.python-code {
    font-family: "Courier New", Courier, monospace;
    color: #ff6f61;
    white-space: pre-wrap;
}

.sql-code {
    font-family: "Courier New", Courier, monospace;
    color: #72D8EF;
    white-space: pre-wrap;
}

.output-image {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    width: auto;
    border-radius: 8px;
}