/* review_studies_styles.css - Cleaned v212 (title-driven row height; Ask Grok in Actions) */

/* ====================== GLOBAL ====================== */
body {
    font-family: Tahoma, Arial, sans-serif;
    font-size: 10pt;
    background-color: #d6dcd6;
    overflow-x: hidden;
    padding: 0;
    color: #222b22;
    line-height: 1.4;
}

a { text-decoration: none; color: #222b22; }
a:hover { color: #4f654d; }

/* ====================== MAIN TABLE ====================== */
#review-studies-table {
    width: calc(100% - 40px);
    margin: 12px 20px;
    table-layout: fixed;
    border-collapse: collapse;
    border-radius: 10px;
    overflow: visible;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 2px solid #222b22;
}

#review-studies-table th,
#review-studies-table td {
    border: 2px solid #222b22;
    padding: 8px 6px;
    vertical-align: middle;
}

#review-studies-table td {
    background-color: #ffffff;
    vertical-align: top; /* even row tops when some cells are multi-line */
}

/* Title drives row height — full title wraps freely */
#review-studies-table td.title-column {
    vertical-align: top;
}
#review-studies-table .rs-title-cell {
    display: block;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: anywhere;
    -webkit-hyphens: none;
    hyphens: none;
}
#review-studies-table a.rs-title-link {
    color: #0066cc;
    text-decoration: none;
    word-break: break-word;
    -webkit-hyphens: none;
    hyphens: none;
}
#review-studies-table a.rs-title-link:hover {
    text-decoration: underline;
}
#review-studies-table td.title-column {
    -webkit-hyphens: none;
    hyphens: none;
}

/* Non-title text: max-height set in JS to match Title; overflow → [more] */
#review-studies-table .cell-clamp-box {
    display: block;
    line-height: 1.4;
}
#review-studies-table .cell-text-wrap {
    display: block;
    overflow: hidden;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: anywhere;
}
#review-studies-table .cell-text-wrap.is-expanded {
    max-height: none !important;
    overflow: visible;
}
#review-studies-table .cell-clamp-empty {
    color: #666;
}
#review-studies-table a.toggle-more {
    color: #0066cc;
    font-size: 0.9em;
    white-space: nowrap;
    display: inline-block;
    margin-top: 2px;
}
#review-studies-table a.toggle-more[hidden] {
    display: none !important;
}

/* Actions: Approve/Delete at top; Ask Grok pinned to bottom of cell */
#review-studies-table .rs-actions-inner {
    display: block;
    min-height: 100%;
}
#review-studies-table .rs-actions-top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}
#review-studies-table .ask-grok-btn {
    position: absolute;
    left: 10px;
    bottom: 6px;
    padding: 4px 8px;
    font-size: 0.85em;
    background: #4f654d;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}
#review-studies-table .ask-grok-btn:hover {
    background: #3d503c;
}
#review-studies-table .ask-grok-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}
#review-studies-table .reprocess-btn {
    margin-top: 2px;
    padding: 4px 10px;
    font-size: 0.85em;
    background: #e67e22;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
#review-studies-table .deleted-status-note {
    font-size: 0.9em;
    color: #666;
}
#review-studies-table .grok-pending-note {
    font-size: 0.8em;
    color: #a65c00;
    line-height: 1.25;
    max-width: 110px;
}

#review-studies-table th {
    background-color: #222b22;
    color: #ffffff;
    text-align: center;
    border: 2px solid #ffffff;
    border-bottom: 3px solid #4f654d;
    font-size: 10pt;
    font-weight: bold;
    padding: 8px 6px;
    vertical-align: middle;
}

/* Column widths */
.number-column          { width: 4%;   min-width: 4%;   max-width: 4%;   text-align: center; }
.date-column            { width: 7%;   min-width: 7%;   max-width: 7%; }
.title-column           { width: 16%;  min-width: 16%;  max-width: 16%;  word-break: break-word; overflow-wrap: anywhere; overflow: hidden; }
/* Keep long channel/author strings (e.g. FollowTheAlgorithm) inside the cell —
   without this they overflow and visually "bleed" into Conclusion. */
.authors-column         {
    width: 10%;
    min-width: 10%;
    max-width: 10%;
    word-break: break-word;
    overflow-wrap: anywhere;
    overflow: hidden;
}
.conclusion-table-column { width: 10%;  min-width: 10%;  max-width: 10%;  word-break: break-word; overflow-wrap: anywhere; overflow: hidden; }
/* Wider summaries — room taken from narrower Study Flags header (two-line label) */
.simple-summary-column,
.grok-summary-column    { width: 12%;  min-width: 12%;  max-width: 12%;  word-break: break-word; }
.keywords-column        { width: 7%;   min-width: 7%;   max-width: 7%; }
.flags-column           {
    width: 7%;
    min-width: 7%;
    max-width: 7%;
    text-align: left;
    line-height: 1.25;
    word-break: break-word;
    overflow-wrap: anywhere;
    overflow: hidden;
    vertical-align: top;
}
.status-column          {
    width: 5%;
    min-width: 5%;
    max-width: 5%;
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
}
.action-column          { width: 7%;   min-width: 7%;   max-width: 7%;   text-align: left; }
.search-term-column     { width: 10%;  min-width: 10%;  max-width: 10%;  word-break: break-word; }

/* Status colors */
#review-studies-table tr.status-N td { background-color: #ffffff; }
#review-studies-table tr.status-A td { background-color: #96b39f; }
#review-studies-table tr.status-D td { background-color: #f2f2f2; }

/* Date column — date at top; API source + Journal button bottom-justified */
#review-studies-table td.date-column {
    position: relative;
    min-height: 0;
    padding: 8px 6px;
    box-sizing: border-box;
    text-align: center;
    vertical-align: top;
    /* Extra bottom padding so absolute footer doesn't overlap the date on short rows */
    padding-bottom: 52px;
}

.date-top {
    position: relative;
    z-index: 1;
    font-size: 0.95em;
}

/* Pin API source + Journal button to the bottom of the cell (row height = title) */
#review-studies-table .date-sj-box {
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 6px;
    font-size: 8.5pt;
    text-align: center;
    line-height: 1.3;
}
#review-studies-table .date-api-source {
    display: block;
    font-weight: 600;
    word-break: break-word;
    margin-bottom: 4px;
}
#review-studies-table .rs-journal-btn {
    display: inline-block;
    padding: 2px 8px;
    font-size: 8.5pt;
    line-height: 1.3;
    color: #fff;
    background: #4f654d;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}
#review-studies-table .rs-journal-btn:hover {
    background: #3d503c;
}

/* ====================== ACTIONS ====================== */
.action-column {
    width: 108px;
    min-width: 108px;
    max-width: 120px;
    text-align: left;
    padding: 8px 6px 36px 10px; /* bottom padding = room for Ask Grok */
    vertical-align: top;
    position: relative;
}
#review-studies-table td.action-column {
    position: relative;
    vertical-align: top;
}

.header-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.clear-all-x {
    position: absolute;
    top: 8px;
    right: 6px;
    font-size: 14px;
    padding: 1px 6px;
    line-height: 1;
}

.action-column label.action-checkbox {
    display: block;
    margin: 3px 0;
    font-size: 9.5pt;
    white-space: nowrap;
}

.action-label {
    display: block;
    font-size: 10pt;
    color: #ffffff;
    font-weight: bold;
    margin-bottom: 2px;
    text-align: left;
    line-height: 1.1;
}

/* ====================== FLAGS (search filter — must not spill into Status) ====================== */
.search-table td.rs-flags-col {
    overflow: hidden;
    max-width: 220px;
    vertical-align: top !important;
}

#flag_checkboxes {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    max-height: 220px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 6px 8px;
    border: 2px solid #222b22;
    border-radius: 6px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#flag_checkboxes label.flag-label {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    cursor: pointer;
    font-size: 9pt;
    line-height: 1.25;
    margin: 0;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

#flag_checkboxes label.flag-label span {
    min-width: 0;
    flex: 1 1 auto;
    word-break: break-word;
}

#flag_checkboxes input.flag_cb {
    margin: 2px 0 0 0;
    flex: 0 0 auto;
}

#flag_checkboxes label.flag-label:hover {
    background: #f0f0f0;
    border-radius: 4px;
}

/* ====================== SEARCH FILTERS - v12 (Final alignment) ====================== */

/* Main Search button - move it down to line up with other items */
.search-button-col button {
    margin-top: 20px;
    font-weight: bold;
    margin-left: -8px;
}

/* Additional Title Search - narrower */
.title-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.title-search-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 360px;           /* narrower than before */
}

.title-search-container input[type="text"] {
    min-width: 260px;
    flex: 1;
    padding: 5px 9px;
    font-size: 10pt;
    border: 2px solid #263F3B;
    border-radius: 6px;
    box-sizing: border-box;
    height: 36px;
}

/* Search Title button - match main Search button style */
.search-btn-title {
    height: 36px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 600;
    background: #222b22;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}

.search-btn-title:hover {
    background: #1a211a;
}
/* ====================== SEARCH FILTERS - v11 (Back to sensible) ====================== */

/* Headings */
.filter-heading {
    font-family: Tahoma, Arial, sans-serif;
    font-size: 10pt;
    font-weight: bold;
    color: #222b22;
    margin-bottom: 4px;
}

/* All dropdowns - consistent with new_studies */
#project_switcher,
#search_term_select,
#source_filter,
#status_filter,
.rs-select {
    border: 2px solid #263F3B;
    border-radius: 6px;
    background: #fff;
    box-sizing: border-box;
    font-size: 14px;
    height: 36px;
    padding: 5px 9px;
    min-width: 100%;
}

/* Years */
.rs-year-select {
    border: 2px solid #263F3B;
    border-radius: 6px;
    background: #fff;
    box-sizing: border-box;
    font-size: 11.5px;
    min-width: 70px;
    max-width: 76px;
    max-height: 165px;        /* increased height so 10 years fit */
    line-height: 1.1;
    padding: 2px 4px;
}


/* Studies missing Grok data cannot be approved */
tr.grok-incomplete td.simple-summary-column,
tr.grok-incomplete td.grok-summary-column,
tr.grok-incomplete td.keywords-column,
tr.grok-incomplete td.flags-column {
    background: #fff8e6;
}

/* Results table: keep multi-flag text inside the Flags cell */
#review-studies-table td.flags-column .flags-cell-inner {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    line-height: 1.25;
    font-size: 0.92em;
}

.grok-pending-note {
    font-size: 0.78em;
    color: #b45309;
    margin: 2px 0 6px 0;
    font-weight: 600;
}

/* === KEY FIX: Align everything to the TOP === */
.search-table td {
    vertical-align: top !important;
    padding: 4px 8px;
}

/* Column widths - even tighter so Search button stays on screen */
.search-table td.project-col       { width: 22%; min-width: 220px; }
.search-table td.rs-api-source-col { width: 10%; min-width: 110px; }   /* narrower */
.search-table td.rs-author-col     { width: 14%; min-width: 138px; }   /* tightened more */
.search-table td.rs-years-col      { width: 9%;  min-width: 78px;  }
.search-table td.rs-flags-col      { width: 18%; min-width: 160px; max-width: 220px; overflow: hidden; }
.search-table td.rs-status-col     { width: 8%;  min-width: 90px;  overflow: hidden; }   /* keep Status clear of flags */
.search-table td.search-button-col { width: 18%; min-width: 118px; }

/* Status dropdown should stay inside its column */
.search-table td.rs-status-col .rs-select,
.search-table td.rs-status-col #status_filter {
    max-width: 100%;
    box-sizing: border-box;
}

/* Additional Title Search - NOT gigantic anymore */
.title-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.title-search-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 380px;
}

.title-search-container input[type="text"] {
    min-width: 280px;
    flex: 1;
    padding: 5px 9px;
    font-size: 10pt;
    border: 2px solid #263F3B;
    border-radius: 6px;
    box-sizing: border-box;
    height: 36px;           /* same height as other fields */
}

/* Search button */
.search-button-col button {
    height: 36px;
    min-width: 105px;
    padding: 0 20px;
    font-size: 14px;
    background: #222b22;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* Author + Journal stacked - EXACT same width */
.search-table td.rs-author-col {
    width: 14%;
    min-width: 138px;
}

.rs-author-col input.additional-input {
    width: 100%;
    max-width: 138px;
    box-sizing: border-box;
}

/* ====================== MODALS ====================== */
.modal {
    position: fixed;
    z-index: 10000;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border: 2px solid #222b22;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
    padding: 20px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    z-index: 9999;
}

.modal, .modal-overlay { display: none; }

.hidden { display: none; }


#author_search,
#journal_input {
    border: 2px solid #263F3B;
    border-radius: 6px;
    padding: 5px 9px;
    height: 36px;
    box-sizing: border-box;
}

/* 1. Fix Search button falling off the right */
.search-button-col {
    min-width: 95px;
    padding-right: 4px;
}

/* 2. Make Author textbox skinnier */
#author_search {
    min-width: 130px;
    max-width: 150px;
}

/* 3. Show all 10 years (make box taller) */
.rs-year-select {
    max-height: 185px;       /* increased again */
    line-height: 1.0;
    padding: 1px 3px;
    font-size: 11.5px;
}

.bottom-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 30px;           /* left + right padding */
    background-color: #f0f4f8;
    margin: 2px 0 15px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.goto-input {
    width: 40px;
    height: 20px;                 /* shorter than the Submit button */
    text-align: center;
    padding: 3px 4px;
    font-size: 10pt;
    border: 2px solid #222b22;
    border-radius: 5px;
}

.batch-submit-btn {
    margin: 5px 50px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    background-color: #1f2a44;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}

.batch-submit-btn:hover {
    background-color: #162033;
}

