:root {
    /* Brand Colors */
    --brand-primary: #18c8fe;
    --brand-accent: #eeae37;
    --brand-accent-hover: #fcd34d;
    /* Lighter yellow for hover */

    /* Neutral Colors */
    --neutral-white: #FFFFFF;
    --neutral-bg: #F9FAFB;
    /* Sidebar bg */
    --neutral-chat-bg: #FFFFFF;
    /* Chat bg */
    --neutral-user-bubble: #F3F4F6;
    --text-dark: #333333;
    --text-gray: #4B5563;
    --text-light: #9CA3AF;
    --border-color: #E5E7EB;

    /* Font */
    --font-family: 'Inter', sans-serif;

    /* Dimensions */
    --sidebar-width: 260px;
    --header-height: 60px;
}

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

body {
    font-family: var(--font-family);
    color: var(--text-dark);
    background-color: var(--neutral-chat-bg);
    height: 100dvh;
    overflow: hidden;
    /* Prevent body scroll, handle in containers */
}

.app-container {
    display: flex;
    height: 100%;
    width: 100%;
    position: relative;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--neutral-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 20;
    transform: translateX(-100%);
    /* Hidden by default on mobile */
    transition: transform 0.3s ease-in-out;
}

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

.sidebar-header {
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
}

.new-chat-btn {
    flex: 1;
    /* Occupy remaining space */
    width: auto;
    padding: 1rem;
    background-color: var(--neutral-white);
    border: 1px solid var(--brand-primary);
    color: var(--brand-primary);
    border-radius: 0.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    color: var(--neutral-white);
}

.refresh-chat-btn {
    width: 44px;
    /* Standard click target */
    padding: 0;
    background-color: var(--neutral-white);
    border: 1px solid var(--border-color);
    color: var(--text-gray);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.refresh-chat-btn:hover {
    background-color: #F3F4F6;
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem;
}

.history-item {
    padding: 0.75rem;
    margin-bottom: 0.25rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-gray);
    transition: background-color 0.2s;
    font-size: 0.9rem;
}

.history-item:hover {
    background-color: #E5E7EB;
    /* Gray-200 */
}

.history-item.active {
    background-color: #EFF6FF;
    /* Blue-50 */
    color: var(--brand-primary);
    border-left: 3px solid var(--brand-primary);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.history-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.history-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.history-date {
    font-size: 0.75rem;
    color: #9CA3AF;
    /* text-light */
    margin-top: 2px;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    /* Increased hit area */
    border-radius: 0.5rem;
    transition: background-color 0.2s;
    flex: 1;
    /* Take available space */
    margin-right: 0.5rem;
    /* Space from logout btn */
    min-width: 0;
    /* Crucial for flex child truncation */
}

.user-profile:hover {
    background-color: #E5E7EB;
}

.user-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
    /* Crucial for flex child truncation */
}

.user-avatar {
    width: 32px;
    height: 32px;
    background-color: var(--brand-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    flex-shrink: 0;
    /* Prevent crushing */
}

.username {
    font-size: 0.9rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.account-link-text {
    font-size: 0.75rem;
    color: var(--text-gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-profile:hover .account-link-text {
    color: var(--brand-primary);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: color 0.2s;
}

.logout-btn:hover {
    color: var(--text-dark);
    background-color: #E5E7EB;
}

/* --- Main Stage --- */
.main-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    width: 100%;
    /* Ensure full width */
}

.chat-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    border-bottom: 1px solid transparent;
    /* Keep layout stable */
}

.mobile-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dark);
    padding: 0.5rem;
}

.header-logo img {
    height: 150px;
    /* o l'altezza che preferisci */
    width: auto;
    /* mantiene le proporzioni */
    display: block;
}

.header-settings-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    border-radius: 50%;
    transition: background-color 0.2s;
    cursor: pointer;
}

.header-settings-btn:hover {
    background-color: #F3F4F6;
    color: var(--brand-primary);
}

/* --- Chat Container --- */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
    padding-bottom: 200px;
    /* Space for input area */
}

/* Zero State Overhaul */
.zero-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s;
    margin-bottom: 2rem;
    padding: 0 1rem;
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.zero-state.hidden {
    display: none;
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 2rem;
}

.zero-state-logo img {
    width: 100px;
    height: auto;
    margin-bottom: 1.5rem;
    border-radius: 5%;
    /* Make it circular if it's square */
    object-fit: cover;
    /* Kept a subtle shadow */
}

.hero-section h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    color: var(--text-gray);
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Search Container */
.search-container {
    width: 100%;
    max-width: 600px;
    margin-bottom: 2rem;
    position: relative;
    /* Ensure z-index context for suggestions */
    z-index: 10;
}

.search-box-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.search-box-wrapper:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 4px 12px rgba(24, 200, 254, 0.15);
}

.hero-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    font-size: 1rem;
    font-family: var(--font-family);
    color: var(--text-dark);
}

.hero-search-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.25rem;
    color: var(--brand-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Search Suggestions Dropdown */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    /* Hidden by default */
}

.search-suggestions.visible {
    display: block;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-dark);
    transition: background-color 0.2s;
    font-size: 0.95rem;
}

.suggestion-item:hover {
    background-color: #F3F4F6;
}

.suggestion-icon {
    color: var(--text-light);
    flex-shrink: 0;
}

/* Quick Chips Grid */
.quick-examples-section {
    width: 100%;
    margin-bottom: 2rem;
}

.quick-chips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
    width: 100%;
}

.chip {
    background-color: #fff;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    color: var(--text-dark);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chip:hover {
    border-color: var(--brand-primary);
    background-color: #F0F9FF;
    /* Very light blue */
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Browse All Button */
.browse-all-container {
    text-align: center;
}

.browse-all-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.25rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    color: var(--text-gray);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
}

.browse-all-btn:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background-color: #fff;
}

/* --- Topics Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s;
    backdrop-filter: blur(2px);
}

.modal-overlay.visible {
    display: flex;
    opacity: 1;
}

.modal-container {
    background-color: #fff;
    width: 100%;
    max-width: 600px;
    height: 80vh;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.2s;
}

.modal-overlay.visible .modal-container {
    transform: translateY(0);
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-gray);
    cursor: pointer;
    padding: 0.2rem;
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--text-dark);
}

.modal-search-bar {
    padding: 1rem 1.5rem 0.5rem;
}

.modal-search-bar input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    font-family: var(--font-family);
    transition: border-color 0.2s;
}

.modal-search-bar input:focus {
    border-color: var(--brand-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem 2rem;
}

.topic-category-group {
    margin-bottom: 1.5rem;
}

.topic-category-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-gray);
    font-weight: 600;
    margin-bottom: 0.75rem;
    letter-spacing: 0.5px;
}

.topic-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.topic-item {
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s;
}

.topic-item:hover {
    background-color: #F3F4F6;
    color: var(--brand-primary);
}

.topic-item-arrow {
    opacity: 0;
    transform: translateX(-5px);
    transition: all 0.2s;
}

.topic-item:hover .topic-item-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Scrollbar for modal */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background-color: #D1D5DB;
    border-radius: 10px;
}


/* Message Stream */
.message-stream {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.message {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.message.user {
    justify-content: flex-end;
}

.message.ai {
    justify-content: flex-start;
}

.message-content {
    max-width: 85%;
    line-height: 1.6;
    font-size: 1rem;
}

.message.user .message-content {
    background-color: var(--neutral-user-bubble);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border-top-right-radius: 2px;
    color: var(--text-dark);
}

.message.ai .message-content {
    background-color: transparent;
    padding: 0;
    /* No bubble for AI */
    color: var(--text-dark);
}

.message-avatar {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 5%;
    overflow: hidden;
    padding: 5px;
    /* Aggiunge un po' di spazio interno */
    background: white;
    /* O il colore che preferisci */
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* --- Images --- */
.message-images {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
    width: 100%;
    justify-content: center;
}

.chat-image-container {
    position: relative;
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background-color: var(--neutral-bg);
}

.chat-image {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-image:hover {
    transform: scale(1.02);
}

/* Loading placeholder for images if needed */
.image-loading {
    height: 150px;
    width: 200px;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 0.8rem;
}

.typing-indicator {
    background-color: transparent;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border-top-left-radius: 2px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: typingPulse 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    background-color: var(--brand-primary);
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    background-color: var(--brand-accent);
    animation-delay: -0.16s;
}

.typing-dot:nth-child(3) {
    background-color: var(--brand-primary);
}

@keyframes typingPulse {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- Input Area (Cockpit) --- */
.input-area-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 1rem 1rem;
    background: linear-gradient(to top, rgba(255, 255, 255, 1) 80%, rgba(255, 255, 255, 0));
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.input-capsule {
    width: 100%;
    max-width: 800px;
    background-color: var(--neutral-white);
    border: 1px solid #E5E7EB;
    border-radius: 1.5rem;
    /* Large rounded corners */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: flex-end;
    /* Align items to bottom for multiline */
    padding: 0.5rem;
    gap: 0.5rem;
    transition: box-shadow 0.2s;
}

.input-capsule:focus-within {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #D1D5DB;
}

.tools-btn {
    background: none;
    border: none;
    color: var(--brand-accent);
    padding: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    height: 40px;
    width: 40px;
    flex-shrink: 0;
}

.tools-btn:hover {
    background-color: #FEF3C7;
    /* Yellow-100 */
}

#chat-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    padding: 0.6rem 0;
    /* Vertically center text */
    max-height: 200px;
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.5;
    background: transparent;
}

.send-btn {
    background-color: var(--brand-primary);
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 50%;
    /* Circle */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, opacity 0.2s;
    height: 40px;
    width: 40px;
    flex-shrink: 0;
}

.send-btn:disabled {
    background-color: #E5E7EB;
    cursor: not-allowed;
    opacity: 0.7;
}

.send-btn:not(:disabled):hover {
    background-color: #0ea5e9;
    /* Darker blue */
}

.input-footer {
    font-size: 0.75rem;
    color: #9CA3AF;
    margin-top: 0.75rem;
    text-align: center;
}

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

.sidebar-overlay.visible {
    display: block;
    opacity: 1;
}

/* --- Responsive Design --- */
/* --- Responsive Design --- */
@media (min-width: 768px) {
    .sidebar {
        position: static;
        transform: none;
        /* Always visible */
        border-right: 1px solid var(--border-color);
    }

    .mobile-menu-btn {
        display: none;
    }
}

@media (max-width: 767px) {
    .quick-chips-grid {
        display: flex;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        scroll-snap-type: x mandatory;
        margin: 0 -1rem;
        /* Stretch full width */
        padding-left: 1rem;
        padding-right: 1rem;
        /* Restore padding */
    }

    .chip {
        flex: 0 0 auto;
        width: 85%;
        max-width: 300px;
        scroll-snap-align: start;
    }

    /* Hide scrollbar for cleaner look */
    .quick-chips-grid::-webkit-scrollbar {
        display: none;
    }

    .quick-chips-grid {
        -ms-overflow-style: none;
        /* IE and Edge */
        scrollbar-width: none;
        /* Firefox */
    }
}

/* --- Message Actions --- */
.message-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    opacity: 1;
}

.message-actions.active {
    opacity: 1;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    color: var(--text-light);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background-color: #F3F4F6;
    color: var(--text-dark);
}

.action-btn.active {
    color: var(--brand-primary);
    background-color: #EFF6FF;
}

.feedback-container {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.feedback-form {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.5rem auto;
    /* Centered */
    background-color: #F9FAFB;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 300px;
}

.feedback-form.visible {
    display: flex;
}

.feedback-textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
    font-family: var(--font-family);
    font-size: 0.9rem;
    resize: vertical;
    min-height: 60px;
}

.feedback-submit,
.feedback-cancel {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    border: none;
}

.feedback-submit {
    background-color: var(--brand-primary);
    color: white;
}

.feedback-submit:hover {
    background-color: #0ea5e9;
}

.feedback-cancel {
    background-color: transparent;
    color: var(--text-gray);
    border: 1px solid var(--border-color);
}

.feedback-cancel:hover {
    background-color: #E5E7EB;
    color: var(--text-dark);
}

.copy-feedback {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
}

.copy-feedback.visible {
    opacity: 1;
}

/* --- Lightbox --- */
.lightbox {
    display: none;
    /* Hidden by default */
    position: fixed;
    z-index: 1000;
    /* Sit on top */
    padding-top: 50px;
    /* Location of the box */
    left: 0;
    top: 0;
    width: 100%;
    /* Full width */
    height: 100%;
    /* Full height */
    overflow: auto;
    /* Enable scroll if needed */
    background-color: rgb(0, 0, 0);
    /* Fallback color */
    background-color: rgba(0, 0, 0, 0.85);
    /* Black w/ opacity */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.visible {
    display: block;
    opacity: 1;
}

.lightbox-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 900px;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.lightbox.visible .lightbox-content {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1001;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Responsive Lightbox */
@media only screen and (max-width: 700px) {
    .lightbox-content {
        width: 95%;
    }

    .lightbox-close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
}

/* --- Tools Dropdown --- */
.tools-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.tools-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 0.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 250px;
    display: none;
    z-index: 50;
    padding: 0.5rem;
    animation: fadeIn 0.2s ease-out;
}

.tools-dropdown.visible {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.tool-item {
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
    color: var(--text-dark);
    font-size: 0.9rem;
    position: relative;
}

.tool-item:hover {
    background-color: var(--neutral-bg);
}

.tool-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.tool-name {
    font-weight: 500;
}

/* Tooltip */
.tool-item::after {
    content: attr(data-description);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #1F2937;
    /* Gray-800 */
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    white-space: nowrap;
    margin-left: 0.75rem;
    z-index: 60;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
}

.copy-feedback.visible {
    opacity: 1;
}

/* --- Lightbox --- */
.lightbox {
    display: none;
    /* Hidden by default */
    position: fixed;
    z-index: 1000;
    /* Sit on top */
    padding-top: 50px;
    /* Location of the box */
    left: 0;
    top: 0;
    width: 100%;
    /* Full width */
    height: 100%;
    /* Full height */
    overflow: auto;
    /* Enable scroll if needed */
    background-color: rgb(0, 0, 0);
    /* Fallback color */
    background-color: rgba(0, 0, 0, 0.85);
    /* Black w/ opacity */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.visible {
    display: block;
    opacity: 1;
}

.lightbox-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 900px;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.lightbox.visible .lightbox-content {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1001;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Responsive Lightbox */
@media only screen and (max-width: 700px) {
    .lightbox-content {
        width: 95%;
    }

    .lightbox-close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
}

/* --- Tools Dropdown --- */
.tools-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.tools-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 0.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 250px;
    display: none;
    z-index: 50;
    padding: 0.5rem;
    animation: fadeIn 0.2s ease-out;
}

.tools-dropdown.visible {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.tool-item {
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
    color: var(--text-dark);
    font-size: 0.9rem;
    position: relative;
}

.tool-item:hover {
    background-color: var(--neutral-bg);
}

.tool-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.tool-name {
    font-weight: 500;
}

/* Tooltip */
.tool-item::after {
    content: attr(data-description);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #1F2937;
    /* Gray-800 */
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    white-space: nowrap;
    margin-left: 0.75rem;
    z-index: 60;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    visibility: hidden;
}

.tool-item:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Arrow for tooltip */
.tool-item:hover::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: transparent #1F2937 transparent transparent;
    margin-left: -3px;
    /* Adjust based on margin-left of tooltip */
    z-index: 60;
}

/* --- Active Tool Indicator --- */
.input-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.active-tool-container {
    display: none;
    /* Hidden by default */
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.active-tool-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #EFF6FF;
    /* Blue-50 */
    color: var(--brand-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;

    .lightbox-close {
        position: absolute;
        top: 20px;
        right: 35px;
        color: #f1f1f1;
        font-size: 40px;
        font-weight: bold;
        transition: 0.3s;
        cursor: pointer;
        z-index: 1001;
    }

    .lightbox-close:hover,
    .lightbox-close:focus {
        color: #bbb;
        text-decoration: none;
        cursor: pointer;
    }

    /* Responsive Lightbox */
    @media only screen and (max-width: 700px) {
        .lightbox-content {
            width: 95%;
        }

        .lightbox-close {
            top: 10px;
            right: 20px;
            font-size: 30px;
        }
    }

    /* --- Tools Dropdown --- */
    .tools-wrapper {
        position: relative;
        display: flex;
        align-items: center;
    }

    .tools-dropdown {
        position: absolute;
        bottom: 100%;
        left: 0;
        margin-bottom: 0.5rem;
        background: white;
        border: 1px solid var(--border-color);
        border-radius: 0.75rem;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        width: 250px;
        display: none;
        z-index: 50;
        padding: 0.5rem;
        animation: fadeIn 0.2s ease-out;
    }

    .tools-dropdown.visible {
        display: block;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(10px);
        }

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

    .tool-item {
        padding: 0.75rem;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        cursor: pointer;
        border-radius: 0.5rem;
        transition: background-color 0.2s;
        color: var(--text-dark);
        font-size: 0.9rem;
        position: relative;
    }

    .tool-item:hover {
        background-color: var(--neutral-bg);
    }

    .tool-icon {
        font-size: 1.2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
    }

    .tool-name {
        font-weight: 500;
    }

    /* Tooltip */
    .tool-item::after {
        content: attr(data-description);
        position: absolute;
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        background: #1F2937;
        /* Gray-800 */
        color: white;
        padding: 0.5rem 0.75rem;
        border-radius: 0.375rem;
        font-size: 0.8rem;
        white-space: nowrap;
        margin-left: 0.75rem;
        z-index: 60;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.2s;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        visibility: hidden;
    }

    .tool-item:hover::after {
        opacity: 1;
        visibility: visible;
    }

    /* Arrow for tooltip */
    .tool-item:hover::before {
        content: '';
        position: absolute;
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        border-width: 5px;
        border-style: solid;
        border-color: transparent #1F2937 transparent transparent;
        margin-left: -3px;
        /* Adjust based on margin-left of tooltip */
        z-index: 60;
    }

    /* --- Active Tool Indicator --- */
    .input-content-wrapper {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .active-tool-container {
        display: none;
        /* Hidden by default */
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }

    .active-tool-chip {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        background-color: #EFF6FF;
        /* Blue-50 */
        color: var(--brand-primary);
        padding: 0.25rem 0.75rem;
        border-radius: 1rem;
        font-size: 0.85rem;
        font-weight: 500;
        border: 1px solid #BFDBFE;
        /* Blue-200 */
    }

    .active-tool-close {
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        padding: 2px;
        transition: background-color 0.2s;
        color: var(--text-gray);
    }

    .active-tool-close:hover {
        background-color: rgba(0, 0, 0, 0.1);
        color: var(--text-dark);
    }

    /* --- History Item Content --- */
    .history-content {
        display: flex;
        flex-direction: column;
        overflow: hidden;
        flex: 1;
    }

    .history-text {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 500;
    }

    .history-date {
        font-size: 0.75rem;
        color: var(--text-light);
        margin-top: 2px;
    }
}