:root {
    --bg-colour: #f8f9fa;
    --text-colour: #212529;
    --border-colour: #ddd;
    --hover-bg-colour: #e9ecef;
    ---link-colour: #227bff;
    --search-button-colour: linear-gradient(135deg, #9a89eb, #f75e86, #ed8951);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-colour: #252525;
        --text-colour: #f8f9fa;
        --border-colour: #495057;
        --hover-bg-colour: #343a40;
        --link-colour: #227bff;
        --search-button-colour: linear-gradient(135deg, #9a89eb, #f75e86, #ed8951);
    }

    #query::placeholder {
        color: #a8a8a8;
    }

    .footer {
        background-color: #1a1a1a !important;
        border-top: 1px solid #404040;
    }

    .footer h6 {
        color: #e0e0e0;
    }

    .footer .text-muted {
        color: #a8a8a8 !important;
    }

    .footer a.text-muted {
        color: #a8a8a8 !important;
        text-decoration: none;
    }

    .footer a.text-muted:hover {
        color: #ffffff !important;
        text-decoration: underline;
    }

    .footer .social-links a {
        color: #a8a8a8 !important;
    }

    .footer .social-links a:hover {
        color: #ffffff !important;
    }
}

body {
    background-color: var(--bg-colour);
    color: var(--text-colour);
    justify-content: left;
}

.result-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    position: relative;
    padding-right: 0px;
}

.result-container {
    flex: 1;
    padding: 10px;
    background: var(--bg-colour);
    border: 1px solid var(--border-colour);
    border-radius: 8px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.result-container p.text-muted.small {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.result-container, .description {
    word-wrap: break-word;
    white-space: normal;
}

.information-container {
    padding: 20px;
    padding-bottom: 10px;
    text-align: center;
}

.app {
    padding: 0px;
    padding-bottom: 0px;
    text-align: left;
    flex: 1;
    background: var(--bg-colour);
    border: 1px solid var(--border-colour);
    border-radius: 7px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.feedback-buttons {
    position: absolute;
    right: 10px;
    display: none;
    flex-direction: column;
}

.feedback-buttons button {
    cursor: pointer;
    border: none;
    background: none;
    margin: 5px 0;
    transition: transform 0.2s;
    pointer-events: auto;
    color: var(--text-colour);
}

.result-wrapper:hover .feedback-buttons {
    display: flex;
}

.result-wrapper:hover .result-container {
    background-color: var(--hover-bg-colour);
}

.feedback-buttons button:hover {
    transform: scale(1.2);
}

a {
    pointer-events: auto;
    color: var(---link-colour);
}

.result-container a {
    text-decoration: none;
    color: var(---link-colour);
}

.favicon {
    width: 16px;
    height: 16px;
    margin-right: 5px;
}

.page-item.active .page-link {
    background-color: var(---link-colour);
    border-color: var(---link-colour);
    color: var(--bg-colour);
}

.page-link {
    background-color: var(--bg-colour);
    border-color: var(--border-colour);
    color: var(---link-colour);
}

.page-item.disabled .page-link {
    background-color: var(--bg-colour);
    border-color: var(--border-colour);
    color: var(--text-colour);
}

.form-control {
    background-color: var(--bg-colour);
    color: var(--text-colour);
    border-color: var(--border-colour);
}

.form-control:focus {
    background-color: var(--bg-colour);
    color: var(--text-colour);
}

.btn-primary {
    background-color: var(---link-colour);
    border-color: var(---link-colour);
}

.text-muted {
    color: var(--text-colour) !important;
    opacity: 0.6;
}

#searchForm {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Align form elements to the left */
    max-width: 100%;
}

#searchForm h1 {
    margin: 0;
    /* Remove default margin */
    line-height: 1;
    /* Ensure the line height matches the input */
}

.pagination {
    justify-content: center;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

.search-button {
    background: #00000000;
    color: var(--text-colour);
}

.search-button:hover {
    background: var(--search-button-colour);
    border-color: var(--search-button-colour);
    color: #ffffff;
}

.ghost-result {
    opacity: 0.7; /* Slightly faded */
    animation: pulse 1.5s ease-in-out infinite; /* Add a subtle pulse effect */
}

.ghost-line {
    height: 1em; /* Adjust height as needed */
    margin-bottom: 0.5em;
    background-color: #eee; /* Light gray background */
    border-radius: 4px;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/*Hide feedback buttons in ghost results*/
.ghost-result .feedback-buttons {
  display: none;
}

#resultsInfo {
    margin-bottom: 15px;
    margin-top: -10px;
}

.search-container {
    transition: all 0.3s ease;
    margin: 15vh auto 2rem;
    max-width: 500px;
}

.search-container.searched {
    margin: 1rem auto;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 20px;
}

.search-container .logo {
    transition: all 0.3s ease;
    width: 48px;
    height: 48px;
    margin: 1rem auto;
    display: block;
}

.search-container.searched .logo {
    width: 32px;
    height: 32px;
    margin: 0 15px 0 0;
}

.search-form {
    transition: all 0.3s ease;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.search-container.searched .search-form {
    max-width: 400px;
    margin: 0;
}

#resultsInfo {
    margin-left: auto;
    padding: 0 15px;
}

.form-control {
    max-width: 100%;
    width: 100%;
}

#rightPanel {
    margin-top: 30px;
}

@media (max-width: 767px) {
    /* 767px is Bootstrap's md breakpoint */
    .row {
        display: flex;
        flex-direction: column;
    }
    
    /* Move right panel to top */
    .col-md-6:last-child {
        order: -1;
    }
    
    /* Reduce margin between panels */
    #rightPanel {
        margin-top: 10px;
        margin-bottom: 10px;
    }
    
    /* Adjust padding for better mobile spacing */
    .col-md-6 {
        padding: 10px !important;
    }
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    flex: 1 0 auto;
}

.footer {
    flex-shrink: 0;
    background-color: var(--bg-colour);
    border-top: 1px solid var(--border-colour);
    padding: 1rem 0;
    margin-top: auto;
}

/* Ensure proper spacing when content is short */
.search-container:not(.searched) {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.settings-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
  }
  
  #settingsBtn {
    padding: 8px 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
  }
  
  #settingsBtn:hover {
    background-color: #e9ecef;
  }

[data-bs-theme="dark"] {
    background-color: #212529;
    color: #fff;
}

.card {
    margin-bottom: 20px;
    background-color: var(--bg-colour);
    color: var(--text-colour);
    border-color: var(--border-colour);
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered reveal for features */
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

#icon {
  transition: transform 0.4s ease;
}

#logoLink:hover #icon {
  transform: rotate(15deg) scale(1.05);
}

.btn-outline-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 1;
  }
  
  .btn-outline-primary:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(var(--bs-primary-rgb), 0.1);
    transition: all 0.3s ease;
    z-index: -1;
  }
  
  .btn-outline-primary:hover:before {
    left: 0;
  }

@keyframes magnifySearch {
    0% {
      transform: translateX(0) translateY(0) rotate(0);
    }
    25% {
      transform: translateX(-3px) translateY(-3px) rotate(-5deg);
    }
    50% {
      transform: translateX(3px) translateY(3px) rotate(0);
    }
    75% {
      transform: translateX(3px) translateY(-3px) rotate(5deg);
    }
    100% {
      transform: translateX(0) translateY(0) rotate(0);
    }
  }
  
  #icon.searching {
    animation: magnifySearch 1.2s ease-in-out infinite;
  }

#liveStats {
  margin-top: 15px;
  font-size: 1.1rem;
}

#liveStats li {
  margin-bottom: 10px;
}

.stats-container {
  display: flex;
  justify-content: space-around;
  margin-top: 20px;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 3rem;
  font-weight: bold;
  color: var(--text-colour);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.stat-number.animate {
  transform: scale(1.2);
  opacity: 0.8;
}

.stat-caption {
  font-size: 1rem;
  color: var(--text-colour);
  opacity: 0.7;
}