/* Ensure Font Awesome icons render properly with optimization */
.fa, .fas, .fab {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 0; /* Removed fixed margin, will use Bootstrap utility class mb-5 on body element */
  /* Match chat-messages background pattern for consistent appearance */
  background-color: #f8f9fa;
  background-image: 
    radial-gradient(circle at 25px 25px, rgba(91, 62, 144, 0.05) 2%, transparent 0%), 
    radial-gradient(circle at 75px 75px, rgba(91, 62, 144, 0.07) 2%, transparent 0%);
  background-size: 100px 100px;
}

/* Navigation styles */
.navbar-dark .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.95) !important;
  font-weight: 600;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.navbar-dark .navbar-nav .nav-link:hover {
  color: #ffffff !important;
}

.navbar-dark .navbar-brand {
  color: #ffffff !important;
  font-weight: 600;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

/* Loading indicator styles */
.loading-indicator {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: rgba(13, 110, 253, 0.9);
  color: white;
  text-align: center;
  padding: 10px;
  font-size: 16px;
  font-weight: bold;
  z-index: 9999;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

.loading-indicator {
  animation: pulse 1.5s infinite;
}

.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;
}

/* Responsive fix for main site layout */
@media (max-width: 768px) {
  body {
    padding-bottom: 0 !important;
  }
  .navbar {
    padding-left: 8px;
    padding-right: 8px;
  }  .navbar-brand {
    font-size: 1.1rem;
  }
}
@media (max-width: 576px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 4px 0;
  }
  .navbar-brand {
    font-size: 1rem;
    padding-left: 2px;
  }
  .container, .container-fluid {
    padding-left: 4px !important;
    padding-right: 4px !important;
  }
}

/* Lottery Chat Section - blends with site theme */
.lottery-chat-section {
  background: linear-gradient(135deg, rgba(91, 62, 144, 0.05) 0%, rgba(26, 43, 99, 0.08) 100%);
  border-radius: 16px;
  border: 2px solid rgba(91, 62, 144, 0.1);
  box-shadow: 0 4px 16px rgba(91, 62, 144, 0.08);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.lottery-chat-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #5B3E90 0%, #F7D046 50%, #1A2B63 100%);
}

.lottery-chat-section:hover {
  box-shadow: 0 6px 24px rgba(91, 62, 144, 0.12);
  border-color: rgba(91, 62, 144, 0.15);
}

/* Lottery Numbers Section - consistent with chat section theme */
.lottery-numbers-section {
  background: linear-gradient(135deg, rgba(91, 62, 144, 0.03) 0%, rgba(26, 43, 99, 0.05) 100%);
  border: 2px solid rgba(91, 62, 144, 0.08);
  box-shadow: 0 4px 16px rgba(91, 62, 144, 0.06);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.lottery-numbers-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #5B3E90 0%, #F7D046 50%, #1A2B63 100%);
}

.lottery-numbers-section:hover {
  box-shadow: 0 6px 20px rgba(91, 62, 144, 0.1);
  border-color: rgba(91, 62, 144, 0.12);
}

.lottery-numbers-section .card-title {
  color: #5B3E90;
  font-weight: 600;
}

/* Responsive lottery chat section styling */
@media (max-width: 768px) {
  .lottery-chat-section {
    margin: 0 -4px; /* Extend to edges on mobile */
    border-radius: 12px;
    border-width: 1px;
  }
  .lottery-numbers-section {
    margin: 0 -4px; /* Extend to edges on mobile */
    border-radius: 12px;
    border-width: 1px;
  }
}

@media (max-width: 576px) {
  .lottery-chat-section {
    border-radius: 8px;
    padding: 1rem;
  }
  .lottery-numbers-section {
    border-radius: 8px;
    padding: 1rem;
  }
}

/* First Visit Splash Modal Styles */
.first-visit-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 11000; /* Increased to ensure it is above floating-chat-input (z-index: 9000) */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.first-visit-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s ease;
}

.first-visit-modal.show .modal-container {
    transform: translateY(0) scale(1);
}

/* Close Button */
.modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1001;
}

.modal-close:hover,
.modal-close:focus {
    background: #f8f9fa;
    color: #495057;
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Header */
.modal-header {
    margin-bottom: 1.3rem;
    padding: 0.5rem;
}

.modal-logo {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Update modal headings to match site typography */
#first-visit-modal h1,
#first-visit-modal h2,
#first-visit-modal h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--bs-heading-color);
}

#first-visit-modal h1 {
    font-size: calc(1.375rem + 1.5vw);
}

@media (min-width: 1200px) {
    #first-visit-modal h1 {
        font-size: 2.5rem;
    }
}

#first-visit-modal h2 {
    font-size: calc(1.325rem + .9vw);
}

@media (min-width: 1200px) {
    #first-visit-modal h2 {
        font-size: 2rem;
    }
}

#first-visit-modal h3 {
    font-size: calc(1.3rem + .6vw);
}

@media (min-width: 1200px) {
    #first-visit-modal h3 {
        font-size: 1.75rem;
    }
}

/* Remove the old modal-title specific styling */
.modal-title {
    margin-bottom: 0.5rem;
}

/* Add light padding to modal content */
.modal-content {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    text-align: center;
}

/* Value Propositions */
.value-props {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.value-prop {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: #495057;
    text-align: left;
}

.value-prop i {
    font-size: 1.2rem;
    width: 20px;
    flex-shrink: 0;
}

.modal-cta-text {
    font-size: 1rem;
    color: #495057;
    margin: 1.5rem 0 0 0;
    line-height: 1.5;
}

/* Action Buttons */
.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2rem;
}

.modal-btn-primary,
.modal-btn-secondary {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    min-height: 48px;
}

.modal-btn-primary:hover,
.modal-btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.modal-btn-skip {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 0.9rem;
    padding: 0.5rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-btn-skip:hover,
.modal-btn-skip:focus {
    color: #495057;
    text-decoration: underline;
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        padding: 1.25rem;
    }
    
    .modal-logo {
        font-size: 2.5rem;
    }
    
    .value-props {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .modal-actions {
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .modal-container {
        width: 95%;
    }
    
    .modal-content {
        padding: 1rem;
    }
    
    .modal-btn-primary,
    .modal-btn-secondary {
        padding: 0.625rem 1.5rem;
        font-size: 0.95rem;
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    .first-visit-modal,
    .modal-container,
    .modal-close,
    .modal-btn-primary,
    .modal-btn-secondary {
        transition: none;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .modal-content {
        border: 2px solid #000000;
    }
    
    .modal-close:focus,
    .modal-btn-skip:focus {
        outline: 3px solid #000000;
    }
}

/* Focus Visible Enhancement */
.modal-content *:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Hide floating-chat-input when guest-disabled class is present */
#floating-chat-input.guest-disabled {
    display: none !important;
}

/* Chat title editing styles */
.session-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.title-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.title-edit-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    margin-left: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.title-edit-btn:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.1);
}

.title-edit-input {
    width: 100% !important;
    border: 1px solid #007bff !important;
    border-radius: 4px !important;
    padding: 2px 4px !important;
    font-size: inherit !important;
    font-family: inherit !important;
    background: white !important;
}

.session-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-history-item:hover .title-edit-btn {
    display: inline-block !important;
}

/* Font Awesome stability improvements - only for used styles */
.fa-solid, .fas {
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome";
  font-weight: 900;
}

/* ============================================
   Accessibility Utilities
   ============================================ */

/**
 * Screen reader only class
 * Hides content visually but keeps it accessible to screen readers
 * Use for: ARIA labels, skip links, descriptive text
 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/**
 * Screen reader only focusable
 * Shows content when focused (e.g., skip links)
 */
.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/**
 * Example text styling for better scannability
 * Used for example inputs in welcome message and instructions
 */
.example {
    color: #6c757d;
    font-style: italic;
}

/**
 * Improve focus visibility for interactive elements
 * Ensures keyboard navigation is clearly visible
 */
.copy-btn:focus,
button:focus,
a:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/**
 * Emoji wrapper for better accessibility
 * Use with role="img" and aria-label attributes
 */
[role="img"] {
    display: inline-block;
}

/* ============================================
   Location Restriction Modal
   ============================================ */
.location-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.location-modal.show {
    opacity: 1;
    visibility: visible;
}

.location-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.location-modal .modal-container {
    position: relative;
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.location-modal.show .modal-container {
    transform: scale(1);
}

.location-modal .modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 20px 60px rgba(91, 62, 144, 0.3);
    position: relative;
    text-align: center;
    border: 2px solid rgba(91, 62, 144, 0.2);
}

.location-modal .modal-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #5B3E90 0%, #36D1DC 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.location-modal .modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1A2B63;
    margin-bottom: 0.5rem;
}

.location-modal .modal-subtitle {
    font-size: 1rem;
    color: #6c757d;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.location-modal .games-available {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.location-modal .game-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #5B3E90 0%, #1A2B63 100%);
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(91, 62, 144, 0.3);
}

.location-modal .game-badge i {
    color: #36D1DC;
}

.location-modal .modal-btn-understand {
    background: linear-gradient(135deg, #5B3E90 0%, #1A2B63 100%);
    color: #ffffff;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
    width: 100%;
    max-width: 250px;
}

.location-modal .modal-btn-understand:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(91, 62, 144, 0.4);
}

.location-modal .modal-btn-understand:focus {
    outline: 2px solid #36D1DC;
    outline-offset: 2px;
}

/* Location Required Modal - Info Items */
.location-modal .location-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.location-modal .info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: #495057;
}

.location-modal .info-item i {
    font-size: 1.1rem;
    width: 20px;
    flex-shrink: 0;
}

/* Location Loading State */
.location-modal .location-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    color: #5B3E90;
    font-weight: 500;
}

.location-modal .location-loading i {
    font-size: 1.25rem;
}

/* Location Error State */
.location-modal .location-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 193, 7, 0.1);
    border-radius: 8px;
    margin-top: 1rem;
    text-align: center;
}

.location-modal .location-error i {
    font-size: 1.5rem;
    color: #ffc107;
}

.location-modal .location-error span {
    font-size: 0.9rem;
    color: #6c757d;
}

.location-modal .retry-btn {
    color: #5B3E90;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    text-decoration: none;
}

.location-modal .retry-btn:hover {
    text-decoration: underline;
}

/* Responsive for location modal */
@media (max-width: 480px) {
    .location-modal .modal-container {
        width: 95%;
    }
    
    .location-modal .modal-content {
        padding: 1.25rem;
    }
    
    .location-modal .modal-icon {
        font-size: 2.5rem;
    }
    
    .location-modal .modal-title {
        font-size: 1.25rem;
    }
    
    .location-modal .games-available {
        flex-direction: column;
        align-items: center;
    }
}