/* Modern Color Variables & Theme Defaults */
:root {
    --bg-color: #f4f6f9;
    --text-color: #333333;
    --card-bg: #ffffff;
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --border-color: #e0e0e0;
    --input-bg: #ffffff;
    --input-text: #333333;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
    --font-heading: 'Inter', sans-serif;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #f0f0f0;
    --card-bg: #1e1e1e;
    --primary-color: #3b82f6;
    --primary-hover: #60a5fa;
    --border-color: #333333;
    --input-bg: #2d2d2d;
    --input-text: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
}

/* Global Reset & Base Styles */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    margin: 0;
    padding-bottom: 50px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-color);
    text-align: center;
    margin-top: 20px;
    margin-bottom: 10px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Page Layout (Desktop) */
.page-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    /* Important for sticky sidebar */
}

.main-column {
    flex: 1;
    /* Takes remaining space */
    min-width: 0;
    /* Prevents overflow issues */
}

.sidebar-column {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 90px;
    /* Offset for sticky header if any, or just spacing */
    height: fit-content;
}

/* Header & Controls */
.header-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.theme-toggle-btn {
    background: none;
    border: 2px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.theme-toggle-btn:hover {
    background-color: var(--card-bg);
    border-color: var(--primary-color);
}

.font-size-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.font-size-control label {
    font-weight: bold;
}

/* Range Slider Styling */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    /* Specific width is allowed */
    background: transparent;
    cursor: pointer;
}

input[type=range]:focus {
    outline: none;
}

/* Slider Track */
input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    background: #bbb;
    /* Darker for visibility */
    border-radius: 5px;
    border: none;
}

input[type=range]::-moz-range-track {
    width: 100%;
    height: 8px;
    background: #bbb;
    border-radius: 5px;
    border: none;
}

/* Slider Thumb */
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    margin-top: -6px;
    /* Center thumb on track */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s;
}

input[type=range]::-moz-range-thumb {
    height: 20px;
    width: 20px;
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:hover,
input[type=range]:active::-webkit-slider-thumb {
    transform: scale(1.2);
}

/* Copy Animation State */
.copybutton.copied-btn {
    background-color: #28a745 !important;
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Main Textarea */
.fancytext {
    width: 100% !important;
    background-color: var(--input-bg) !important;
    color: var(--input-text) !important;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    font-size: 1.2rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    resize: vertical;
}

.fancytext:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* Fixed Header on Scroll */
.fixed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 99;
    border-radius: 0;
    margin: 0;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Results Area */
#result {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.input-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.form-control {
    background-color: transparent !important;
    border: none;
    color: var(--input-text) !important;
    box-shadow: none !important;
    font-size: 1.1rem;
    height: auto;
    padding: 12px 15px;
}

.input-group-append {
    margin: 0;
}

.copybutton {
    cursor: pointer;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    font-weight: 600;
    padding: 0 20px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copybutton:hover {
    background-color: var(--primary-hover);
}

/* Load More Button */
.loadmore {
    background-color: var(--primary-color);
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 50px;
    margin-top: 20px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    color: white;
}

.loadmore:hover {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

/* Toast Notification */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background-color: var(--card-bg);
    color: var(--text-color);
    border-left: 5px solid var(--primary-color);
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease forwards, fadeOut 0.5s ease 2.5s forwards;
    opacity: 0;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}


/* Responsive */
@media (max-width: 991px) {

    /* Breakpoint for Tablet/Mobile */
    .page-layout {
        flex-direction: column;
    }

    .sidebar-column {
        width: 100%;
        position: static;
        /* No sticky on mobile usually */
        margin-top: 30px;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 15px;
    }

    .header-controls {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* --- Navbar --- */
.navbar {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    margin-bottom: 20px;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links a {
    color: var(--text-color);
    font-weight: 600;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* --- Language Dropdown --- */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background-color: transparent;
    color: var(--text-color);
    padding: 8px 12px;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--card-bg);
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.dropdown-content a {
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.dropdown-content a:hover {
    background-color: var(--bg-color);
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* --- SEO Article & Footer Sections --- */
.article-content {
    margin-top: 50px;
}

.article-content .card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.article-content h2 {
    text-align: left;
    margin-top: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    color: var(--text-color);
}

.article-content p,
.article-content li {
    line-height: 1.6;
    color: var(--text-color);
    opacity: 0.9;
}

.section-footer {
    margin-top: 50px;
    margin-bottom: 50px;
}

.keywords-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.keyword-category h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.keyword-category ul {
    list-style: none;
    padding: 0;
}

.keyword-category li {
    margin-bottom: 5px;
}

.keyword-category a {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
}

.keyword-category a:hover {
    opacity: 1;
    color: var(--primary-color);
    text-decoration: underline;
}

.main-footer {
    background-color: var(--card-bg);
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: 50px;
    font-size: 0.9rem;
    color: var(--text-color);
}

/* --- Input Overflow Fix --- */
/* Ensure inputs don't extend beyond their container */
.input-group input.form-control {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Override input styling to handle large fonts nicely */
.fancytext {
    resize: vertical;
    min-height: 100px;
}