/* Custom styles for GrantGPT */

/* Global styles */
:root {
    --primary-color: #4a86f5;
    --primary-dark: #3a76e5;
    --primary-light: #89b4fd;
    --primary-very-light: rgba(74, 134, 245, 0.1);
    --bg-dark: #ffffff;
    --bg-card: #ffffff;
    --bg-light-card: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-dark);
    color: var(--text-primary);
}

main {
    flex: 1;
}

/* Typography enhancements */
h1, h2, h3 {
    font-weight: 600;
}

h4, h5, h6 {
    font-weight: 500;
}

.text-gradient {
    background: linear-gradient(120deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Flow design elements */
.flow-section {
    position: relative;
    padding: 4rem 0;
}

.flow-section::after {
    display: none; /* Remove the blue circle */
}

.flow-section::before {
    display: none; /* Remove the blue vertical line */
}

.flow-section:last-child::after,
.flow-section:last-child::before {
    display: none;
}

.flow-card {
    background-color: #ffffff; /* Solid white background */
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 5; /* Higher z-index to ensure it's above journey connector */
    opacity: 0;
    transform: translateY(20px);
}

.journey-step.visible .flow-card {
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: 0.4s; /* Appear after the question */
}

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

.flow-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(94, 151, 249, 0.15);
    border-color: var(--primary-light);
}

.stage-question {
    display: inline-block;
    background-color: #ffffff; /* Solid white background */
    padding: 0.75rem 1.25rem;
    border-radius: 2rem;
    color: var(--primary-dark);
    font-style: italic;
    margin-bottom: 1.5rem;
    position: relative;
    font-weight: 500;
    z-index: 5; /* Higher z-index to ensure it's above journey connector */
    box-shadow: 0 0 15px #ffffff; /* White glow */
    transition: all 0.3s ease;
    border: 1px solid rgba(94, 151, 249, 0.3);
}

.journey-step.visible .stage-question {
    animation: fadeInLeft 0.6s ease forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

@keyframes fadeInLeft {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.stage-question::before {
    content: """;
    font-size: 2rem;
    line-height: 0;
    vertical-align: -0.25em;
    margin-right: 0.2em;
}

.stage-question::after {
    content: """;
    font-size: 2rem;
    line-height: 0;
    vertical-align: -0.25em;
    margin-left: 0.2em;
}

/* Hero section */
.hero {
    padding: 4rem 0;
}

/* Cards & Components */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.3s ease;
}

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

.card-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

/* Fix list item contrast issues */
.list-group-item.bg-dark {
    background-color: #f8f9fa !important;
    color: var(--text-primary) !important;
}

.list-group-item.bg-dark.border-secondary {
    border-color: #dee2e6 !important;  /* Lighter border color for better visibility */
}

.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
}

/* Dashboard components */
.stat-card {
    background-color: var(--bg-card);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

/* Fix stat cards bg-dark contrast */
.stat-card.bg-dark {
    background-color: #f8f9fa !important;
    color: var(--text-primary) !important;
}

.stat-card .stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Grant cards */
.grant-card {
    border-left: 4px solid var(--primary-color);
    background-color: var(--bg-card);
}

.grant-card .match-score {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
}

.grant-card.high-match .match-score {
    background-color: rgba(25, 135, 84, 0.2);
    color: #198754;
}

.grant-card.medium-match .match-score {
    background-color: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.grant-card.low-match .match-score {
    background-color: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

/* Task progress */
.progress-sm {
    height: 0.5rem;
}

/* Timeline component */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    height: 100%;
    width: 2px;
    background-color: #dee2e6; /* Use a direct color value instead of variable to avoid blue */
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-marker {
    position: absolute;
    left: -2rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: 2px solid var(--bg-dark);
}

.timeline-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Form styling */
.form-floating > label {
    color: var(--text-secondary);
}

.form-control, .form-select {
    background-color: var(--bg-dark);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(94, 151, 249, 0.25);
}

/* Writer page styles */
.editor-container {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.editor-toolbar {
    padding: 0.5rem;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.editor-content {
    min-height: 400px;
    padding: 1rem;
    background-color: var(--bg-light-card);
}

/* AI suggestion indicator */
.ai-suggestion {
    position: relative;
    padding-left: 1.5rem;
}

.ai-suggestion::before {
    content: '✦';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: 700;
}

/* Journey pathway */
.journey-pathway {
    position: relative;
    padding-bottom: 2rem;
    overflow: hidden; /* Ensure animations don't cause horizontal scrollbars */
    background: none;
    background-image: none !important;
}

.journey-step {
    padding: 2rem 0;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    border: none !important;
    background-image: none !important;
}

.journey-step.visible {
    opacity: 1;
    transform: translateY(0);
}

.journey-step:not(:last-child)::after {
    display: none; /* Remove the vertical connecting lines */
}

.step-number {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
    box-shadow: none; /* Remove the blue glow */
    position: relative;
    z-index: 5; /* Ensure number is above connector line */
}

.step-connector {
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    position: absolute;
    bottom: -15px; /* Position it at the bottom of each step */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    box-shadow: 0 0 0 4px rgba(255,255,255,1), 0 0 0 6px rgba(94, 151, 249, 0.1); /* White glow + subtle blue outline */
}

.journey-connector {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 2px dashed #ccc; /* Light gray dashed line */
    transform: translateX(-50%);
    z-index: -10; /* Very low z-index to ensure it stays behind all elements */
}

@keyframes pulse {
    0% {
        box-shadow: none;
    }
    50% {
        box-shadow: none;
    }
    100% {
        box-shadow: none;
    }
}

/* Navigation */
.navbar-dark .navbar-brand.text-primary,
.text-primary {
    color: var(--primary-color) !important;
}

.bg-dark {
    background-color: var(--bg-dark) !important;
}

/* Override Bootstrap dark backgrounds and ensure proper text contrast */
.bg-dark, .card.border-0.bg-dark, .bg-dark.border-0 {
    background-color: #f8f9fa !important;
    color: var(--text-primary) !important;
}

/* Ensure text in dark backgrounds has proper contrast */
.bg-dark .text-white-50,
.card.bg-dark .text-white-50,
.list-group-item.bg-dark .text-white-50 {
    color: rgba(73, 80, 87, 0.75) !important; /* Using a darker grey with 75% opacity for better contrast */
}

/* Ensure navbar has proper background */
.navbar-dark {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

/* Ensure all navbar text has proper contrast */
.navbar-dark .navbar-brand, 
.navbar-dark .nav-link,
.navbar-dark .navbar-text {
    color: #fff !important;
}

/* Footer styles - ensuring text remains visible on dark background */
footer {
    background-color: var(--primary-color) !important;
}

footer .text-white-50 {
    color: rgba(255, 255, 255, 0.75) !important; /* Slightly brighter for better contrast */
}

.nav-tabs .nav-link.active {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--primary-color);
}

.nav-tabs .nav-link {
    color: var(--text-secondary);
}

.nav-tabs {
    border-bottom: 1px solid var(--border-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero {
        padding: 2rem 0;
    }
    
    .hero h1 {
        font-size: 2.25rem;
    }
    
    .journey-connector {
        display: none;
    }
    
    .journey-step:not(:last-child)::after {
        display: none;
    }
    
    .step-number {
        margin: 0 0 1rem 0;
    }
}