:root {
    --bg: #09090b;
    --bg-gradient: radial-gradient(circle at top right, #2e1065, #09090b 40%);
    --card-bg: rgba(24, 24, 27, 0.7);
    --border: rgba(63, 63, 70, 0.5);
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;

    --input-bg: rgba(39, 39, 42, 0.8);
    --textarea-bg: rgba(9, 9, 11, 0.6);
    --textarea-focus-bg: rgba(9, 9, 11, 0.9);
    --suggestions-bg: rgba(24, 24, 27, 0.85);
    --key-badge-bg: rgba(63, 63, 70, 0.5);
    --shadow-color: rgba(0, 0, 0, 0.5);
}

body.light-mode {
    --bg: #f8fafc;
    --bg-gradient: radial-gradient(circle at top right, #e2e8f0, #f8fafc 40%);
    --card-bg: rgba(255, 255, 255, 0.8);
    --border: rgba(203, 213, 225, 0.8);
    --primary: #6d28d9;
    --primary-hover: #5b21b6;
    --text-main: #0f172a;
    --text-muted: #64748b;

    --input-bg: rgba(241, 245, 249, 0.8);
    --textarea-bg: rgba(248, 250, 252, 0.6);
    --textarea-focus-bg: rgba(255, 255, 255, 0.9);
    --suggestions-bg: rgba(255, 255, 255, 0.9);
    --key-badge-bg: rgba(226, 232, 240, 0.8);
    --shadow-color: rgba(148, 163, 184, 0.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    gap: 2rem;
    box-sizing: border-box;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 800px;
    box-shadow: 0 25px 50px -12px var(--shadow-color);
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

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

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

.branding {
    display: inline-block;
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
    border: 1px solid rgba(139, 92, 246, 0.3);
    text-decoration: none;
    transition: all 0.2s ease;
}

.branding:hover {
    background: rgba(139, 92, 246, 0.25);
}

h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #c4b5fd, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-muted);
    margin-top: 0.5rem;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.theme-btn {
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem;
    border-radius: 12px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

select {
    appearance: none;
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 3rem 0.75rem 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

select:focus,
select:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.copy-btn {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--primary);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
}

.copy-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.copy-btn:active {
    transform: scale(0.98);
}

.editor-container {
    position: relative;
}

textarea {
    width: 100%;
    height: 350px;
    background: var(--textarea-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    padding-bottom: 4.5rem;
    /* Space for suggestions bar */
    color: var(--text-main);
    font-size: 1.25rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.1);
}

textarea:focus {
    border-color: var(--primary);
    background: var(--textarea-focus-bg);
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(139, 92, 246, 0.2);
}

textarea::placeholder {
    color: var(--text-muted);
}

.suggestions-bar {
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    background: var(--suggestions-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(139, 92, 246, 0.5);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    box-shadow: 0 10px 25px -5px var(--shadow-color), 0 0 15px rgba(139, 92, 246, 0.2);
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.3s ease;
    opacity: 1;
    transform: translateY(0);
    max-height: 200px;
    overflow-y: auto;
}

.suggestions-bar.hidden {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.suggestion-item {
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-main);
    font-weight: 500;
    transition: all 0.2s ease;
    flex: 0 0 auto;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.suggestion-number {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-right: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.info-text {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.key-badge {
    background: var(--key-badge-bg);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-family: monospace;
    font-size: 0.8rem;
}

.seo-content {
    line-height: 1.7;
}

.seo-content h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.seo-content h2 {
    font-size: 1.4rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-main);
    font-weight: 600;
    margin-left: 0;
}

.seo-content p {
    color: var(--text-muted);
    margin-bottom: 1rem;
    margin-top: 0;
}

.seo-content ul {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    margin-top: 0;
}

.seo-content li {
    margin-bottom: 0.5rem;
}

.seo-content strong {
    color: var(--text-main);
}

.seo-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: var(--input-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.seo-content th,
.seo-content td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.seo-content th {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
    font-weight: 600;
}

.seo-content tr:last-child td {
    border-bottom: none;
}

.seo-content td {
    color: var(--text-muted);
}

.faq-accordion {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.faq-item {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item[open] {
    border-color: var(--primary);
    background: var(--card-bg);
}

.faq-question {
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-main);
    cursor: pointer;
    list-style: none;
    /* remove default arrow */
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.faq-question::-webkit-details-marker {
    display: none;
}

.faq-question::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.3s ease;
    opacity: 0.7;
}

.faq-item[open] .faq-question::after {
    transform: translateY(2px) rotate(-135deg);
}

.faq-answer {
    padding: 0 1.5rem 1.25rem 1.5rem;
    color: var(--text-muted);
    line-height: 1.6;
    animation: accordionFade 0.3s ease-in-out;
}

.faq-answer p {
    margin: 0;
    padding-bottom: 0.5rem;
}

.faq-answer p:last-child {
    padding-bottom: 0;
}

@keyframes accordionFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* Navbar specific styles */
.navbar {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: -1rem;
    box-sizing: border-box;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

.blog-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 2rem;
}

.blog-card {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    transition: transform 0.2s ease, border-color 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.blog-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 25px -5px var(--shadow-color);
}

.blog-card-date {
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.blog-card h2 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    color: var(--text-main);
}

.blog-card p {
    color: var(--text-muted);
    margin: 0;
    line-height: 1.6;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 2rem;
    transition: opacity 0.2s ease;
}

.back-link:hover {
    opacity: 0.8;
}

/* Desktop base styles */
@media (min-width: 769px) {
    .navbar {
        padding: 0.75rem 1.5rem;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
    }

    .navbar .branding {
        margin-bottom: 0;
    }

    .nav-links {
        gap: 1.25rem;
        order: 2;
        flex: 1;
        justify-content: center;
    }

    .nav-links a {
        font-size: 0.9rem;
        padding: 0.25rem 0;
    }

    .theme-btn {
        order: 3;
    }

    .container {
        padding: 2.5rem;
    }

    .controls {
        flex-direction: row;
        align-items: center;
    }

    .controls select {
        flex: 1;
        max-width: 280px;
    }

    .controls .copy-btn {
        flex: 0 0 auto;
    }

    textarea {
        height: 300px;
    }
}

/* Large desktop screens */
@media (min-width: 1200px) {
    .navbar {
        max-width: 900px;
    }

    .container {
        max-width: 900px;
    }

    h1 {
        font-size: 2.75rem;
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .container {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .navbar {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .navbar .branding {
        order: 1;
        margin-bottom: 0;
    }

    .nav-links {
        order: 2;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
    }

    .theme-btn {
        order: 3;
    }

    .nav-links a {
        padding: 0.25rem 0.5rem;
        border-radius: 6px;
    }

    h1 {
        font-size: 1.8rem;
        line-height: 1.2;
    }

    .subtitle {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }

    .controls {
        flex-direction: column;
        gap: 0.75rem;
    }

    select,
    .copy-btn,
    .theme-btn {
        width: 100%;
        padding: 0.75rem;
    }

    textarea {
        height: 220px;
        padding: 1rem;
        padding-bottom: 3.5rem;
        font-size: 1.1rem;
    }

    .suggestions-bar {
        left: 0.5rem;
        right: 0.5rem;
        bottom: 0.5rem;
        padding: 0.5rem;
        overflow-y: auto;
        max-height: 150px;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .suggestions-bar::-webkit-scrollbar {
        display: none;
    }

    .suggestion-item {
        flex: 0 0 auto;
        padding: 0.5rem 0.8rem;
        font-size: 0.95rem;
    }

    .info-text {
        font-size: 0.8rem;
        line-height: 1.5;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .info-text svg {
        margin-top: 0.15rem;
        flex-shrink: 0;
        width: 14px;
        height: 14px;
    }

    .key-badge {
        padding: 0.15rem 0.4rem;
        font-size: 0.75rem;
    }

    .seo-content h1 {
        font-size: 1.75rem;
    }

    .seo-content h2 {
        font-size: 1.25rem;
    }

    .faq-question {
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }

    .faq-answer {
        padding: 0 1.25rem 1rem 1.25rem;
        font-size: 0.9rem;
    }

    footer {
        font-size: 0.75rem;
        padding: 1.5rem 0;
    }

    .blog-grid {
        gap: 1rem;
    }

    .blog-card {
        padding: 1.5rem;
    }

    .blog-card h2 {
        font-size: 1.25rem;
    }

    .blog-card p {
        font-size: 0.9rem;
    }
}

/* Additional small screen adjustments */
@media (max-width: 480px) {
    body {
        padding: 0.75rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .container {
        padding: 1rem;
        border-radius: 12px;
    }

    .navbar {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .nav-links {
        gap: 0.5rem;
    }

    .nav-links a {
        font-size: 0.875rem;
        padding: 0.2rem 0.4rem;
    }

    select,
    .copy-btn,
    .theme-btn {
        padding: 0.65rem;
        font-size: 0.9rem;
    }

    textarea {
        height: 180px;
        padding: 0.75rem;
        padding-bottom: 3rem;
        font-size: 1rem;
    }

    .info-text {
        font-size: 0.75rem;
    }

    .key-badge {
        padding: 0.1rem 0.3rem;
        font-size: 0.7rem;
    }

    .suggestions-bar {
        left: 0.25rem;
        right: 0.25rem;
        bottom: 0.25rem;
        padding: 0.35rem;
    }

    .suggestion-item {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }

    .faq-item {
        margin: 0.5rem 0;
    }

    .faq-question {
        padding: 0.85rem 1rem;
    }

    .faq-answer {
        padding: 0 1rem 0.75rem 1rem;
    }

    .blog-card {
        padding: 1rem;
    }

    .blog-card h2 {
        font-size: 1.1rem;
    }
}
