:root {
    --bg-color: #0d1117;
    --card-bg: #161b22;
    --border-color: #30363d;
    --text-main: #c9d1d9;
    --text-dim: #8b949e;
    --accent-blue: #58a6ff;
    --accent-yellow: #f1e05a;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
}

.container {
    width: 90%;
    max-width: 1200px;
    padding: 40px 0;
}

header {
    text-align: center;
    margin-bottom: 50px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
}

.search-container {
    display: flex;
    background: #0d1117;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0 0 15px rgba(88, 166, 255, 0.1);
}

input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 12px 20px;
    font-size: 16px;
    outline: none;
}

button {
    background: #238636;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    min-height: 300px;
}

.card-header {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
}
.blue { background-color: var(--accent-blue); }
.yellow { background-color: var(--accent-yellow); }

.placeholder { color: var(--text-dim); font-style: italic; }

/* Styling for the converted links */
.card-content a {
    color: var(--accent-blue);
    text-decoration: none;
    word-break: break-all; /* Prevents long URLs from breaking the card layout */
}

.card-content a:hover {
    text-decoration: underline;
    filter: brightness(1.2);
}

.loading {
    color: var(--text-dim);
    font-style: italic;
    animation: fade 1.5s infinite;
}

@keyframes fade {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}
.sources {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
    font-size: 0.9em;
}
.sources ul {
    list-style: none;
    padding-left: 0;
}
.sources li {
    word-break: break-all;
    margin-bottom: 5px;
}
.sources a {
    color: #007bff;
    text-decoration: none;
}
.sources a:hover {
    text-decoration: underline;
}
.container {
    display: flex;
    flex-direction: column;
}

.history-sidebar {
    background: #f4f4f4;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    max-height: 200px;
    overflow-y: auto;
}

#historyList {
    list-style: none;
    padding: 0;
}

#historyList li {
    padding: 8px;
    border-bottom: 1px solid #ddd;
    font-size: 0.9rem;
    color: #333;
}

#historyList li:hover {
    background: #e0e0e0;
}
.history-sidebar {
    width: 120px;
    min-width: 120px;
    background: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);

    display: flex;
    flex-direction: column;
}

.history-item {
    list-style: none;
    padding: 10px;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #eee;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.history-item:hover {
    background: #f0f7ff;
    border-color: #007bff;
}

.history-item small {
    display: block;
    color: #888;
}
/* This makes the sidebar and main grid sit next to each other */
.content-wrapper {
    display: flex;
    gap: 20px;
    padding: 20px;
    align-items: flex-start; /* Keeps sidebar from stretching weirdly */
}

.history-sidebar {
    width: 120px;
    min-width: 120px;
    background: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.history-sidebar h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: #555;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
}

/* Make the comparison grid take up the rest of the space */
.comparison-grid {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Styling the history items themselves */
#historyList {
    list-style: none;
    padding: 0;
    margin: 0;
}

#historyList li {
    padding: 12px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

#historyList li:hover {
    background: #f0f7ff;
    border-color: #007bff;
    transform: translateY(-1px);
}
header {
    position: relative;
    padding-top: 20px;
}

.header-right {
    position: absolute;
    top: 10px;
    right: 0;
}

.nav-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

.nav-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* Hide history by default and position it */
.history-sidebar.hidden {
    display: none;
}

.history-sidebar {
    position: fixed;
    top: 80px;
    right: 5%;
    width: 250px;
    z-index: 100;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: -5px 5px 20px rgba(0,0,0,0.5);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

#closeHistory {
    background: transparent;
    color: var(--text-dim);
    font-size: 20px;
    padding: 0;
    cursor: pointer;
}
.history-page-content {
    margin-top: 30px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
}

.history-header-box {
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.history-item-card {
    background: #1c2128;
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.history-item-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.history-item-info strong {
    display: block;
    font-size: 1.1rem;
    color: var(--accent-blue);
}

.history-item-info small {
    color: var(--text-dim);
}

.history-grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.history-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;

    display: flex;
    flex-direction: column;
    justify-content: space-between;

    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.history-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.query-text {
    font-weight: bold;
    color: #333;
    font-size: 1.1rem;
}

.timestamp {
    font-size: 0.8rem;
    color: #888;
}

.card-preview p {
    font-size: 0.9rem;
    color: #666;
    margin: 5px 0;
}

.view-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 4px;
    margin-top: 10px;
    cursor: pointer;
}
.toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
    font-size: 0.85rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(14px);
}