/* Dark mode visibility improvements */

/* Darker background for better contrast */
.dark body {
    background-color: #121212 !important;
}

/* Improved dark mode text visibility */
.dark .text-gray-600,
.dark .text-gray-500,
.dark .text-gray-400 {
    color: rgba(229, 231, 235, 0.9) !important;
    /* Lighter gray for better readability */
}

.dark .text-gray-300 {
    color: rgba(249, 250, 251, 0.95) !important;
    /* Near white for even better contrast */
}

/* Improve dark mode card visibility */
.dark .card {
    background-color: rgba(31, 41, 55, 0.9) !important;
    border: 1px solid rgba(75, 85, 99, 0.5) !important;
}

/* Improve input contrast in dark mode */
.dark textarea,
.dark input {
    background-color: rgba(31, 41, 55, 0.9) !important;
    color: rgba(249, 250, 251, 0.95) !important;
    border-color: rgba(75, 85, 99, 0.7) !important;
}

/* Improved dark mode button visibility */
.dark .btn {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
}

/* Enhanced dark mode character options visibility */
.dark .character-option {
    background-color: rgba(31, 41, 55, 0.9) !important;
    border: 1px solid rgba(75, 85, 99, 0.5) !important;
    color: rgba(249, 250, 251, 0.95) !important;
}

.dark .character-option.active {
    background-color: rgba(124, 58, 237, 0.3) !important;
    border-color: rgba(139, 92, 246, 0.7) !important;
    color: white !important;
}

/* Improve dark mode preview area visibility */
.dark #previewArea {
    background-color: rgba(31, 41, 55, 0.9) !important;
    border: 1px solid rgba(75, 85, 99, 0.7) !important;
}

/* Improve dark mode platform buttons visibility - ENHANCED */
.dark .platform-btn {
    background-color: rgba(31, 41, 55, 0.9) !important;
    border: 1px solid rgba(75, 85, 99, 0.7) !important;
    color: rgba(249, 250, 251, 0.95) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.25) !important;
}

.dark .platform-btn.active {
    background-color: rgba(124, 58, 237, 0.3) !important;
    border-color: rgba(139, 92, 246, 0.6) !important;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3) !important;
}

/* Significantly improve platform button icon and text visibility */
.dark .platform-btn i {
    filter: brightness(1.4) !important;
    font-size: 1.75rem !important;
    margin-bottom: 0.5rem !important;
}

.dark .platform-btn span {
    color: rgba(249, 250, 251, 0.95) !important;
    font-weight: 500 !important;
    font-size: 0.875rem !important;
}

/* Make platform buttons hover state more visible */
.dark .platform-btn:hover {
    transform: translateY(-5px) !important;
    background-color: rgba(55, 65, 81, 0.9) !important;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.3) !important;
}

/* Platform-specific icon enhancements for dark mode */
.dark .platform-btn[data-platform="whatsapp"] i {
    color: #25D366 !important;
    text-shadow: 0 0 10px rgba(37, 211, 102, 0.3) !important;
}

.dark .platform-btn[data-platform="telegram"] i {
    color: #0088cc !important;
    text-shadow: 0 0 10px rgba(0, 136, 204, 0.3) !important;
}

.dark .platform-btn[data-platform="facebook"] i {
    color: #1877F2 !important;
    text-shadow: 0 0 10px rgba(24, 119, 242, 0.3) !important;
}

.dark .platform-btn[data-platform="twitter"] i {
    color: #1DA1F2 !important;
    text-shadow: 0 0 10px rgba(29, 161, 242, 0.3) !important;
}

.dark .platform-btn[data-platform="instagram"] i {
    color: #E4405F !important;
    text-shadow: 0 0 10px rgba(228, 64, 95, 0.3) !important;
}

.dark .platform-btn[data-platform="reddit"] i {
    color: #FF4500 !important;
    text-shadow: 0 0 10px rgba(255, 69, 0, 0.3) !important;
}

.dark .platform-btn[data-platform="discord"] i {
    color: #5865F2 !important;
    text-shadow: 0 0 10px rgba(88, 101, 242, 0.3) !important;
}

.dark .platform-btn[data-platform="skype"] i {
    color: #00AFF0 !important;
    text-shadow: 0 0 10px rgba(0, 175, 240, 0.3) !important;
}

.dark .platform-btn[data-platform="slack"] i {
    color: #E01E5A !important;
    text-shadow: 0 0 10px rgba(224, 30, 90, 0.3) !important;
}

/* Improved dark mode headings */
.dark h1,
.dark h2,
.dark h3,
.dark h4,
.dark h5,
.dark h6 {
    color: rgba(249, 250, 251, 0.95) !important;
}

/* Improved step card visibility */
.dark .step-card {
    background-color: rgba(31, 41, 55, 0.9) !important;
    border: 1px solid rgba(75, 85, 99, 0.5) !important;
}

/* Enhanced dark mode contrast for small text elements */
.dark .text-xs,
.dark .text-sm {
    color: rgba(229, 231, 235, 0.9) !important;
}

/* Enhanced message tester visibility */
.dark #messageTester {
    background-color: rgba(31, 41, 55, 0.9) !important;
    color: rgba(249, 250, 251, 0.95) !important;
}

/* Enhanced dark mode sections */
.dark .trending-section>div,
.dark .about-section .bg-gradient-to-r,
.dark .keyword-cloud {
    background: rgba(31, 41, 55, 0.9) !important;
}

/* Improve visibility of dark mode toggle */
.dark #darkModeToggle {
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2) !important;
}

/* Improve visibility of test result messages */
.dark .success-msg {
    background: rgba(16, 185, 129, 0.2) !important;
    color: rgb(167, 243, 208) !important;
}

.dark .error-msg {
    background: rgba(239, 68, 68, 0.2) !important;
    color: rgb(252, 165, 165) !important;
}

/* Enhance keyword cloud tags in dark mode */
.dark .keyword-cloud span {
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Fix contrast issue in the how-to-use section */
.dark .how-to-use-section .step-number {
    color: white !important;
    background: rgba(124, 58, 237, 0.6) !important;
}

/* Improve gradient text visibility */
.dark .text-transparent.bg-clip-text {
    text-shadow: 0 0 1px rgba(255, 255, 255, 0.1) !important;
}

/* Force content visibility in the preview area */
.dark #previewArea .invisible-char {
    background-color: rgba(55, 65, 81, 0.8) !important;
}

.dark #previewArea .opacity-40 {
    opacity: 0.6 !important;
}

/* Enhance background elements for better visibility */
.dark .animated-background .floating-bubble,
.dark .animated-background .particle,
.dark .animated-background .glow {
    opacity: 0.5 !important;
}

/* Improved footer links */
.dark footer a {
    color: rgba(139, 92, 246, 0.9) !important;
}

/* Improved ripple effect in dark mode */
.dark .ripple {
    background-color: rgba(255, 255, 255, 0.15) !important;
}

/* Additional improvements for better visibility in dark mode */

/* Make the card buttons more visible */
.dark .btn.bg-gradient-to-r {
    opacity: 0.95 !important;
}

/* Enhance dark mode range slider for better visibility */
.dark input[type="range"] {
    background: linear-gradient(90deg, #8b5cf6, #a855f7) !important;
}

.dark input[type="range"]::-webkit-slider-thumb {
    background-color: #f9fafb !important;
    border: 2px solid #a855f7 !important;
    box-shadow: 0 0 5px rgba(168, 85, 247, 0.5) !important;
}

/* Make character option active state more prominent */
.dark .character-option.active {
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4) !important;
}

/* Enhanced gradient text for better visibility in dark mode */
.dark .text-transparent.bg-clip-text.bg-gradient-to-r {
    background-image: linear-gradient(to right, rgba(192, 132, 252, 0.95), rgba(165, 180, 252, 0.95)) !important;
    text-shadow: 0 0 1px rgba(255, 255, 255, 0.2) !important;
    opacity: 0.95 !important;
}

/* Enhance the header title in dark mode */
.dark header h1 {
    filter: brightness(1.2) !important;
    text-shadow: 0 0 15px rgba(168, 85, 247, 0.5) !important;
}

/* Fix the invisible character display in preview area */
.dark #previewArea .invisible-char {
    background-color: rgba(55, 65, 81, 0.95) !important;
    border: 1px solid rgba(124, 58, 237, 0.3) !important;
}

/* Improve the character count indicator */
.dark #previewArea .text-xs.text-purple-600 {
    background-color: rgba(124, 58, 237, 0.3) !important;
    color: white !important;
    padding: 0.25rem 0.75rem !important;
}

/* Enhance the text in the test area */
.dark #testResult .text-xs {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Fix visibility of footer links */
.dark footer a {
    color: rgba(168, 85, 247, 0.9) !important;
}

/* Global centering styles - ensure all sections are properly centered */
.container {
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

main,
section {
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

.max-w-lg,
.max-w-3xl {
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/* Make sure all cards are centered */
.card {
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Ensure form elements use full width */
#messageTester,
input,
textarea {
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Align all content boxes */
.prose,
.trending-section,
.steps-container,
.feature-card-container {
    margin-left: auto !important;
    margin-right: auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Responsive layout improvements to reduce excessive spacing */
@media (max-width: 768px) {
    .container {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        max-width: 100% !important;
        width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    main {
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .card {
        padding: 1rem !important;
        border-radius: 0.75rem !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .how-to-use-section,
    .about-section {
        padding-left: 0 !important;
        padding-right: 0 !important;
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    section {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .max-w-3xl {
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .px-4 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
}

@media (max-width: 480px) {
    .container {
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }

    .card {
        padding: 0.75rem !important;
    }

    .grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 0.5rem !important;
    }

    .platform-btn {
        padding: 0.5rem !important;
    }

    .platform-btn i {
        font-size: 1.25rem !important;
        margin-bottom: 0.25rem !important;
    }

    .platform-btn span {
        font-size: 0.7rem !important;
    }

    .mb-8 {
        margin-bottom: 1rem !important;
    }

    /* Further optimize platform buttons on very small screens */
    .dark .platform-btn i {
        font-size: 1.5rem !important;
        margin-bottom: 0.25rem !important;
    }

    /* Optimize main buttons */
    .grid-cols-2 {
        gap: 0.5rem !important;
    }

    .btn {
        padding: 0.6rem 0.75rem !important;
    }

    /* Reduce spacing between cards */
    .card+.card {
        margin-top: 0.75rem !important;
    }
}

/* Extra narrow screen optimizations */
@media (max-width: 380px) {
    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        margin: 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    main,
    section {
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .card {
        padding: 0.6rem !important;
        border-radius: 0.5rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .grid-cols-3 {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.35rem !important;
    }

    .platform-btn {
        padding: 0.35rem !important;
    }

    .platform-btn i {
        font-size: 1.1rem !important;
        margin-bottom: 0.15rem !important;
    }

    .platform-btn span {
        font-size: 0.65rem !important;
    }

    /* Improve how the choose platform title looks */
    h2.text-xl {
        font-size: 1rem !important;
    }

    /* Make character options more compact */
    .character-option {
        padding: 0.4rem !important;
    }

    /* Optimize whitespace */
    .p-6,
    .p-8 {
        padding: 0.6rem !important;
    }

    .pl-6,
    .pl-8 {
        padding-left: 0.6rem !important;
    }

    /* Adjust margins */
    .my-16 {
        margin-top: 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }
}

/* Set maximum widths for different screen sizes */
@media (min-width: 768px) {
    main {
        max-width: 800px !important;
    }

    .max-w-3xl {
        max-width: 900px !important;
    }
}

@media (min-width: 1024px) {
    main {
        max-width: 800px !important;
    }

    .max-w-3xl {
        max-width: 900px !important;
    }
}