/* Integrated styles for CLAWDTOOL */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@700&family=Courier+New&display=swap');

:root {
    --bg-color: #000000;
    --sidebar-bg: #050000;
    --chat-bg: #000000;
    --input-bg: #1a0202;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent-color: #8a0303;
    --accent-glow: #c20000;
    --highlight: #a40000;
    --user-msg-bg: #3b0000;
    --user-text: #ffffff;
    --ai-msg-bg: #120202;
    --border-color: #330a0a;
    --glass-bg: rgba(10, 10, 10, 0.9);
    --glass-border: rgba(138, 3, 3, 0.2);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow-glow: 0 0 15px rgba(138, 3, 3, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    user-select: none;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(138, 3, 3, 0.3);
    border-radius: 3px;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--accent-glow);
    text-shadow: 0 0 15px rgba(138, 3, 3, 0.4);
}

.logo-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--accent-color);
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

.nav-item {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    text-align: left;
}

.nav-item:hover {
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.nav-item.new-chat {
    background: linear-gradient(135deg, var(--accent-color), #4a0000) !important;
    color: white !important;
    font-weight: 700;
    justify-content: center;
    margin: 1rem 0 2rem 0;
    height: 48px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(138, 3, 3, 0.3);
    border: 1px solid var(--accent-glow) !important;
}

.nav-item.new-chat:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(138, 3, 3, 0.6);
    background: linear-gradient(135deg, var(--highlight), var(--accent-color)) !important;
}

.history-container {
    flex: 1;
    overflow-y: auto;
    margin-top: 1rem;
}

.history-item {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    text-align: left;
    margin-bottom: 0.25rem;
    outline: none;
}

.history-item:hover {
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.history-item.active {
    background-color: rgba(138, 3, 3, 0.1);
    color: var(--accent-glow);
}

.history-item i {
    color: var(--accent-color);
    width: 20px;
    text-align: center;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--chat-bg);
    height: 100%;
    overflow: hidden;
}

.view-container {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow-y: auto;
}

.view-container.active {
    display: flex;
}

/* Chat View */
.mobile-menu-btn {
    display: none;
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    /* Important: Don't let header squash in Chrome */
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Message Styles */
.message {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    gap: 1rem;
    animation: fadeIn 0.4s ease;
}

.message-content {
    line-height: 1.7;
    font-size: 1rem;
    padding: 0.75rem 1.25rem;
    border-radius: 1rem;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-content {
    background: linear-gradient(135deg, var(--accent-color), #4a0000);
    color: var(--user-text);
    border-radius: 1rem 1rem 0 1rem;
}

.ai-message .message-content {
    background: var(--ai-msg-bg);
    border: 1px solid var(--border-color);
}

/* Input Area */
.input-area {
    padding: 1rem 2rem 2rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.input-container {
    background: var(--input-bg);
    border-radius: 1.5rem;
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.input-container:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 4px 25px rgba(138, 3, 3, 0.2);
    background-color: #2a0505;
}

.input-container textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 0.75rem;
    outline: none;
    resize: none;
    max-height: 200px;
    font-family: inherit;
    font-size: 1rem;
}

.attach-btn,
.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: var(--text-secondary);
}

.attach-btn:hover {
    color: var(--accent-glow);
    background: rgba(255, 255, 255, 0.05);
}

.send-btn {
    background: var(--accent-color);
    color: black;
}

.send-btn:hover {
    background: var(--highlight);
    transform: scale(1.05);
}

.send-btn i {
    font-size: 1.1rem;
}

/* Moltbook Tool Views - Premium Aesthetic */
.tool-view {
    padding: 2.5rem;
    max-width: 700px;
    margin: 2rem auto;
    width: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), var(--shadow-glow);
    animation: fadeIn 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.tool-header {
    font-size: 1.75rem;
    color: var(--accent-glow);
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 12px;
    font-family: 'Playfair Display', serif;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    position: relative;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.form-group input,
.form-group textarea {
    width: 100%;
    background: rgba(26, 2, 2, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 14px 18px;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
    user-select: text;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent-glow);
    outline: none;
    background: rgba(42, 5, 5, 0.8);
    box-shadow: 0 0 15px rgba(194, 0, 0, 0.3);
    transform: translateY(-1px);
}

.tool-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-color), #4a0000);
    color: white;
    border: 1px solid var(--accent-glow);
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 1.5rem;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 4px 15px rgba(138, 3, 3, 0.3);
}

.tool-btn:hover {
    transform: translateY(-3px) scale(1.02);
    background: linear-gradient(135deg, var(--highlight), var(--accent-color));
    box-shadow: 0 8px 25px rgba(138, 3, 3, 0.6);
}

.tool-btn:active {
    transform: translateY(0) scale(0.98);
}

#output-console-container {
    padding: 0 40px 40px;
}

#output-console {
    margin-top: 20px;
    padding: 12px;
    background: #050000;
    border: 1px solid var(--border-color);
    min-height: 100px;
    border-radius: 8px;
    color: #ff6b6b;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    overflow-y: auto;
}

.claim-btn {
    margin-top: 10px;
    background: #3a1f1f;
    border: 1px solid #aa4444;
    color: #ff6b6b;
    padding: 5px 15px;
    cursor: pointer;
}

/* File Preview Styles */
.file-preview-area {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding: 0 10px;
    overflow-x: auto;
}

.preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 2px solid var(--accent-color);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-file {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    transition: all 0.3s ease;
}

.status-indicator.online {
    background-color: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
}

.status-indicator.offline {
    background-color: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

/* Mobile */
@media (max-width: 1024px) {

    .messages-container,
    .input-area {
        max-width: 900px;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .mobile-menu-btn {
        display: block !important;
        color: white;
        background: transparent;
        border: none;
        font-size: 1.5rem;
        margin-right: 1rem;
        cursor: pointer;
    }

    .messages-container {
        padding: 1rem 1rem 1.5rem 1rem !important;
        gap: 1rem;
    }

    .message {
        max-width: 100%;
        gap: 0.75rem;
    }

    .message-content {
        font-size: 0.95rem;
        padding: 0.6rem 1rem;
    }

    .input-area {
        padding: 0.75rem 1rem 1.5rem 1rem !important;
        max-width: 100%;
    }

    .input-container {
        border-radius: 1rem;
    }

    .input-container textarea {
        font-size: 0.95rem;
        padding: 0.5rem;
    }

    /* Tool View Responsiveness */
    .tool-view {
        padding: 1rem;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-group label {
        font-size: 0.8rem;
    }

    .form-group input,
    .form-group textarea {
        padding: 0.6rem;
        font-size: 0.95rem;
    }

    /* Adjust Log Console for Mobile */
    #output-console-container {
        padding: 0 1rem 1.5rem 1rem;
    }

    #output-console {
        margin-top: 10px;
        min-height: 120px;
        font-size: 0.75rem;
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 0.75rem 1rem;
    }

    .logo span {
        font-size: 1rem;
    }

    .logo-img {
        width: 24px;
        height: 24px;
    }

    .nav-item {
        padding: 0.6rem 0.75rem;
        font-size: 0.9rem;
    }
}