/* style.css */
body, html {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

#app {
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    box-sizing: border-box;
    padding: 15px 0;
    background: #f8f9fa;
}

.header-inner-container {
    width: 90%;
    max-width: 1600px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

header h1 {
    color: #333;
    margin: 0;
    font-size: 24px;
    display: flex;
    align-items: center;
}

header h1 img {
    margin-right: 20px;
    width: 48px;
    height: 48px;
    vertical-align: middle;
}

header h1 span.tag {
    /* beta tag in title */
    position: relative;
    color: transparent;
    /* red gradient top to bottom light red to dark red */
    background: repeating-linear-gradient(
        45deg,
        #f3d54e,
        #f3d54e 15px,
        #555555 15px,
        #555555 30px
    );
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: 0 1px 0px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(50, 50, 50, 0.6);
    margin-left: 20px;
}

header h1 span.tag::before {
    content: "beta";
    color: rgb(245, 245, 245);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.2),
        rgba(0, 0, 0, 0.4)
    );
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 0px rgba(0, 0, 0, 0.15), 0 -1px 0px rgba(0, 0, 0, 0.9);
}

/* --- Recent Videos Bar --- */
.recent-videos {
    width: 90%;
    max-width: 1600px;
    box-sizing: border-box;
    margin-top: -10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.recent-videos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #f3f5f7;
    border-bottom: 1px solid #e6e6e6;
}

.recent-videos-title {
    font-weight: bold;
    color: #333;
}

.recent-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.recent-videos-scroller {
    position: relative;
}

.scroll-btn,
.toggle-btn {
    background: #e9ecef;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
}

.scroll-btn:hover,
.toggle-btn:hover {
    background: #e3e7eb;
}

.scroll-left,
.scroll-right {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.scroll-left { left: 6px; }
.scroll-right { right: 6px; }

.toggle-btn[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
    transition: transform 0.2s ease;
}

.recent-videos-list {
    display: flex;
    flex-direction: row;
    gap: 10px;
    padding: 10px 44px; /* add space for overlay arrows */
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
    scroll-behavior: smooth;
}

.recent-video-item {
    flex: 0 0 auto;
    width: 220px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    cursor: pointer;
    overflow: hidden;
}

.recent-video-thumb {
    width: 100%;
    height: 124px;
    object-fit: cover;
    background: #f2f2f2;
    display: block;
}

.recent-video-title {
    padding: 8px 10px;
    font-size: 14px;
    line-height: 1.3;
    color: #222;
    max-height: 2.6em; /* ~2 lines */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Collapsed state */
.recent-videos.collapsed .recent-videos-list {
    display: none;
}

.recent-videos.collapsed .scroll-left,
.recent-videos.collapsed .scroll-right {
	display: none;
}

main {
    width: 90%;
    max-width: 1600px;
    display: flex;
    flex-direction: row; /* Changed to row for side-by-side layout */
    justify-content: space-between; /* Added to space items evenly */
}

#leftPanel {
    max-width: 800px;
    width: 48%; /* Adjusted width for side-by-side layout */
}

#rightPanel {
    max-width: 800px;
    width: 48%; /* Adjusted width for side-by-side layout */
}

@media (max-width: 600px) {
    header {
        flex-direction: column;
        padding: 10px;
    }

    header h1 {
        font-size: 20px;
    }

    header h1 img {
        width: 32px;
        height: 32px;
    }

    .header-inner-container {
        width: 100%;
    }
    
    main {
        flex-direction: column;
    }

    #leftPanel, #rightPanel {
        width: 100%;
    }

    #rightPanel {
        margin-top: 0px;
    }
}

#videoInput {
    margin-bottom: 20px;
}

#videoInput label {
    margin-right: 10px;
}

#youtubeURL {
    width: calc(100% - 150px);
    padding: 10px;
    margin-right: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#submitURL {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#submitURL:hover {
    background-color: #0056b3;
}

#videoDisplay {
    position: relative;
    max-width: 800px;
    padding-top: 56.25%!important; /* 16:9 aspect ratio */
}

#videoDisplay::after {
    content: '\25BA';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 128px;
    color: #ececec;
    text-shadow: 0px 1px 1px rgba(255, 255, 255, 1), 0px -1px 1px rgba(0, 0, 0, 0.1);
}

#videoDisplay iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 4px;
    z-index: 1;
}

#factCheckResults {
    position: relative;
    max-height: calc(100vh - 395px);
    overflow-x: scroll; 
    height: 100vh;
}

.share-toolbar {
	position: sticky;
	top: 0;
	z-index: 3;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 10px;
	margin: -20px -20px 10px -20px; /* extend to panel edges */
	background: rgba(248, 249, 250, 0.95);
	backdrop-filter: saturate(120%) blur(4px);
	border-bottom: 1px solid #e5e7eb;
    margin-bottom: 40px;
}

.share-toolbar.hidden {
	display: none;
}

.share-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: #ffffff;
	border: 1px solid #d0d7de;
	border-radius: 6px;
	padding: 6px 10px;
	cursor: pointer;
	color: #333;
	text-decoration: none;
	line-height: 1;
}

.share-btn:hover {
	background: #f3f4f6;
}

.toolbar-divider {
	display: inline-block;
	width: 1px;
	height: 22px;
	background: #e5e7eb;
	margin: 0 4px;
}

#factCheckResults.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Make captions loading match fact-check loading */
#captionsDisplay.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#videoDisplay, #captionsDisplay, #factCheckResults {
    margin-top: 20px;
    padding: 0 20px 20px 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
}

#captionsDisplay {
    white-space: pre-wrap;
    max-height: calc(45vh - 200px);
    height: 100vh;
    overflow-y: auto;
}

/* NEW: transcript line styles */
#captionsDisplay .caption-line {
    opacity: 0.7;
    transition: opacity 0.2s ease;
    line-height: 1.5;
    padding: 2px 0;
}
#captionsDisplay .caption-line.active {
    opacity: 1;
    background: rgba(0,0,0,0.03);
}

#factCheckResults .throbber, #factCheckResults .factCheckResultsText {
    margin-bottom: 20px;
}

/* Mirror spacing for captions loading text */
#captionsDisplay .throbber,
#captionsDisplay #captionsLoadingText {
    margin-bottom: 20px;
}

#factCheckResultsText {
    text-align: center;
    line-height: 1.5em;
}

/* Match the transcript loading text to the same box style */
#captionsLoadingText {
    margin: 10px 0;
    padding: 10px;
    background-color: #e9ecef;
    border-radius: 4px;
}

.throbber {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    /* box-shadow: 0 1px 0px rgba(0, 0, 0, 0.15), 0 -1px 0px rgba(255, 255, 255, 0.9); */
    background: linear-gradient(90deg, #f899a1, #73e08d);
    /* background-size: 200% 200%; */
    animation: rotate 1s linear infinite;
}

.throbber::before {
    content: '';
    display: block;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    /* box-shadow: 0 1px 0px rgba(0, 0, 0, 0.15), 0 -1px 0px rgba(255, 255, 255, 0.9); */
    background-color: #f9f9f9;
    position: absolute;
    top: 10px;
    left: 10px;
}

#factCheckResults p {
    margin: 10px 0;
    padding: 10px;
    background-color: #e9ecef;
    border-radius: 4px;
}

.accordion {
    position: relative;
    width: 100%;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    margin-bottom: 20px;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
    /* animation: slideInFromLeft 0.5s ease-out; */
}

.card:last-of-type .accordion {
    margin-bottom: 0;
}

@keyframes slideInFromLeft {
    0% {
        opacity: 0;
        transform: translateX(-100%);
    }
    50% {
        opacity: 0.2;
        transform: translateX(-50%);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.card {
    width: 100%;
}

.accordion-header {
    background-color: #8d8d8d;
    color: #fff;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    padding: 10px;
    font-weight: bold;
    align-items: center;
}

.sideA .accordion-header {
    background-color: #007bff!important;
}

.sideB .accordion-header {
    background-color: #c00000!important;
}

.accordion-header .time, .accordion-header .speaker {
    flex: 1;
}

.accordion-header .fact-check-status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-left: 10px;
    position: relative;
}

.fact-check-status.unset {
    position: relative;
    /* rotating ring of gradient */
    background: linear-gradient(90deg, #f899a1, #73e08d);
    /* background-size: 200% 200%; */
    animation: rotate 1s linear infinite;
}

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

.fact-check-status.unset::after {
    content: '';
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #8d8d8d;
    position: absolute;
    top: 4px;
    left: 4px;
}

.sideA .fact-check-status.unset::after {
    background-color: #007bff;
}

.sideB .fact-check-status.unset::after {
    background-color: #c00000;
}

.fact-check-status.false::after {
    font-family: FontAwesome;
    content: "\f00d";    
    left: 5px;
    top: 2px;
    position: absolute;
    color: black;
    font-size: 14px;
    font-weight: 100;
}

.fact-check-status.true::after {
    font-family: FontAwesome;
    content: "\f00c";   
    left: 4px;
    top: 4px;
    position: absolute;
    color: black;
    font-size: 13px;
    /* transform: rotate(15deg); */
}

.fact-check-status.true {
    background: linear-gradient(90deg, #73e08d, #c0f3c0);
}

.fact-check-status.false {
    background: linear-gradient(90deg, #fa969f, #ffd3d7);
}

.fact-check-status.partially_true {
    background: linear-gradient(90deg, #f9d5a7, #f9f3c0);
}

.fact-check-status.partially_false {
    background: linear-gradient(90deg, #f9d5a7, #f9f3c0);
}

.fact-check-status.unverified {
    background: linear-gradient(90deg, #f9d5a7, #f9f3c0);
}


.accordion-preview {
    padding: 10px;
    /* light blue */
    background-color: #e9fffd;
}

.accordion-content {
    border-top: 1px solid #ddd;
    max-height: 20px;
    overflow: hidden;
    transition: max-height 0.5s ease-out;
}

.accordion.open .accordion-content {
    max-height: 999px;
}

.accordion-content .fact-check {
    border-top: 1px solid #ddd;
}

.accordion-content .fact-check.true {
    /* gradient */
    background: linear-gradient(90deg, #73e08d, #c0f3c0);
}

.accordion-content .fact-check.false {
    /* gradient */
    background: linear-gradient(90deg, #fa969f, #ffd3d7);
}

.accordion-content .fact-check.partially_true {
    /* gradient */
    background: linear-gradient(90deg, #f9d5a7, #f9f3c0);
}

.accordion-content .fact-check.partially_false {
    /* gradient */
    background: linear-gradient(90deg, #f9d5a7, #f9f3c0);
}

.accordion-content .fact-check.unverified {
    /* gradient */
    background: linear-gradient(90deg, #f9d5a7, #f9f3c0);
}

.accordion-content .fact-check.unset {
    /* marque linear gradient throbber */
    background: linear-gradient(90deg, #f899a1, #73e08d);
    background-size: 200% 100%; /* Ensures the gradient is larger than the element to allow movement */
    animation: scroll 1s linear infinite alternate;
    max-height: 0px;
    padding: 3px;
}

@keyframes scroll {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 100% 50%;
    }
}


.accordion-content .assertion, .accordion-content .fact-check {
    padding: 10px;
}

.accordion-content .fact-check .fact-check-title {
    margin-bottom: 5px;
}

.accordion-content .fact-check .fact-check-sources {
    margin-top: 10px;
    padding: 10px 10px 0px 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.accordion-content .fact-check .fact-check-sources ul {
    padding: 0;
    margin: 10px 0 0 0;
    line-height: 40px;
}
.accordion-content .fact-check .fact-check-sources ul > li {
    display: inline-block;
    padding: 0px 10px;
    margin: 0px 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: #fff;
    color: #333;
    max-width: 28%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.accordion-content .fact-check .fact-check-sources ul > li a {
    color: #333;}

.accordion-content .fact-check .fact-check-sources ul > li .favicon {
    margin-right: 4px;
    vertical-align: -2px;
}

.accordion-content strong {
    display: block;
    margin-bottom: 5px;
}

.accordion.open .accordion-content {
    display: block;
}

.accordion .accordion-show-more {
    position: relative;
    cursor: pointer;
    text-align: center;
    padding: 10px;
    border-top: 1px solid #ddd;
    background-color: rgb(236, 236, 236);
    box-shadow: 0px -1px 3px rgba(0,0,0,0.15);
    z-index: 1;
}

.accordion .show-more-shadow {
    display: block;
    position: absolute;
    width: 90%;
    height: 20px;
    background-color: rgba(0,0,0,0.2);
    filter: blur(8px);
    left: 50%;
    transform: translateX(-50%);
    bottom: 25px;
    border-radius: 50%;
    user-select: none;
    pointer-events: none;
}

.accordion .accordion-show-more:hover {
    opacity: 0.8;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 125%; /* Position below the element */
    left: 50%;
    transform: translateX(-50%);
    background-color: #adadadd3; /* Off-white gray background */
    color: #fff;
    padding: 5px;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Shadow */
    font-size: 14px; /* Normal font size */
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* .tooltip::before {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent #f0f0f0 transparent; 
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.tooltip:hover::before {
    opacity: 1;
    visibility: visible;
} */

footer {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    box-sizing: border-box;
    padding: 15px;
    background: #f8f9fa;
}

footer p {
    color: #333;
    font-size: 14px;
    display: flex;
    align-items: center;
    margin-left: 20px;
}

footer > p:first-of-type {
    margin-left: 0px;
}

.hamburger-menu {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.hamburger-menu .menu-icon {
    cursor: pointer;
    font-size: 24px;
    padding: 10px;
}

.hamburger-menu .menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
    min-width: 150px;
    z-index: 10;
}

.hamburger-menu #menu-toggle:checked + .menu-icon + .menu {
    display: block;
}

.hamburger-menu .menu li a {
    display: block;
    padding: 10px 20px;
    text-decoration: none;
    color: #333;
}

.hamburger-menu .menu li a:hover {
    background-color: #e9ecef;
}

#menu-toggle {
    display: none;
}

.content-section {
    max-width: 1600px;
    margin: 40px auto;
    padding: 30px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.content-section h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 28px;
    color: #333;
}

.content-section ol {
    list-style: none;
    padding: 0;
    counter-reset: step-counter;
}

.content-section li {
    margin-bottom: 30px;
    padding-left: 60px;
    position: relative;
}

.content-section li::before {
    content: counter(step-counter);
    counter-increment: step-counter;
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    height: 40px;
    background-color: #007bff;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.content-section h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: #0056b3;
}

.content-section p {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    color: #555;
}

.faq-item {
    margin-bottom: 20px;
}

.faq-item h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: #0056b3;
}

/* NEW: fact-check card opacity behavior */
#factCheckResults .fact-check.card .accordion { opacity: 0.7; transition: opacity 0.2s ease; }
#factCheckResults .fact-check.card .accordion.fc-active { opacity: 1; }
#factCheckResults:hover .fact-check.card .accordion { opacity: 1; }