@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

* {
    font-family: 'Poppins', sans-serif;
}

body {
    background: #f0f0f0;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-size: 0.9rem;
}

@media (min-width: 640px) {
    body {
        font-size: 1rem;
    }
}

/* Mobile Main Content Spacing */
.mobile-main-content {
    margin-top: 0;
    padding: 1rem;
}

@media (min-width: 640px) {
    .mobile-main-content {
        margin-top: 0;
        padding: 2rem;
    }
}

@media (min-width: 1024px) {
    .mobile-main-content {
        margin-top: 140px;
    }
}

/* Breadcrumb category badge */
.breadcrumb-category-badge:hover {
    background-color: rgb(196, 200, 235) !important;
}

/* Dark mode styles */
body.dark-mode {
    background: #1a1a1a;
    color: #e5e5e5;
}

.dark-mode .floating-header {
    background: rgba(26, 26, 26, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.dark-mode .header-logo-white {
    filter: brightness(0) invert(1) !important;
}

.dark-mode .bg-white {
    background-color: #2d2d2d !important;
    color: #e5e5e5;
}

.dark-mode .text-gray-800 {
    color: #e5e5e5 !important;
}

.dark-mode .text-gray-700 {
    color: #d1d1d1 !important;
}

.dark-mode .text-gray-600 {
    color: #b8b8b8 !important;
}

.dark-mode .text-gray-500 {
    color: #999 !important;
}

.dark-mode .border-gray-200,
.dark-mode .border-gray-300 {
    border-color: #404040 !important;
}

.dark-mode .bg-gray-50 {
    background-color: #2d2d2d !important;
}

.dark-mode .bg-gray-100 {
    background-color: #363636 !important;
}

.dark-mode .bg-gray-200 {
    background-color: #404040 !important;
}

.dark-mode input,
.dark-mode select,
.dark-mode textarea {
    background-color: #2d2d2d !important;
    color: #e5e5e5 !important;
    border-color: #404040 !important;
}

.dark-mode input::placeholder,
.dark-mode textarea::placeholder {
    color: #999 !important;
}

.dark-mode .shadow-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3) !important;
}

.dark-mode .shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3) !important;
}

.dark-mode .bg-purple-100 {
    background-color: #4c1d95 !important;
}

.dark-mode .text-purple-700 {
    color: #c4b5fd !important;
}

.dark-mode .category-pill {
    background: #363636;
    color: #e5e5e5;
}

.dark-mode .category-pill:hover {
    background: #404040;
}

.dark-mode .category-pill.active {
    background: #667eea;
    color: white;
}

.dark-mode .card-hover {
    background-color: #2d2d2d !important;
    color: #e5e5e5;
}

.dark-mode .card-hover:hover {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

/* Mobile-specific optimizations */
@media (max-width: 639px) {

    /* Touch-friendly tap targets */
    button,
    a,
    input,
    select {
        min-height: 44px;
        min-width: 44px;
    }

    /* Better spacing on mobile */
    .floating-header-content>* {
        margin-bottom: 0.75rem;
    }

    /* Full-width inputs on mobile */
    #searchContainer,
    #categoryDropdownContainer {
        width: 100%;
    }

    #searchInput {
        width: 100% !important;
    }

    /* Search suggestions full width on mobile */
    #searchSuggestions {
        width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        margin-left: -1rem;
        margin-right: -1rem;
    }
}

.dark-mode .bg-gray-50 {
    background-color: #2d2d2d !important;
}

.dark-mode .output-box {
    background: #2d2d2d !important;
    border-color: #404040 !important;
    color: #e5e5e5 !important;
}

.dark-mode .output-box.has-content {
    background: #1a1a1a !important;
    border-color: #667eea !important;
}

.dark-mode pre {
    color: #e5e5e5 !important;
    background-color: transparent !important;
}

/* Search Suggestions Styles */
#searchSuggestions {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}

#searchSuggestions::-webkit-scrollbar {
    width: 6px;
}

#searchSuggestions::-webkit-scrollbar-track {
    background: transparent;
}

#searchSuggestions::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background-color: #f5f3ff;
}

.suggestion-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.suggestion-category {
    font-size: 0.75rem;
    color: #6b7280;
}

.dark-mode #searchSuggestions {
    background-color: #2d2d2d;
    border-color: #404040;
}

.dark-mode .suggestion-item {
    border-bottom-color: #404040;
}

.dark-mode .suggestion-item:hover,
.dark-mode .suggestion-item.selected {
    background-color: #404040;
}

.dark-mode .suggestion-title {
    color: #e5e5e5;
}

.dark-mode .suggestion-category {
    color: #b8b8b8;
}

.suggestion-item .highlight {
    color: #667eea;
    font-weight: 700;
}

.dark-mode .suggestion-item .highlight {
    color: #818cf8;
}

/* Dark mode toggle button styles */
#darkModeToggle {
    position: relative;
}

.dark #darkModeToggle .fa-sun {
    display: none;
}

.dark #darkModeToggle .fa-moon {
    display: block;
}

#darkModeToggle .fa-moon {
    display: none;
}

.floating-header {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    padding: 0.75rem 0;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.floating-header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .floating-header {
        position: sticky;
        top: 0;
        padding: 1rem 0;
    }

    .floating-header-content {
        padding: 0 2rem;
    }
}

@media (min-width: 1024px) {
    .floating-header {
        position: fixed;
    }
}

.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.category-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.category-pill {
    background: #f5f5f5;
    padding: 0.35rem 0.65rem;
    border-radius: 18px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    text-decoration: none;
    color: #333;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

@media (min-width: 640px) {
    .category-pill {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* Override Tailwind text-xs utility */
.text-xs {
    font-size: 0.85rem !important;
    line-height: 1rem;
}

/* Override Tailwind sm:text-lg utility */
@media (min-width: 640px) {
    .sm\:text-lg {
        font-size: 0.95rem !important;
        line-height: 1.75rem !important;
    }
}

.category-pill:hover {
    background: #e5e5e5;
}

.category-pill.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.generate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: all 0.3s ease;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.output-box {
    min-height: 400px;
    background: #fafafa;
    border: 2px dashed #e5e7eb;
}

.output-box.has-content {
    border: 2px solid #667eea;
    background: white;
}

/* Prompt Page Specific Styles */
.story-length-btn {
    transition: all 0.2s ease;
}

.story-length-btn.active {
    background: #4a5568;
    color: white;
    border-color: #4a5568;
}

.story-length-btn:hover:not(.active) {
    background: #f7fafc;
    border-color: #cbd5e0;
}

#outputBox.has-content {
    border: 2px solid #667eea;
    background: white;
}

#outputBox {
    transition: all 0.3s ease;
    position: relative;
}

.copy-button {
    padding: 8px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.copy-button.hidden {
    display: none;
}

.copy-button:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.copy-button:active {
    transform: translateY(0);
}

.copy-button.copied {
    background: #10b981;
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 2rem;
}

/* Center Turnstile widget */
.cf-turnstile {
    display: flex;
    justify-content: center;
    margin: 0 auto;
}

/* Custom required field styling */
#characterDetails:invalid {
    box-shadow: none;
    /* Remove browser default invalid styling */
}

#characterDetails.border-red-400 {
    border-color: #f87171;
    background-color: #fef2f2;
    animation: shake 0.3s;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

#characterDetailsError {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slideshow Styles */
#slideshowContainer,
#similarSlideshowContainer {
    position: relative;
    display: flex;
    align-items: center;
    padding: 2rem 0;
}

.slideshow-wrapper,
.similar-slideshow-wrapper {
    display: flex;
    width: 100%;
}

.slideshow-slide,
.similar-slideshow-slide {
    padding: 0 0.5rem;
}

@media (max-width: 639px) {

    .slideshow-slide,
    .similar-slideshow-slide {
        width: 100% !important;
    }
}

@media (min-width: 640px) {

    .slideshow-slide,
    .similar-slideshow-slide {
        width: 50% !important;
    }
}

@media (min-width: 1024px) {

    .slideshow-slide,
    .similar-slideshow-slide {
        width: 33.333% !important;
    }
}

@media (min-width: 1280px) {

    .slideshow-slide,
    .similar-slideshow-slide {
        width: 25% !important;
    }
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Disable hover effects for slideshow cards */
#slideshowContainer .prompt-card,
#slideshowContainer .card-hover,
#similarSlideshowContainer .prompt-card,
#similarSlideshowContainer .card-hover {
    transform: none !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

#slideshowContainer .prompt-card:hover,
#slideshowContainer .card-hover:hover,
#similarSlideshowContainer .prompt-card:hover,
#similarSlideshowContainer .card-hover:hover {
    transform: none !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

/* Flame icon animation */
.flame-icon {
    animation: flame-flicker 1.5s ease-in-out infinite;
}

@keyframes flame-flicker {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }

    25% {
        transform: scale(1.1) rotate(-2deg);
        opacity: 0.9;
    }

    50% {
        transform: scale(0.95) rotate(2deg);
        opacity: 1;
    }

    75% {
        transform: scale(1.05) rotate(-1deg);
        opacity: 0.95;
    }
}

.flame-icon i {
    animation: flame-pulse 1s ease-in-out infinite alternate;
}

@keyframes flame-pulse {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    100% {
        transform: scale(1.15);
        filter: brightness(1.3);
    }
}

/* Fade in animation */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fade-in 0.3s ease-out;
}