body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #e3e9f0 0%, #f7fafd 100%);
    color: #222;
    min-height: 100vh;
    width: 100vw;
    overflow-x: hidden;
}

.container {
    background: rgba(255,255,255,0.32);
    border-radius: 28px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.10);
    padding: 48px 44px 36px 44px;
    margin: 30px auto;
    max-width: 1400px;
    width: 90vw;
    min-width: 320px;
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    border: 1.5px solid rgba(255,255,255,0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1a237e;
    margin-bottom: 32px;
    letter-spacing: 0.5px;
    text-align: center;
}

.form-group {
    margin-bottom: 28px;
    width: 100%;
}

.form-group label {
    font-size: 1.08rem;
    font-weight: 600;
    color: #1a237e;
    margin-bottom: 8px;
    display: block;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 15px 18px;
    border: none;
    border-radius: 18px;
    background: rgba(255,255,255,0.7);
    box-shadow: 0 2px 12px 0 rgba(0,0,0,0.06);
    font-size: 1.08rem;
    color: #1a237e;
    outline: none;
    transition: box-shadow 0.2s, background 0.2s;
    font-weight: 500;
    margin-top: 4px;
    box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    background: rgba(255,255,255,0.95);
    box-shadow: 0 4px 24px 0 rgba(0,123,255,0.10);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* Form layout for desktop */
@media (min-width: 768px) {
    #createProjectForm {
        display: grid;
        grid-template-columns: 1fr;
        gap: 32px;
        width: 100%;
    }

    .form-group:first-child {
        grid-column: 1;
    }

    .form-group:nth-child(2) {
        grid-column: 1;
    }

    .form-group:nth-child(3) {
        grid-column: 1;
    }

    .btn.btn-primary {
        grid-column: 1;
        justify-self: center;
        max-width: 300px;
    }

    .form-group textarea {
        min-height: 140px;
    }
}

.project-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
    width: 100%;
}

.project-header h1 {
    font-size: 28px;
    margin: 0 0 16px 0;
}

.project-header p {
    font-size: 16px;
    color: #6c757d;
    line-height: 1.6;
}

.description-wrapper {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: rgba(248, 249, 250, 0.6);
    border-radius: 16px;
    padding: 20px;
    margin-top: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.description-content {
    font-size: 16px;
    color: #6c757d;
    line-height: 1.6;
    padding: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    margin: 0;
}

.description-content.collapsed {
    max-height: 9.3em;
}

.description-content.expanded {
    max-height: none;
}

.description-fade-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2.4em;
    background: linear-gradient(to bottom,
        rgba(248, 249, 250, 0) 0%,
        rgba(248, 249, 250, 0.7) 50%,
        rgba(248, 249, 250, 0.95) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 0 0 16px 16px;
}

.description-fade-overlay.visible {
    opacity: 1;
}

.description-controls {
    display: flex;
    justify-content: center;
    margin-top: 16px;
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.description-controls.visible {
    opacity: 1;
    transform: translateY(0);
}

.expand-btn {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-size: 14px;
    color: #495057;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.expand-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.12);
    color: #343a40;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.expand-btn:active {
    transform: translateY(0);
    background: rgba(248, 249, 250, 0.95);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.expand-text {
    font-size: 14px;
    transition: all 0.2s ease;
}

.expand-icon {
    width: 16px;
    height: 16px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    flex-shrink: 0;
}

.expand-btn.expanded .expand-icon {
    transform: rotate(180deg);
}

.recommendations-section {
    width: 100%;
}

.recommendations-section h2 {
    font-size: 22px;
    color: #343a40;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.recommendations-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.recommendation-card {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.recommendation-card h3 {
    font-size: 18px;
    color: #007bff;
    margin-top: 0;
    margin-bottom: 8px;
}

.recommendation-card a {
    display: inline-block;
    font-size: 14px;
    color: #0056b3;
    text-decoration: none;
    margin-bottom: 12px;
    word-break: break-all;
}

.recommendation-card a:hover {
    text-decoration: underline;
}

.recommendation-card p {
    font-size: 14px;
    color: #495057;
    line-height: 1.5;
    flex-grow: 1;
    margin-bottom: 0;
}

.agent-thoughts-section {
    width: 100%;
    margin-bottom: 32px;
}

.agent-thoughts-section h2 {
    font-size: 22px;
    color: #343a40;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.agent-thoughts-list {
  list-style: none;
  padding: 1rem;
  margin: 0;
  font-family: monospace;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 8px;
}
@media (max-width: 600px) {
    .agent-thoughts-list {
        max-height: 400px;
    }
}

.agent-thoughts-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid #e5e7eb;
  line-height: 1.6;
}

.agent-thoughts-list li:last-child {
  border-bottom: none;
}

.agent-thoughts-list li strong {
  color: #111827;
}

.agent-thoughts-list li p {
    margin: 0;
    padding: 0.25rem 0 0 1.5rem;
    color: #6b7280;
    white-space: pre-wrap;
    word-break: break-all;
}

.upload-description {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 12px;
    margin-top: -4px;
}

.upload-area {
    border: 2px dashed #b3d1ff;
    border-radius: 16px;
    padding: 32px 20px;
    text-align: center;
    background: rgba(255,255,255,0.45);
    transition: all 0.2s ease;
    cursor: pointer;
    margin-top: 8px;
    margin-bottom: 8px;
    box-shadow: 0 2px 12px 0 rgba(0,123,255,0.04);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.upload-area:hover, .upload-area.dragover {
    border-color: #007bff;
    background: rgba(0,123,255,0.07);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-icon {
    font-size: 48px;
    opacity: 0.5;
}

.upload-text {
    font-size: 16px;
    color: #495057;
    margin: 0;
}

.upload-hint {
    font-size: 12px;
    color: #6c757d;
    margin: 0;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: rgba(255,255,255,0.7);
    box-shadow: 0 2px 8px 0 rgba(0,0,0,0.04);
    margin-top: 10px;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    font-size: 24px;
}

.file-name-size {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name {
    font-weight: 500;
    color: #343a40;
    font-size: 14px;
}

.file-size {
    font-size: 12px;
    color: #6c757d;
}

.btn-remove {
    padding: 7px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 600;
}

.btn-remove:hover {
    background: #c82333;
}

.btn.btn-primary {
    font-size: 1.13rem;
    padding: 15px 38px;
    border-radius: 32px;
    background: linear-gradient(90deg, #007bff 60%, #4f8cff 100%);
    color: #fff;
    box-shadow: 0 4px 24px 0 rgba(0,123,255,0.13);
    border: none;
    font-weight: 700;
    letter-spacing: 0.7px;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    outline: none;
    margin-top: 10px;
    width: 100%;
    max-width: 320px;
    align-self: center;
}

.btn.btn-primary:hover, .btn.btn-primary:focus {
    background: linear-gradient(90deg, #0056b3 60%, #007bff 100%);
    transform: translateY(-2px) scale(1.045);
    box-shadow: 0 8px 32px 0 rgba(0,123,255,0.18);
}

/* --- HEADER --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px 18px 30px;
    background: rgba(255,255,255,0.85);
    box-shadow: 0 2px 24px 0 rgba(0,0,0,0.06);
    border-radius: 0 0 24px 24px;
    margin-bottom: 30px;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.logo-title {
    display: flex;
    align-items: center;
    gap: 18px;
}
.logo-svg {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 8px rgba(0,123,255,0.10));
}
.main-header h1 {
    font-size: 2.3rem;
    font-weight: 700;
    color: #1a237e;
    margin: 0;
    letter-spacing: 1.2px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.create-project-cta {
    font-size: 1.15rem;
    padding: 16px 38px;
    border-radius: 32px;
    order: 1;
    background: linear-gradient(90deg, #007bff 60%, #4f8cff 100%);
    color: #fff;
    box-shadow: 0 4px 24px 0 rgba(0,123,255,0.13);
    border: none;
    font-weight: 700;
    letter-spacing: 0.7px;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    outline: none;
}
.create-project-cta:hover, .create-project-cta:focus {
    background: linear-gradient(90deg, #0056b3 60%, #007bff 100%);
    transform: translateY(-2px) scale(1.045);
    box-shadow: 0 8px 32px 0 rgba(0,123,255,0.18);
}

.header-actions {
    display: flex;
    flex-direction: row-reverse;
    gap: 40px;
}

#clerk-user-button button span span {
    order: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    width: 40px;
}

/* --- SEARCH BAR --- */
.search-bar-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}
.search-bar {
    width: 100%;
    max-width: 440px;
    padding: 16px 28px;
    border-radius: 32px;
    border: none;
    font-size: 1.13rem;
    background: rgba(255,255,255,0.7);
    box-shadow: 0 2px 16px 0 rgba(0,0,0,0.06);
    outline: none;
    transition: box-shadow 0.2s, background 0.2s;
    font-weight: 500;
    color: #1a237e;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.search-bar:focus {
    background: rgba(255,255,255,0.95);
    box-shadow: 0 4px 24px 0 rgba(0,123,255,0.10);
}

/* --- PROJECTS LIST --- */
.projects-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Always 2 columns on desktop */
    grid-template-rows: repeat(2, 1fr);   /* Always 2 rows on desktop */
    gap: 40px;
    padding: 0 30px 64px 30px;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 60vh;
    justify-items: stretch;
    align-items: stretch;
}

.project-card {
    background: rgba(255,255,255,0.32);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.10);
    padding: 38px 32px 28px 32px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    transition: transform 0.18s cubic-bezier(.4,2,.6,1), box-shadow 0.18s, background 0.18s;
    cursor: pointer;
    opacity: 0;
    transform: translateY(40px) scale(0.98);
    animation: cardFadeIn 0.7s cubic-bezier(.4,2,.6,1) forwards;
    border: 1.5px solid rgba(255,255,255,0.35);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}
.project-card:hover {
    transform: translateY(-8px) scale(1.035);
    box-shadow: 0 16px 48px 0 rgba(0,123,255,0.18);
    background: rgba(255,255,255,0.55);
    border: 1.5px solid #b3d1ff;
}
@keyframes cardFadeIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.project-title {
    font-size: 1.32rem;
    font-weight: 700;
    color: #1a237e;
    margin-bottom: 2px;
    letter-spacing: 0.2px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.project-description {
    font-size: 1.09rem;
    color: #222b;
    line-height: 1.7;
    min-height: 48px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4; /* Show up to 4 lines, then ... */
    -webkit-box-orient: vertical;
    white-space: normal;
    max-height: 6.8em;
}
.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 6px;
}
.project-tag {
    display: inline-block;
    background-color: #f8f9fa;
    color: #6c757d;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-right: 8px;
    margin-bottom: 4px;
    font-weight: 500;
    border: 1px solid #e9ecef;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.project-card:hover .project-tag {
    color: #007bff;
    background-color: rgba(0, 123, 255, 0.1);
    border-color: rgba(0, 123, 255, 0.2);
    transform: translateY(-1px);
}
.project-date {
    margin-top: auto;
    font-size: 0.99rem;
    color: #6c7a8a;
    letter-spacing: 0.1px;
    font-weight: 500;
}

/* --- SCROLL ANIMATION --- */
.projects-list .project-card {
    will-change: opacity, transform;
}

/* --- NO PROJECTS MESSAGE --- */
.no-projects-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 60px 20px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

.no-projects-icon {
    font-size: 4rem;
    color: #6c757d;
    margin-bottom: 0px;
    opacity: 0.6;
}

.no-projects-title {
    font-size: 2rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

.no-projects-subtitle {
    font-size: 1.1rem;
    color: #6c757d;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

/* Hide search bar when no projects */
.search-bar-wrapper.hidden {
    display: none;
}

/* --- RESPONSIVE --- */
/* Desktop optimizations */
@media (min-width: 1200px) {
    .container {
        max-width: 1500px;
        padding: 50px 60px 40px 60px;
    }
    .form-group {
        margin-bottom: 32px;
    }
    .recommendations-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px;
    }
    .projects-list {
        padding: 0 40px 64px 40px;
        max-width: 1600px;
    }
}

/* Tablet and smaller desktop */
@media (max-width: 1100px) {
    .projects-list {
        grid-template-columns: 1fr;
        grid-template-rows: none;
        padding-left: 30px;
        padding-right: 30px;
    }
    .container {
        max-width: 90vw;
        padding: 40px 40px 30px 40px;
        margin: 25px auto;
    }
}

/* Mobile tablet */
@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        gap: 18px;
        align-items: flex-start;
        padding: 18px 20px 12px 20px;
    }
    .projects-list {
        grid-template-columns: 1fr;
        grid-template-rows: none;
        padding: 0 20px 24px 20px;
        gap: 24px;
    }
    .container {
        max-width: 90vw;
        padding: 30px 20px 20px 20px;
        margin: 25px auto;
    }
    .recommendations-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .main-header {
        padding: 16px 15px 10px 15px;
    }
    .main-header h1 {
        font-size: 1.4rem;
    }
    .projects-list {
        padding: 0 15px 20px 15px;
        gap: 16px;
    }
    .project-card {
        padding: 20px 16px;
    }
    .project-title {
        font-size: 1.1rem;
    }
    .project-description {
        font-size: 1rem;
    }
    .search-bar {
        max-width: 100%;
        padding: 14px 18px;
        font-size: 1rem;
    }
    .create-project-cta {
        font-size: 1rem;
        padding: 12px 20px;
    }
    .container {
        max-width: 90vw;
        padding: 20px 18px;
        margin: 20px auto;
        border-radius: 20px;
    }
    .container h1 {
        font-size: 1.5rem;
    }
    .form-group {
        margin-bottom: 24px;
    }
    .form-group label {
        font-size: 1rem;
    }
    .form-group input[type="text"],
    .form-group textarea {
        font-size: 1rem;
        padding: 12px 16px;
        border-radius: 14px;
    }
    .btn.btn-primary {
        font-size: 1rem;
        padding: 14px 24px;
        border-radius: 18px;
    }

    /* Mobile responsive for no projects message */
    .no-projects-container {
        min-height: 50vh;
        padding: 40px 20px;
    }

    .no-projects-icon {
        font-size: 3rem;
        margin-bottom: 0px;
    }

    .no-projects-title {
        font-size: 1.5rem;
        margin-bottom: 12px;
    }

    .no-projects-subtitle {
        font-size: 1rem;
        max-width: 300px;
    }
}

.info-icon {
    position: relative;
    cursor: pointer;
    margin-left: 8px;
    font-size: 1em;
    vertical-align: middle;
}

.tooltip {
    visibility: hidden;
    opacity: 0;
    width: 320px;
    background: rgba(255,255,255,0.95);
    color: #1a237e;
    text-align: left;
    border-radius: 12px;
    padding: 16px;
    position: absolute;
    z-index: 10;
    top: 120%;
    left: 50%;
    transform: translateX(-50%);
    transition: opacity 0.2s;
    font-size: 0.95em;
    font-weight: 400;
    box-shadow: 0 4px 24px 0 rgba(31, 38, 135, 0.15);
    border: 1.5px solid #b3d1ff;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    line-height: 1.5;
}

.info-icon:hover .tooltip,
.info-icon:focus .tooltip {
    visibility: visible;
    opacity: 1;
}


/* PubSub section styling */
.pubsub-section {
    margin: 32px 0;
    padding: 24px;
    background: #f7fafe;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.pubsub-section h2 {
    font-size: 20px;
    margin-bottom: 16px;
    color: #007bff;
}

#pubsubSubscribeForm {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

#pubsubSubscribeForm input[type="email"] {
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 15px;
    min-width: 240px;
}

/* Horizontal papers bar */
#pubsubPapersBar {
    margin-top: 12px;
}

#pubsubPapersBar h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #343a40;
}

#pubsubPapersContainer {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
}

#pubsubPapersContainer .recommendation-card {
    min-width: 240px;
    max-width: 340px;
    flex-shrink: 0;
    background: #f1f8ff;
    border: 1px solid #cfe2ff;
}

#pubsubPapersContainer .recommendation-card h4 {
    font-size: 16px;
    margin: 0 0 6px 0;
    color: #0056b3;
}

#pubsubPapersContainer .recommendation-card a {
    color: #007bff;
}

#pubsubPapersContainer .recommendation-card p {
    color: #495057;
    font-size: 13px;
}
/* Out-of-scope message styles */
.out-of-scope-container {
    background: rgba(255, 248, 225, 0.9);
    border: 2px solid #ffc107;
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 4px 16px rgba(255, 193, 7, 0.15);
}

.out-of-scope-title {
    color: #856404;
    font-size: 1.5rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.out-of-scope-explanation {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border-left: 4px solid #ffc107;
}

.out-of-scope-explanation p {
    margin: 8px 0;
    line-height: 1.6;
    color: #495057;
}

.out-of-scope-explanation strong {
    color: #856404;
}

.out-of-scope-suggestion {
    background: rgba(220, 248, 198, 0.8);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    border-left: 4px solid #28a745;
}

.out-of-scope-suggestion p {
    margin: 8px 0;
    line-height: 1.6;
    color: #155724;
}

.out-of-scope-suggestion strong {
    color: #155724;
}

.new-query-container {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.new-query-container label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.new-query-container textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    color: #495057;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
    font-family: inherit;
}

.new-query-container textarea:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.new-query-container button {
    margin-top: 16px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
}

/* Mobile responsive for out-of-scope */
@media (max-width: 480px) {
    .out-of-scope-container {
        padding: 16px;
        margin: 16px 0;
    }

    .out-of-scope-title {
        font-size: 1.3rem;
    }

    .new-query-container {
        padding: 16px;
    }

    .new-query-container textarea {
        min-height: 60px;
        font-size: 0.95rem;
    }
}

/* --- Minimal Out-of-Scope Subunit Styles for Agent Thoughts --- */
.out-of-scope-thought-subunit {
    margin: 20px 0 0 0;
    padding: 12px 18px 10px 14px;
    background: rgba(255, 255, 240, 0.45); /* even lighter yellow/ivory */
    border-left: 2px solid #fff5b8; /* very thin, subtle yellow */
    border-radius: 6px;
    box-shadow: none;
    font-size: 0.97rem;
    width: 100%;
    max-width: none;
    transition: background 0.2s, border-color 0.2s;
    box-sizing: border-box;
    display: block;
}
.out-of-scope-short {
    font-weight: 500;
    color: #b59a2c;
    font-size: 0.97rem;
    margin-bottom: 0;
    line-height: 1.5;
}
.out-of-scope-expand-btn {
    background: none;
    border: none;
    color: #4a6ee0;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0 0 0 0;
    text-decoration: underline;
    font-weight: 400;
    white-space: nowrap;
    margin: 4px 0 8px 0;
    border-radius: 0;
}
.out-of-scope-full {
    background: rgba(245,245,245,0.93);
    border-radius: 4px;
    padding: 7px 10px;
    margin-bottom: 8px;
    margin-top: 2px;
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
    border: 1px solid #f8f8f8;
}
.out-of-scope-suggestion-inline {
    background: rgba(245, 247, 250, 0.7);
    border-radius: 4px;
    padding: 7px 10px;
    margin-bottom: 8px;
    border-left: 2px solid #e3eafc;
    color: #3a4664;
    font-size: 0.95rem;
}
.out-of-scope-suggestion-inline strong {
    color: #4a6ee0;
    font-weight: 500;
}
.new-query-inline-container {
    background: rgba(255,255,255,0.97);
    border-radius: 4px;
    padding: 7px 10px 10px 10px;
    border: 1px solid #f3f3f3;
    margin-top: 6px;
    box-shadow: none;
}
.new-query-inline-container label {
    font-weight: 400;
    color: #495057;
    margin-bottom: 6px;
    font-size: 0.95rem;
    display: block;
}
.new-query-inline-container textarea {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 0.95rem;
    color: #495057;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: vertical;
    min-height: 40px;
    box-sizing: border-box;
    font-family: inherit;
    margin-bottom: 6px;
    background: #fafbfc;
}
.new-query-inline-container textarea:focus {
    border-color: #4a6ee0;
    box-shadow: 0 0 0 1.5px rgba(74, 110, 224, 0.08);
}
.new-query-inline-container button {
    margin-top: 2px;
    padding: 7px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    background: linear-gradient(135deg, #4a6ee0 0%, #7eaaff 100%);
    color: #fff;
    border: none;
    border-radius: 4px;
    box-shadow: none;
    cursor: pointer;
    transition: background 0.2s;
}
.new-query-inline-container button:hover, .new-query-inline-container button:focus {
    background: linear-gradient(135deg, #3a57b7 0%, #4a6ee0 100%);
}
@media (max-width: 600px) {
    .out-of-scope-thought-subunit {
        margin-left: 0;
        padding: 7px 2px 6px 2px;
        width: 100%;
    }
}

/* --- No-Results Thought Subunit Styles --- */
.no-results-thought-subunit {
    margin: 20px 0 0 0;
    padding: 12px 18px 10px 14px;
    background: rgba(255, 248, 220, 0.45);
    border-left: 2px solid #ffc107;
    border-radius: 6px;
    box-shadow: none;
    font-size: 0.97rem;
    width: 100%;
    max-width: none;
    transition: background 0.2s, border-color 0.2s;
    box-sizing: border-box;
}

.no-results-explanation {
    color: #856404;
    font-size: 0.97rem;
    line-height: 1.5;
    margin-bottom: 12px;
}

.no-results-explanation p {
    margin: 6px 0;
}

.no-results-explanation strong {
    color: #664d03;
}

.no-results-expand-btn {
    background: none;
    border: none;
    color: #856404;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0 0 0 0;
    text-decoration: underline;
    font-weight: 400;
    white-space: nowrap;
    margin: 4px 0 8px 0;
    border-radius: 0;
}

.no-results-expand-btn:hover {
    color: #664d03;
}

.no-results-filter-details {
    background: rgba(245, 245, 245, 0.93);
    border-radius: 4px;
    padding: 7px 10px;
    margin-bottom: 8px;
    margin-top: 2px;
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
    border: 1px solid #f8f8f8;
}

.no-results-filter-details h4 {
    color: #664d03;
    font-size: 0.95rem;
    margin: 0 0 8px 0;
    font-weight: 600;
}

.no-results-filter-details ul {
    margin: 0;
    padding-left: 16px;
}

.no-results-filter-details li {
    color: #856404;
    font-size: 0.9rem;
    margin: 3px 0;
}

.no-results-filter-details strong {
    color: #664d03;
}

.no-results-suggestion-inline {
    background: rgba(255, 248, 220, 0.7);
    border-radius: 4px;
    padding: 7px 10px;
    margin-bottom: 8px;
    border-left: 2px solid #ffc107;
    color: #856404;
    font-size: 0.95rem;
}

.no-results-suggestion-inline strong {
    color: #664d03;
    font-weight: 500;
}

@media (max-width: 600px) {
    .no-results-thought-subunit {
        margin-left: 0;
        padding: 7px 2px 6px 2px;
        width: 100%;
    }
}



.star-rating {
    display: flex;
    gap: 4px;
    cursor: pointer;
    margin-top: 10px;
}

.star {
    font-size: 20px;
    color: #ced4da;
    transition: color 0.2s;
}

.star.selected {
    color: #ffc107;
}

.star.hovered {
    color: #ffc107;
}

.replacing-paper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    color: #1a237e;
    font-weight: 500;
    font-size: 14px;
    border: 1px solid rgba(26, 35, 126, 0.1);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Temporary highlight for new replacement papers */
.new-replacement {
    animation: newReplacementHighlight 3s ease-out forwards;
    border: 2px solid #007bff;
    box-shadow: 0 0 20px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
}

@keyframes newReplacementHighlight {
    0% {
        background: linear-gradient(135deg, rgba(0, 123, 255, 0.1) 0%, rgba(0, 123, 255, 0.1) 100%);
        border-color: #007bff;
        box-shadow: 0 0 30px rgba(0, 123, 255, 0.5);
    }
    50% {
        background: linear-gradient(135deg, rgba(0, 123, 255, 0.05) 0%, rgba(0, 123, 255, 0.05) 100%);
        border-color: #007bff;
        box-shadow: 0 0 15px rgba(0, 123, 255, 0.3);
    }
    100% {
        background: rgba(255, 255, 255, 0.8);
        border-color: rgba(255, 255, 255, 0.3);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
}

/* Make recommendation cards relative positioned for animations */
.recommendation-card {
    position: relative;
}

/* Replacement notification popup */
.replacement-notification {
    position: fixed;
    top: 32px;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: linear-gradient(90deg, #007bff 60%, #4f8cff 100%);
    color: white;
    padding: 18px 32px;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0, 123, 255, 0.18);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    font-size: 1.08rem;
    display: flex;
    align-items: center;
}
.replacement-notification.show {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}
.notification-content {
    display: flex;
    align-items: center;
    gap: 16px;
}
.notification-icon {
    font-size: 1.6rem;
    margin-right: 8px;
}
.notification-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 2px;
}
.notification-message {
    font-size: 1rem;
    opacity: 0.95;
}

/* Metric tooltips */
.metric-with-tooltip {
    position: relative;
}

.metric-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(26, 35, 126, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1000;
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-align: center;
    line-height: 1.4;
}

.metric-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(26, 35, 126, 0.95);
}

.metric-with-tooltip:hover .metric-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(-12px);
}

/* Load More Button Styles */
.load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.load-more-btn {
    background: linear-gradient(90deg, #007bff 60%, #4f8cff 100%);
    color: #fff;
    border: none;
    border-radius: 22px;
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 3px 16px 0 rgba(0,123,255,0.13);
    display: flex;
    align-items: center;
    gap: 5px;
    outline: none;
}

.load-more-btn:hover {
    background: linear-gradient(90deg, #0056b3 60%, #007bff 100%);
    transform: translateY(-2px) scale(1.045);
    box-shadow: 0 8px 32px 0 rgba(0,123,255,0.18);
}

.load-more-btn:active {
    transform: translateY(0);
}

.load-more-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.load-more-btn.loading {
    position: relative;
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.load-more-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Search Panel Styles */
.search-panel {
    margin-bottom: 32px;
    animation: fadeInUp 0.4s ease-out;
    width: 100%;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-controls-container {
    display: flex;
    gap: 16px;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Search Input Styles */
.search-input-wrapper {
    position: relative;
    flex: 3 3 0;
    min-width: 0;
}

.search-input {
    width: 100%;
    height: 52px;
    padding: 0 48px 0 20px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: rgba(255,255,255,0.7);
    box-shadow: 0 2px 12px 0 rgba(0,0,0,0.06);
    font-size: 1.08rem;
    color: #1a237e;
    outline: none;
    transition: box-shadow 0.2s, background 0.2s, border-color 0.2s;
    font-weight: 500;
    box-sizing: border-box;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.search-input::placeholder {
    color: #6c757d;
    font-weight: 400;
}

.search-input:focus {
    background: rgba(255,255,255,0.95);
    box-shadow: 0 4px 24px 0 rgba(0,123,255,0.10);
    border-color: #007bff;
}

.search-input:hover {
    background: rgba(255,255,255,0.85);
    box-shadow: 0 4px 20px 0 rgba(0,123,255,0.08);
}

/* Clear Button */
.clear-search-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    font-size: 18px;
    font-weight: 300;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: none;
    line-height: 1;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
}

.clear-search-btn:hover {
    background: rgba(0,123,255,0.1);
    color: #007bff;
    transform: translateY(-50%) scale(1.1);
}

.clear-search-btn.visible {
    display: flex;
}

/* Dropdown Styles */
.sort-dropdown,
.filter-dropdown {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
}

/* Wrapper for dropdown with tooltip icon */
.dropdown-with-tooltip {
    position: relative;
    display: flex;
    align-items: center;
}

.sort-select,
.filter-select {
    width: 100%;
    height: 52px;
    padding: 0 40px 0 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: rgba(255,255,255,0.7);
    box-shadow: 0 2px 12px 0 rgba(0,0,0,0.06);
    font-size: 1.08rem;
    color: #6c757d;
    outline: none;
    transition: box-shadow 0.2s, background 0.2s, border-color 0.2s;
    font-weight: 400;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-sizing: border-box;
}

/* Sort info icon (tooltip trigger) */
.sort-info-icon {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #007bff;
    cursor: help;
    z-index: 5;
    transition: all 0.2s ease;
    opacity: 0.8;
    user-select: none;
}

.sort-info-icon:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.2);
}

/* Tooltip popup */
.sort-tooltip-popup {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    pointer-events: none;
    z-index: 1000;
    min-width: 280px;
    max-width: 350px;
    white-space: normal;
    text-align: center;
}

/* Tooltip arrow */
.sort-tooltip-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1a237e;
}

.sort-info-icon:hover .sort-tooltip-popup {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 16px);
}

.sort-select option,
.filter-select option {
    color: #1a237e;
    font-weight: 500;
}

.sort-select:focus,
.filter-select:focus {
    background: rgba(255,255,255,0.95);
    box-shadow: 0 4px 24px 0 rgba(0,123,255,0.10);
    border-color: #007bff;
}

.sort-select:hover,
.filter-select:hover {
    background: rgba(255,255,255,0.85);
    box-shadow: 0 4px 20px 0 rgba(0,123,255,0.08);
}

/* Custom dropdown arrow */
.sort-dropdown::after,
.filter-dropdown::after {
    content: '';
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #6c757d;
    pointer-events: none;
    transition: all 0.2s ease;
}

.sort-dropdown:hover::after,
.filter-dropdown:hover::after {
    border-top-color: #007bff;
    transform: translateY(-50%) scale(1.1);
}

/* Clear button for dropdowns */
.sort-dropdown .clear-dropdown-btn,
.filter-dropdown .clear-dropdown-btn {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    font-size: 18px;
    font-weight: 300;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: none;
    line-height: 1;
    width: 0;
    height: 0;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.sort-dropdown .clear-dropdown-btn:hover,
.filter-dropdown .clear-dropdown-btn:hover {
    background: rgba(0,123,255,0.1);
    color: #007bff;
    transform: translateY(-50%) scale(1.1);
}

.sort-dropdown .clear-dropdown-btn.visible,
.filter-dropdown .clear-dropdown-btn.visible {
    display: flex;
}

/* Hide arrow when clear button is visible */
.sort-dropdown.has-selection::after,
.filter-dropdown.has-selection::after {
    opacity: 0;
    pointer-events: none;
}

/* Results count */
.results-count {
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 12px;
    text-align: left;
}

/* Responsive Design */
@media (max-width: 768px) {
    .search-controls-container {
        flex-direction: column;
        gap: 12px;
    }

    .search-input-wrapper,
    .sort-dropdown,
    .filter-dropdown {
        width: 100%;
        flex: none;
    }

    .search-input,
    .sort-select,
    .filter-select {
        height: 48px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .search-panel {
        margin-bottom: 24px;
    }

    .search-controls-container {
        gap: 10px;
    }

    .search-input,
    .sort-select,
    .filter-select {
        height: 44px;
        font-size: 0.95rem;
        border-radius: 10px;
    }

    .search-input {
        padding: 0 44px 0 16px;
    }

    .sort-select,
    .filter-select {
        padding: 0 36px 0 14px;
    }

    .clear-search-btn {
        right: 10px;
        font-size: 16px;
        padding: 6px;
        width: 24px;
        height: 24px;
    }

    .sort-dropdown::after,
    .filter-dropdown::after {
        right: 14px;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 5px solid #6c757d;
    }

    .sort-dropdown .clear-dropdown-btn,
    .filter-dropdown .clear-dropdown-btn {
        right: 14px;
        font-size: 16px;
        padding: 6px;
        width: 24px;
        height: 24px;
    }
}

/* Highlight search results */
.recommendation-card.highlighted {
    border: 2px solid #007bff;
    box-shadow: 0 0 20px rgba(0, 123, 255, 0.15);
    background: rgba(255, 255, 255, 0.95);
}

.recommendation-card.hidden {
    display: none;
}

.recommendations-section + .recommendations-section {
    margin-top: 20px;
}

.login-dialog-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
}
