/* Override Bootstrap's primary color variables */
:root {
  --bs-primary: #0087FA !important;
  --bs-primary-rgb: 0, 135, 250 !important;
  --bs-info: #0087FA !important;
  --bs-info-rgb: 0, 135, 250 !important;
  --bs-link-color: #0087FA !important;
  --bs-link-color-rgb: 0, 135, 250 !important;
  --bs-link-hover-color: #0070d9 !important;
  --bs-link-hover-color-rgb: 0, 112, 217 !important;
  --bs-blue: #0087FA !important;
  --bs-cyan: #0087FA !important;
  --bs-focus-ring-color: rgba(0, 135, 250, 0.25) !important;
  --bs-primary-bg-subtle: rgba(0, 135, 250, 0.1) !important;
  --bs-primary-border-subtle: rgba(0, 135, 250, 0.5) !important;
  --bs-info-bg-subtle: rgba(0, 135, 250, 0.1) !important;
  --bs-info-border-subtle: rgba(0, 135, 250, 0.5) !important;
}

/* Force all primary and info buttons to use #0087FA */
.btn-primary,
.btn-info {
  background-color: #0087FA !important;
  border-color: #0087FA !important;
}

.btn-primary:hover,
.btn-info:hover,
.btn-primary:focus,
.btn-info:focus,
.btn-primary:active,
.btn-info:active,
.btn-primary.active,
.btn-info.active {
  background-color: #0070d9 !important;
  border-color: #0070d9 !important;
}

.btn-outline-primary,
.btn-outline-info {
  color: #0087FA !important;
  border-color: #0087FA !important;
}

.btn-outline-primary:hover,
.btn-outline-info:hover,
.btn-outline-primary:focus,
.btn-outline-info:focus,
.btn-outline-primary:active,
.btn-outline-info:active {
  background-color: #0087FA !important;
  border-color: #0087FA !important;
  color: white !important;
}

/* Force text colors and other info elements */
.text-info {
  color: #0087FA !important;
}

.text-primary {
  color: #0087FA !important;
}

.bg-info {
  background-color: #0087FA !important;
}

.bg-primary {
  background-color: #0087FA !important;
}

.border-info {
  border-color: #0087FA !important;
}

.border-primary {
  border-color: #0087FA !important;
}

/* Input group text with info styling */
.input-group-text.bg-info {
  background-color: #0087FA !important;
  border-color: #0087FA !important;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* Dark theme focus styles with cyan accent */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #0087FA;
}

html {
  position: relative;
  height: 100%;
  overflow-x: hidden;
  background-color: #212529 !important;
}

body {
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  background-color: #212529 !important;
  color: #f8f9fa !important;
}

.vertical-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 140px);
  padding: 1rem 0;
}

/* Standard Bootstrap footer styling */
.footer {
  position: relative;
  bottom: 0;
  width: 100%;
}

/* Ensure editing section doesn't have overflow issues */
#editing-section {
  overflow-y: visible;
}

/* Editing section styling */
#editing-section {
  padding-bottom: 1rem;
  min-height: calc(100vh - 140px);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Dark theme enhancements */
.cursor-pointer {
  cursor: pointer;
}

.card {
  background-color: #495057 !important;
  border-color: #495057 !important;
}

.list-group-item {
  background-color: #495057;
  border-color: #6c757d;
  color: #f8f9fa;
}

.list-group-item:hover {
  background-color: #6c757d;
}

.spinner-border {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive improvements for all screen sizes */
@media (max-width: 576px) {
  /* Extra small devices (phones) */
  h3 {
    font-size: 1.25rem;
  }
  
  h6 {
    font-size: 0.9rem;
  }
  
  .card-body {
    padding: 0.75rem;
  }
  
  .input-group .form-control {
    font-size: 0.85rem;
  }
  
  .btn-sm {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
  }
  
  .vertical-center .container {
    padding: 1rem;
  }
  
  #editing-section .col-lg-8,
  #editing-section .col-lg-4 {
    margin-bottom: 1rem;
  }
  
  /* Ensure mobile padding */
  .container-xl {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (min-width: 577px) and (max-width: 768px) {
  /* Small devices (landscape phones, tablets) */
  h3 {
    font-size: 1.4rem;
  }
  
  h6 {
    font-size: 1rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .input-group .form-control {
    font-size: 0.9rem;
  }
}

@media (min-width: 769px) and (max-width: 992px) {
  /* Medium devices (tablets) */
  .col-lg-6 {
    flex: 0 0 auto;
    width: 75%;
  }
  
  .offset-lg-3 {
    margin-left: 12.5%;
  }
}

/* Container width controls for optimal display */
.container-xl {
  max-width: 1200px;
}

@media (min-width: 1400px) {
  /* Extra large screens - prevent content from stretching too wide */
  .container-xl {
    max-width: 1320px;
  }
}

/* Fixed dimension image containers */
.image-container {
  width: 100%;
  height: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #212529;
  border-radius: 0.375rem;
  overflow: hidden;
}

.image-fixed-size {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.image-placeholder {
  width: 100%;
  height: 100%;
}

/* Responsive adjustments for fixed containers */
@media (max-width: 768px) {
  .image-container {
    height: 250px;
  }
}

@media (max-width: 576px) {
  .image-container {
    height: 200px;
  }
}

/* Stack layout vertically on small screens */
@media (max-width: 992px) {
  #editing-section .col-lg-8,
  #editing-section .col-lg-4 {
    width: 100%;
    max-width: 100%;
    flex: none;
  }
  
  #editing-section .col-lg-4 {
    margin-top: 1rem;
  }
}

/* Override any remaining light backgrounds */
.bg-light {
  background-color: #495057 !important;
}

.bg-white {
  background-color: #343a40 !important;
}

/* Ensure all text remains readable */
.text-dark {
  color: #f8f9fa !important;
}

/* Alert styling for dark theme */
.alert {
  border: none;
}

.alert-info {
  background-color: #0087FA !important;
}

.alert-danger {
  background-color: #721c24;
  color: #f8d7da;
}

/* Force textarea and form controls to stay dark */
#editPrompt,
textarea.form-control,
.form-control {
  background-color: #212529 !important;
  color: #f8f9fa !important;
  border-color: #0087FA !important;
}

/* Override any focus, active, or browser autofill states */
#editPrompt:focus,
#editPrompt:active,
#editPrompt:-webkit-autofill,
textarea.form-control:focus,
textarea.form-control:active,
textarea.form-control:-webkit-autofill,
.form-control:focus,
.form-control:active,
.form-control:-webkit-autofill {
  background-color: #212529 !important;
  color: #f8f9fa !important;
  border-color: #0087FA !important;
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #0087FA !important;
}

/* Override Chrome autofill styling */
#editPrompt:-webkit-autofill,
#editPrompt:-webkit-autofill:hover,
#editPrompt:-webkit-autofill:focus,
textarea.form-control:-webkit-autofill,
textarea.form-control:-webkit-autofill:hover,
textarea.form-control:-webkit-autofill:focus,
.form-control:-webkit-autofill,
.form-control:-webkit-autofill:hover,
.form-control:-webkit-autofill:focus {
  -webkit-text-fill-color: #f8f9fa !important;
  -webkit-box-shadow: 0 0 0px 1000px #212529 inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* Disabled state styling */
#editPrompt:disabled,
textarea.form-control:disabled,
.form-control:disabled {
  background-color: #212529 !important;
  color: #6c757d !important;
  border-color: #495057 !important;
  opacity: 0.65 !important;
}

/* Refresh button styling for better visibility on blue background */
.card-header.bg-primary .btn-outline-light {
  background-color: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.8) !important;
  color: white !important;
}

.card-header.bg-primary .btn-outline-light:hover {
  background-color: rgba(255, 255, 255, 0.2) !important;
  border-color: white !important;
  color: white !important;
}