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

:root {
    --primary-blue: #0066CC;
    --dark-blue: #004499;
    --light-blue: #3399ff;
    --white: #ffffff;
    --light-gray: #f5f5f5;
    --dark-gray: #333333;
    --text-dark: #000000;
    --text-light: #666666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 15px rgba(0, 102, 204, 0.2);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--white);
    min-height: 100vh;
    position: relative;
}

/* Menu Button - Top Left */
.menu-button {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-blue);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.menu-button:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-hover);
}

.menu-icon {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 24px;
}

.menu-icon span {
    width: 100%;
    height: 3px;
    background-color: var(--white);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Main Container */
.main-container {
    width: 100%;
    min-height: 100vh;
    position: relative;
}

/* Header - Top Left */
.main-header {
    position: fixed;
    top: 20px;
    left: 90px;
    z-index: 999;
}

.logo-image {
    height: 40px;
    width: auto;
    display: block;
}

.company-tagline {
    font-size: 14px;
    color: var(--light-blue);
    font-weight: 400;
    margin-top: 5px;
    letter-spacing: 1px;
}

/* Chat Section - Centered */
.chat-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 100px 20px 40px;
}

/* Con messaggi, la chat resta in alto e i messaggi scorrono sotto */
.chat-section.has-messages {
    align-items: flex-start;
    justify-content: flex-start;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.chat-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Messages container - sottostante alla chat */
.messages-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 30px;
    width: 100%;
}

/* Message cards nel container: flusso sotto la chat */
.messages-container .message-card {
    position: relative;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    max-width: 100%;
}

.chat-label {
    font-size: 24px;
    color: var(--primary-blue);
    font-weight: 500;
    text-align: center;
}

.chat-input {
    width: 100%;
    padding: 20px 25px;
    font-size: 18px;
    border: 2px solid var(--primary-blue);
    border-radius: 12px;
    background-color: var(--white);
    color: var(--text-dark);
    transition: all 0.3s ease;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: var(--dark-blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

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

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: -350px;
    width: 350px;
    height: 100vh;
    background-color: var(--white);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    z-index: 2000;
    overflow-y: auto;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--primary-blue);
    color: var(--white);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--white);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sidebar-nav {
    padding: 20px;
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.curiosities-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.empty-message {
    color: var(--text-light);
    font-size: 14px;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

.conversation-item {
    padding: 15px;
    background-color: var(--light-gray);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.conversation-item:hover {
    background-color: #e8e8e8;
    border-left-color: var(--primary-blue);
    transform: translateX(5px);
}

.conversation-question {
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 8px;
    font-size: 14px;
}

.conversation-answer {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
}

/* Message Cards */
.message-card {
    position: fixed;
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 20px;
    max-width: 350px;
    z-index: 100;
    cursor: move;
    transition: all 0.3s ease;
}

.message-card.question {
    background-color: var(--primary-blue);
    color: var(--white);
}

.message-card.answer {
    background-color: var(--white);
    border: 2px solid var(--primary-blue);
}

.message-card.collapsed {
    max-height: 150px;
    overflow: hidden;
}

.message-card.expanded {
    max-height: 500px;
    overflow-y: auto;
}

.message-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    opacity: 0.8;
}

.message-card.question .message-label {
    color: rgba(255, 255, 255, 0.9);
}

.message-card.answer .message-label {
    color: var(--primary-blue);
}

.message-content {
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-card.question .message-content {
    color: var(--white);
}

.message-card.answer .message-content {
    color: var(--text-dark);
}

.message-delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-dark);
    transition: all 0.3s ease;
    line-height: 1;
}

.message-delete-btn:hover {
    background: rgba(255, 0, 0, 0.2);
    color: #ff0000;
}

.message-card.dragging {
    opacity: 0.8;
    transform: scale(1.05);
    z-index: 10000;
}

/* Responsive */
@media (max-width: 768px) {
    .menu-button {
        top: 15px;
        left: 15px;
        width: 45px;
        height: 45px;
    }

    .main-header {
        top: 15px;
        left: 70px;
    }

    .logo-text {
        font-size: 24px;
    }

    .company-tagline {
        font-size: 12px;
    }

    .logo-line-top,
    .logo-line-bottom {
        width: 90px;
    }

    .chat-section {
        padding: 120px 20px 40px;
    }

    .chat-label {
        font-size: 20px;
    }

    .chat-input {
        padding: 16px 20px;
        font-size: 16px;
    }

    .sidebar {
        width: 100%;
        left: -100%;
    }

    .messages-container {
        margin-top: 24px;
    }

    .messages-container .message-card {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .main-header {
        left: 65px;
    }

    .logo-text {
        font-size: 20px;
    }

    .logo-line-top,
    .logo-line-bottom {
        width: 70px;
    }
}
