:root {
    --primary-color: #4a6bff;
    --primary-light: #7a8eff;
    --primary-dark: #2a4bdf;
    --accent-color: #00e5ff;
    --success-color: #00e676;
    --warning-color: #ffea00;
    --danger-color: #ff1744;
    --dark-bg: #121212;
    --darker-bg: #0a0a0a;
    --dark-card: #1e1e1e;
    --dark-card-header: #252525;
    --dark-text: #e0e0e0;
    --dark-text-secondary: #aaaaaa;
    --border-radius: 12px;
    --card-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.dark-mode {
    background-color: var(--dark-bg);
    color: var(--dark-text);
}

body.darker-mode {
    background-color: var(--darker-bg);
    color: var(--dark-text);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    flex: 1;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-right: 15px;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(74, 107, 255, 0.3);
}

.tagline {
    font-size: 1.2rem;
    color: var(--dark-text-secondary);
    font-weight: 300;
}

/* Card Styles */
.card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 25px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.dark-mode .card {
    background-color: var(--dark-card);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.3);
}

.card-header {
    padding: 20px;
    background-color: #f9f9f9;
    border-bottom: 1px solid #eee;
}

.dark-mode .card-header {
    background-color: var(--dark-card-header);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-header h2 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
}

.card-header h2 i {
    margin-right: 10px;
    color: var(--primary-color);
}

.card-body {
    position: relative;
    padding: 25px;
}

.score-card .card-body {
    position: relative;
    padding: 25px;
    min-height: 400px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
}

/* Score Card */
.score-card {
    width: 100%;
    margin-bottom: 25px;
}

/* Timeline Card */
.timeline-card {
    grid-column: span 1;
    width: 100%;
    height: 100%;
    margin-bottom: 25px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(74, 107, 255, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
}

.full-width {
    grid-column: 1 / -1 !important;
    width: 100% !important;
}

.timeline-card .card-body {
    padding: 0;
    height: 400px;
    width: 100%;
}

#timeline-chart {
    width: 100%;
    height: 100%;
    min-height: 350px;
}

.timeline-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    border-color: rgba(74, 107, 255, 0.4);
}

.js-plotly-plot .plotly .main-svg {
    overflow: visible !important;
}

/* Plotly customizations */
.js-plotly-plot .plotly .modebar {
    opacity: 0.7 !important;
}

.js-plotly-plot .plotly .modebar:hover {
    opacity: 1 !important;
}

.js-plotly-plot .plotly .modebar-btn path {
    fill: rgba(255, 255, 255, 0.7) !important;
}

.js-plotly-plot .plotly .modebar-btn:hover path {
    fill: rgba(255, 255, 255, 1) !important;
}

/* Score Display */
.score-container {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 20px;
    width: 48%;
    position: relative;
}

.truth-container {
    width: 48%;
    position: relative;
}

#credibility-score-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
}

#truth-probability-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
}

.score-item {
    display: flex;
    align-items: flex-start;
    text-align: left;
    flex: 1;
    min-width: 250px;
    background-color: rgba(40, 44, 52, 0.8);
    border-radius: var(--border-radius);
    padding: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(74, 107, 255, 0.2);
    margin-bottom: 15px;
    width: 100%;
}

.score-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    border-color: rgba(74, 107, 255, 0.4);
}

.gauge-container {
    position: relative;
    width: 150px;
    height: 150px;
    margin-right: 20px;
    flex-shrink: 0;
}

.gauge {
    width: 200px;
    height: 200px;
}

@media (min-width: 768px) {
    .gauge {
        width: 250px;
        height: 250px;
    }
}

.gauge-info {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    flex: 1;
    max-width: calc(100% - 170px);
}

.gauge-label {
    text-align: center;
    width: 100%;
}

.gauge-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #4a6bff;
    margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(74, 107, 255, 0.5);
}

.score-label {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--dark-text-secondary);
}

.gauge-description {
    font-size: 0.9rem;
    color: var(--dark-text-secondary);
    line-height: 1.5;
    opacity: 0.9;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
    margin-top: 5px;
}

.gauge-description p {
    margin-bottom: 10px;
}

.gauge-description ul {
    list-style-type: none;
    padding-left: 5px;
    margin-top: 5px;
}

.gauge-description li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 5px;
}

.gauge-description li:before {
    content: "•";
    color: #4a6bff;
    position: absolute;
    left: 0;
    top: 0;
    font-size: 1.2em;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

textarea, input {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    background-color: white;
    color: #333;
}

.dark-mode textarea, .dark-mode input {
    background-color: #2c2c2c;
    border-color: #444;
    color: var(--dark-text);
}

textarea:focus, input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 107, 255, 0.2);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: #555;
    color: white;
}

.btn-secondary:hover {
    background-color: #444;
}

.btn-info {
    background-color: #0288d1;
    color: white;
}

.btn-info:hover {
    background-color: #0277bd;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #d50000;
}

@media (max-width: 600px) {
    .button-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        width: 100%;
    }
}

/* Results Section */
.results-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

@media (min-width: 768px) {
    .results-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .timeline-card, .metrics-card, .sources-card {
        grid-column: span 2;
    }
}

/* Metrics Display */
.metrics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.metric-item {
    margin-bottom: 15px;
}

.metric-label {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 500;
}

.metric-label i {
    margin-right: 8px;
    color: var(--primary-color);
}

.metric-bar-container {
    width: 100%;
    height: 24px;
    background-color: rgba(50, 55, 70, 0.5);
    border-radius: 12px;
    overflow: hidden;
    margin: 8px 0;
    position: relative;
}

.metric-bar {
    height: 100%;
    border-radius: 12px;
    transition: width 0.5s ease-in-out;
}

.metric-value {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.7);
}

.metrics-list li {
    margin-bottom: 20px;
    list-style-type: none;
}

.metric-name {
    display: block;
    font-weight: 500;
    color: #e0e0e0;
    margin-bottom: 5px;
    font-size: 16px;
}

/* Sources Comparison */
.region-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    gap: 15px;
}

.region-label, .confidence-label {
    font-weight: 600;
    margin-right: 5px;
}

.region-value, .confidence-value {
    padding: 5px 10px;
    background-color: rgba(74, 107, 255, 0.1);
    border-radius: 4px;
    font-weight: 500;
}

.sources-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 768px) {
    .sources-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

.source-item {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    padding: 15px;
    border-left: 4px solid var(--primary-color);
    transition: transform 0.3s;
}

.source-item:hover {
    transform: translateY(-5px);
}

.source-name {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--primary-light);
}

.source-title {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.source-summary {
    font-size: 0.9rem;
    color: var(--dark-text-secondary);
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.source-confidence {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.source-confidence-label {
    font-size: 0.9rem;
}

.source-confidence-value {
    padding: 3px 8px;
    background-color: rgba(74, 107, 255, 0.2);
    border-radius: 4px;
    font-weight: 600;
}

.source-link {
    display: block;
    margin-top: 10px;
    text-align: right;
}

.source-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
}

.source-link a i {
    margin-left: 5px;
}

.source-link a:hover {
    text-decoration: underline;
}

.no-sources-message {
    margin: 20px 0;
}

.no-sources-message .alert {
    background-color: rgba(255, 145, 0, 0.2);
    border-left: 4px solid #ff9100;
    color: #e0e0e0;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
}

.no-sources-message .alert i {
    font-size: 24px;
    margin-right: 15px;
    color: #ff9100;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 60px;
    height: 60px;
    position: relative;
    margin-bottom: 20px;
}

.double-bounce1, .double-bounce2 {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--primary-color);
    opacity: 0.6;
    position: absolute;
    top: 0;
    left: 0;
    animation: sk-bounce 2.0s infinite ease-in-out;
}

.double-bounce2 {
    animation-delay: -1.0s;
    background-color: var(--accent-color);
}

@keyframes sk-bounce {
    0%, 100% { 
        transform: scale(0.0);
    } 50% { 
        transform: scale(1.0);
    }
}

.loading-overlay p {
    color: white;
    font-size: 1.2rem;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.theme-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-toggle label {
    cursor: pointer;
    width: 60px;
    height: 30px;
    background-color: #333;
    display: flex;
    border-radius: 50px;
    align-items: center;
    justify-content: space-between;
    padding: 5px;
    position: relative;
    transform: scale(1.2);
}

.theme-toggle label .fa-sun {
    color: #f1c40f;
}

.theme-toggle label .fa-moon {
    color: #f1c40f;
}

.theme-toggle .toggle-ball {
    background-color: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    height: 26px;
    width: 26px;
    transition: transform 0.2s linear;
}

.theme-toggle input:checked + label .toggle-ball {
    transform: translateX(30px);
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
    margin-left: 5px;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-weight: normal;
    font-size: 0.8rem;
    line-height: 1.4;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.8) transparent transparent transparent;
}

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

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--dark-text-secondary);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease-out forwards;
}

.card:nth-child(2) {
    animation-delay: 0.1s;
}

.card:nth-child(3) {
    animation-delay: 0.2s;
}

.card:nth-child(4) {
    animation-delay: 0.3s;
}

.card:nth-child(5) {
    animation-delay: 0.4s;
}

@media (max-width: 1200px) {
    .score-container, .truth-container {
        width: 100%;
    }
    
    .truth-container {
        margin-top: 20px;
    }
    
    .score-card .card-body {
        min-height: auto;
        flex-direction: column;
    }
}

/* Credibility Analysis Layout */
.credibility-analysis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

.metric-box {
    background: rgba(30, 35, 45, 0.8);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.metric-label {
    font-size: 1.2rem;
    color: #a0a0a0;
    margin-bottom: 10px;
}

.metric-value {
    font-size: 1.5rem;
    color: #fff;
    font-weight: bold;
}

/* Specific metric adjustments if needed */
#truth-gauge-wrapper, #credibility-gauge-wrapper {
    width: 100%;
    max-width: 250px;
    height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px;
    background: rgba(30, 35, 45, 0.8);
    border-radius: 10px;
    margin: 10px auto;
}

.gauge {
    width: 100%;
    height: 200px;
}

.gauge-info {
    text-align: center;
    width: 100%;
}

.gauge-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #4285f4;
    margin: 10px 0;
}

.gauge-label {
    font-size: 1.1rem;
    color: #a0a0a0;
    margin-top: 5px;
}

/* Metrics Styles */
.metrics-group {
    background-color: rgba(40, 44, 52, 0.8);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(74, 107, 255, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
}

.metrics-group:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    border-color: rgba(74, 107, 255, 0.4);
}

.metrics-group h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #4a6bff;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.metrics-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.metrics-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 15px;
}

.metrics-list li:before {
    content: "•";
    color: #4a6bff;
    position: absolute;
    left: 0;
    top: 0;
    font-size: 1.2em;
}

.metric-name {
    display: block;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--dark-text-primary);
    margin-bottom: 5px;
}

.metric-description {
    font-size: 0.9rem;
    color: var(--dark-text-secondary);
    line-height: 1.5;
}

/* Source Comparison Section */
.source-comparison-section {
    background-color: rgba(40, 44, 52, 0.8);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(74, 107, 255, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.source-comparison-section h3 {
    color: #4a6bff;
    margin-bottom: 15px;
    font-size: 1.3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.source-comparison-content {
    flex: 1;
    overflow-y: auto;
}

.comparison-placeholder {
    color: var(--dark-text-secondary);
    font-style: italic;
}

.source-list {
    list-style-type: none;
    padding: 0;
    margin: 15px 0 0 0;
}

.source-list li {
    margin-bottom: 10px;
    padding: 10px;
    background-color: rgba(30, 34, 42, 0.6);
    border-radius: 5px;
    border-left: 3px solid #4a6bff;
}

/* Update grid layout */
.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 20px;
}

#credibility-gauge-wrapper {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
    margin-left: 50px;
}

#truth-gauge-wrapper {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    margin-left: 50px;
}

.credibility-metrics {
    grid-column: 1;
    grid-row: 2;
}

.truth-metrics {
    grid-column: 2;
    grid-row: 2;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .analysis-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
    }
    
    #credibility-gauge-wrapper,
    #truth-gauge-wrapper,
    .credibility-metrics,
    .truth-metrics {
        grid-column: 1;
        margin-left: 0;
    }
    
    #credibility-gauge-wrapper {
        grid-row: 1;
    }
    
    .credibility-metrics {
        grid-row: 2;
    }
    
    #truth-gauge-wrapper {
        grid-row: 3;
    }
    
    .truth-metrics {
        grid-row: 4;
    }
}

#truth-gauge-wrapper, #credibility-gauge-wrapper {
    width: 100%;
    max-width: 300px;
    height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 20px;
    background: rgba(30, 35, 45, 0.8);
    border-radius: 10px;
    margin: 10px;
}

.gauge {
    width: 90%; /* Reduce width to ensure it fits */
    height: 180px;
    margin-bottom: 15px;
}

.gauge-info {
    text-align: center;
    width: 100%;
}

.gauge-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #4285f4;
    margin: 10px 0;
}

.gauge-label {
    font-size: 1.1rem;
    color: #a0a0a0;
    margin-top: 5px;
}

.ai-insights-card {
    margin-top: 20px;
}

.ai-insights-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.insights-section {
    background-color: rgba(30, 35, 45, 0.8);
    border-radius: 10px;
    padding: 15px;
    border-left: 4px solid #4a6bff;
}

.insights-section.conclusion {
    border-left: 4px solid #00e676;
}

.insights-title {
    color: #e0e0e0;
    font-size: 1.1rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.insights-title i {
    margin-right: 8px;
    color: #4a6bff;
}

.insights-section.conclusion .insights-title i {
    color: #00e676;
}

.insights-list {
    list-style-type: none;
    padding-left: 10px;
    margin: 0;
}

.insights-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    color: #c0c0c0;
}

.insights-list li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #ff5252;
}

.model-confidence {
    font-size: 1.8rem;
    font-weight: bold;
    color: #4a6bff;
    text-align: center;
    margin: 10px 0;
}
