/* Header and Logo Styles */
.saga-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 3px solid #3498db;
}

/* Logo link hover effect */
.saga-header .logo-link:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

.saga-logo {
    height: 100px;
    width: 100px;
    transition: transform 0.3s ease;
}

.saga-logo:hover {
    transform: scale(1.05);
}

.logo-text .saga-title {
    font-family: 'Montserrat', sans-serif;
    color: #ffffff;
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    border: none;
    margin: 0;
    padding: 0;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.logo-text .saga-subtitle {
    color: #e9ecef;
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0.9;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .saga-logo {
        height: 60px;
        width: 60px;
    }
    
    .logo-text .saga-title {
        font-size: 1rem;
        letter-spacing: 1px;
    }
    
    .logo-text .saga-subtitle {
        font-size: 0.475rem;
    }
    
    .saga-header .btn-sm {
        padding: 0.25rem 0.4rem;
    }
}

/* Override default h1 styles for the header */
.saga-header h1 {
    border: none;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin: 0;
    padding: 0;
}

/* Header navigation button styles */
.saga-header .btn {
    background-color: rgba(255, 255, 255, 0.9) !important;
    border: 2px solid rgba(255, 255, 255, 0.8) !important;
    color: #2c3e50 !important;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.saga-header .btn:hover {
    background-color: rgba(255, 255, 255, 1) !important;
    border-color: rgba(255, 255, 255, 1) !important;
    color: #1a252f !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.saga-header .btn:focus,
.saga-header .btn:active {
    background-color: rgba(255, 255, 255, 1) !important;
    border-color: rgba(255, 255, 255, 1) !important;
    color: #1a252f !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

body {
    background-color: #f8f9fa;
}

h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* Mobile responsive h1 */
@media (max-width: 576px) {
    h1 {
        font-size: 2rem;
    }
}

/* Tab Navigation Styles */
.nav-tabs {
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 1.5rem !important;
}

.nav-tabs .nav-item {
    flex: 1;
}

.nav-tabs .nav-link {
    border: none !important;
    border-radius: 0 !important;
    background-color: transparent;
    color: #6c757d;
    font-weight: 500;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
}

.nav-tabs .nav-link:hover {
    color: #3498db;
    background-color: rgba(52, 152, 219, 0.1);
    border-color: transparent !important;
}

.nav-tabs .nav-link.active {
    color: #3498db !important;
    background-color: transparent !important;
    border-color: transparent !important;
    font-weight: 600;
}

.nav-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-radius: 2px;
}

/* Mobile responsive tabs */
@media (max-width: 576px) {
    .nav-tabs .nav-link {
        padding: 0.5rem 0.25rem;
        font-size: 0.9rem;
    }
    
    .nav-tabs .nav-link i {
        font-size: 0.9rem;
    }
}

/* Tab Content Styles */
.tab-content {
    min-height: 400px;
}

.tab-pane {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Alert Styles for Empty States */
.alert-info.text-center {
    border: 2px dashed #bee5eb;
    background-color: rgba(209, 236, 241, 0.3);
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
}

.alert-info.text-center i {
    color: #17a2b8;
    opacity: 0.7;
}

.alert-info.text-center h6 {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* Mobile responsive empty states */
@media (max-width: 576px) {
    .alert-info.text-center {
        padding: 1.5rem;
        margin: 1rem 0;
    }
    
    .alert-info.text-center i {
        font-size: 1.5rem !important;
    }
    
    .alert-info.text-center h6 {
        font-size: 1rem;
    }
}

/* Saga Card Styles */
.saga-card {
    transition: all 0.2s ease-in-out;
    border: 1px solid #dee2e6 !important;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    cursor: pointer;
    overflow: hidden;
    word-wrap: break-word;
}

.saga-card:hover {
    border-color: #3498db !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}

.saga-card .card-body {
    padding: 1.25rem;
}

.saga-card .card-title {
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.1rem;
}

.saga-card .card-text {
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Mobile responsive saga cards */
@media (max-width: 576px) {
    .saga-card .card-body {
        padding: 1rem;
    }
    
    .saga-card .card-title {
        font-size: 1rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        line-height: 1.2;
    }
    
    .saga-card .card-text {
        font-size: 0.85rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .saga-card .btn-group-sm .btn {
        padding: 0.15rem 0.3rem;
        font-size: 0.7rem;
        min-width: auto;
    }
    
    .saga-card small {
        font-size: 0.65rem;
    }
    
    /* Ensure proper flex wrapping on mobile */
    .saga-card .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    /* Make settings button more mobile-friendly */
    .saga-card .btn-outline-secondary.btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
        flex-shrink: 1;
        min-width: auto;
    }
    
    /* Hide settings button text on very small screens */
    .saga-card .btn-outline-secondary.btn-sm .d-none.d-sm-inline {
        display: none !important;
    }
    
    /* Ensure voting section doesn't overflow */
    .saga-card .btn-group {
        flex-shrink: 1;
        min-width: 0;
    }
    
    .saga-card .visit-count {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 80px;
    }
}

#gameArea {
    background-color: #ffffff;
    border-radius: 5px;
}

#newTextArea {
    background-color: #ffffff;
    border-radius: 5px;
}

.input-group {
    max-width: 600px;
    margin: auto;
}

/* Make buttons completely square and outlined */
.btn,
.modal .btn,
.modal-content .btn {
    border-radius: 0 !important;  /* Completely square */
    transition: all 0.2s ease;
}

/* Primary button - outlined blue */
.btn-primary,
.modal .btn-primary,
.modal-content .btn-primary {
    background-color: transparent !important;
    border-color: #3498db !important;
    color: #3498db !important;
}

.btn-primary:hover,
.modal .btn-primary:hover,
.modal-content .btn-primary:hover {
    background-color: #3498db !important;
    border-color: #3498db !important;
    color: #ffffff !important;
}

/* Secondary button - outlined gray */
.btn-secondary,
.modal .btn-secondary,
.modal-content .btn-secondary {
    background-color: transparent !important;
    border-color: #7f8c8d !important;
    color: #7f8c8d !important;
}

.btn-secondary:hover,
.modal .btn-secondary:hover,
.modal-content .btn-secondary:hover {
    background-color: #7f8c8d !important;
    border-color: #7f8c8d !important;
    color: #ffffff !important;
}

/* Success button - outlined green */
.btn-success,
.modal .btn-success,
.modal-content .btn-success {
    background-color: transparent !important;
    border-color: #27ae60 !important;
    color: #27ae60 !important;
}

.btn-success:hover,
.modal .btn-success:hover,
.modal-content .btn-success:hover {
    background-color: #27ae60 !important;
    border-color: #27ae60 !important;
    color: #ffffff !important;
}

.btn:hover,
.modal .btn:hover,
.modal-content .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Mobile responsive button adjustments */
@media (max-width: 576px) {
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .btn {
        font-size: 0.9rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}

.loader {
    border: 16px solid #f3f3f3; /* Light grey */
    border-top: 16px solid #3498db; /* Blue */
    border-radius: 50%;
    width: 120px;
    height: 120px;
    animation: spin 2s linear infinite;
  }
  
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }

.choices-container {
    background-color: #e9ecef;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.choices-container .btn {
    white-space: normal;
    word-wrap: break-word;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.text-center.mb-4 {
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.story-content {
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Mobile responsive story content */
@media (max-width: 576px) {
    .story-content {
        padding: 1rem !important;
    }
    
    .story-content p {
        font-size: 0.95rem;
        line-height: 1.5;
    }
}

.btn {
    transition: all 0.3s ease;
}

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

/* Style links */
a {
    color: #3498db;
    transition: color 0.3s ease;
}

a:hover {
    color: #2980b9;
    text-decoration: none;
}

/* Enhance section headers */
h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    border-bottom: 2px solid #3498db;
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
}

/* Mobile responsive h2 */
@media (max-width: 576px) {
    h2 {
        font-size: 1.4rem;
    }
}

#responseArea h2 {
    color: #8e44ad;
    border-bottom-color: #9b59b6;
}

.choices-container h2 {
    color: #235aba;
    border-bottom-color: #2525d1;
}

.add-action h2 {
    color: #27ae60;
    border-bottom-color: #2ecc71;
}

h2.the-end {
    border-bottom: none;
    margin: 1rem 0;
    padding-bottom: 0;
}

h2.the-end::after {
    display: none;
}

/* Custom scrollbar styles */
.custom-scrollbar {
    padding-right: 12px;
    padding-top: 4px; /* Prevent hover effects from being clipped at top */
    margin-right: -12px;
    overflow-y: auto;
    scrollbar-width: thin;  /* For Firefox */
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;  /* For Firefox */
}

/* Webkit (Chrome, Safari, Edge) scrollbar styling */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* Mobile responsive scrollbar adjustments */
@media (max-width: 576px) {
    .custom-scrollbar {
        padding-right: 8px;
        padding-top: 4px; /* Prevent hover effects from being clipped at top */
        margin-right: -8px;
        max-height: 400px !important; /* Reduce max height on mobile */
    }
    
    .custom-scrollbar::-webkit-scrollbar {
        width: 6px;
    }
}

.card {
    border: none;
    border-radius: 10px;
}

.card-body {
    padding: 2rem;
}

/* Mobile responsive card body */
@media (max-width: 576px) {
    .card-body {
        padding: 1.5rem;
    }
}

.form-label {
    font-weight: 500;
    color: #2c3e50;
}

.form-control {
    border-radius: 7px;
    border: 1px solid #dee2e6;
    padding: 0.75rem;
}

.form-control:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.alert {
    border-radius: 7px;
    margin-bottom: 1.5rem;
}

/*
for the registration form (password match)
this is clearly some weird svg magic
to generate the checkmark and cross
*/

.form-control.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-valid {
    border-color: #198754;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-text {
    margin-top: 0.25rem;
    font-size: 0.875em;
}

/* Special style for auth pages buttons */
.btn-auth {
    background-color: #3498db !important;
    border-color: #3498db !important;
    color: #ffffff !important;
    border-radius: 5px !important;
}

.btn-auth:hover {
    background-color: #2980b9 !important;
    border-color: #2980b9 !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px; /* Height of the footer */
}

.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 80px; /* Increased from 60px to accommodate two lines */
    line-height: 1.5;
    background-color: #f5f5f5;
}

/* Mobile responsive padding and margins */
@media (max-width: 576px) {
    .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
        overflow-x: hidden;
    }
    
    .mb-5 {
        margin-bottom: 2rem !important;
    }
    
    .gap-2 {
        gap: 0.75rem !important;
    }
    
    .stories-container {
        margin-bottom: 2rem;
        overflow-x: hidden;
    }
    
    /* Ensure cards don't overflow */
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .col-12 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    /* Prevent any horizontal scrolling */
    body {
        overflow-x: hidden;
    }
}

/* Game page specific mobile styles */
@media (max-width: 576px) {
    .choice-item {
        margin-bottom: 0.75rem !important;
    }
    
    .choice-item .card-body {
        padding: 1rem !important;
    }
    
    .choice-item h5 {
        font-size: 0.95rem;
        line-height: 1.3;
    }
    
    .choice-item .card-text {
        font-size: 0.8rem;
    }
    
    .share-section {
        position: static !important;
        text-align: center;
        margin-top: 1rem;
        padding: 0 !important;
    }
}

/* Improved mobile touch targets */
@media (max-width: 576px) {
    .btn {
        min-height: 44px; /* Apple's recommended minimum touch target */
    }
    
    .btn-sm {
        min-height: 36px;
    }
    
    .saga-card {
        min-height: 120px;
    }
}

/* Better mobile typography */
@media (max-width: 576px) {
    .lead {
        font-size: 1rem;
    }
    
    small, .small {
        font-size: 0.8rem;
    }
    
    .text-muted {
        opacity: 0.8;
    }
}

/* Premium AI Badge Styles */
.premium-badge {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%) !important;
    border: 2px solid #f39c12;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
    transition: all 0.2s ease;
    animation: premium-glow 2s ease-in-out infinite alternate;
}

.premium-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

@keyframes premium-glow {
    from {
        box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
    }
    to {
        box-shadow: 0 2px 12px rgba(255, 193, 7, 0.5);
    }
}

/* Premium Modal Enhancements */
.modal-header.bg-warning {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%) !important;
    border-bottom: 2px solid #f39c12;
}

.bg-warning.bg-opacity-25 {
    background: linear-gradient(135deg, #fff3cd 0%, #fef3d1 100%) !important;
    border: 1px solid #ffd700;
}

/* Crown icon animation */
.fas.fa-crown {
    animation: crown-shine 3s ease-in-out infinite;
}

@keyframes crown-shine {
    0%, 100% { color: #f39c12; }
    50% { color: #ffd700; }
}

/* Choice Item Hover Effects */
.choice-item {
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    border: 1px solid #dee2e6 !important;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.choice-item:hover {
    border-color: #3498db !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
    background-color: #f8f9fa;
}

.choice-item:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

/* Mobile responsive choice items */
@media (max-width: 576px) {
    .choice-item:hover {
        transform: translateY(-1px);
        box-shadow: 0 3px 8px rgba(52, 152, 219, 0.12);
    }
}