/*
Theme Name: WordFinder Pro - API Edition
Theme URI: https://yourdomain.com
Author: WordFinder Team
Description: Fun and friendly word unscrambler powered by Datamuse & Anagramica APIs
Version: 2.1.2
License: GPL v2 or later
Text Domain: wordfinder
*/

/* =Reset & Base Styles */
:root {
    /* Candy Shop Palette */
    --primary-color: #3b82f6;
    /* Bright Blue */
    --primary-dark: #2563eb;

    --secondary-color: #f97316;
    /* Vibrant Orange */
    --secondary-dark: #ea580c;

    --heading-color: #111827;
    /* Deep Gray */
    --text-color: #4b5563;
    /* Cool Gray */

    --bg-color: #fdfbf7;
    /* Warm Cream */
    --card-bg: #ffffff;

    --border-color: #e5e7eb;

    --success-color: #22c55e;
    --error-color: #ef4444;

    /* Spacing & Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    /* Fun Shadows (3D Effect) */
    --shadow-card: 0 4px 0 0 rgba(0, 0, 0, 0.05);
    --shadow-card-hover: 0 8px 0 0 rgba(59, 130, 246, 0.1);
    --shadow-btn: 0 4px 0 0 rgba(0, 0, 0, 0.1);
    --shadow-btn-active: 0 0 0 0 rgba(0, 0, 0, 0.1);

    --font-heading: 'Nunito', sans-serif;
    --font-body: 'Nunito', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    font-weight: 600;
    /* Heavier base weight for friendliness */
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    background-image: radial-gradient(#e5e7eb 1px, transparent 1px);
    background-size: 24px 24px;
    /* Subtle dot pattern */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

a:hover {
    color: var(--primary-dark);
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =Header */
.site-header {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 40px;
}

.header-content {
    display: flex;
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
}

.site-branding {
    margin-right: 0;
    margin-bottom: 25px;
    text-align: center;
}

.site-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

/* =Navigation */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 15px;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.main-nav a {
    display: inline-block;
    background: #fff;
    color: var(--heading-color);
    font-weight: 800;
    font-size: 14px;
    /* Reduced for single line fit */
    padding: 8px 16px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    border-bottom: 4px solid #cbd5e1;
    /* 3D Bottom */
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    /* Forces Single Line */
}

.main-nav a:hover {
    background: #fff;
    color: var(--primary-color);
    transform: translateY(2px);
    border-bottom-width: 2px;
    /* Press effect */
    border-color: var(--primary-color);
}

.main-nav a:active {
    transform: translateY(4px);
    border-bottom-width: 0px;
}

/* =Hero Section (App-like) */
.wordfinder-hero {
    max-width: 800px;
    margin: 40px auto 80px;
    text-align: center;
}

/* "Scrabble Tile" Title Style */
.form-title {
    font-size: 48px;
    font-weight: 800;
    color: var(--heading-color);
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.form-title span {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    height: 60px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 6px 0 0 #cbd5e1;
    border: 2px solid #e2e8f0;
    color: var(--primary-color);
    transform: translateY(0);
    transition: transform 0.2s;
}

/* Alternate colors for fun */
.form-title span:nth-child(even) {
    color: var(--secondary-color);
    transform: rotate(2deg);
}

.form-title span:nth-child(odd) {
    transform: rotate(-2deg);
}

.form-title span:hover {
    transform: translateY(-5px) rotate(0);
}

.form-subtitle {
    font-size: 20px;
    color: var(--text-color);
    margin-bottom: 40px;
}

/* =Playful Form */
.wordfinder-form {
    max-width: 700px;
    margin: 0 auto;
    background: #ffffff;
    /* White Board */
    padding: 30px;
    border-radius: 24px;
    border: 3px solid #cbd5e1;
    border-bottom: 8px solid #94a3b8;
    /* Thick 3D Edge */
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.wordfinder-form .form-group {
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
    display: flex;
    gap: 15px;
}

.wordfinder-form .form-group:focus-within {
    border-color: transparent;
}

.wordfinder-input {
    flex: 1;
    border: 2px solid #e2e8f0;
    padding: 16px 20px;
    font-size: 20px;
    font-weight: 700;
    border-radius: 16px;
    outline: none;
    color: var(--heading-color);
    background: #f8fafc;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
    transition: all 0.2s;
}

.wordfinder-input:focus {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

.wordfinder-input::placeholder {
    color: #94a3b8;
    font-weight: 600;
}

/* Advanced Search Inputs */
.search-grid {
    margin-top: 20px;
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.adv-input-group {
    flex: 1 1 140px;
    /* Grow, Shrink, Basis */
    min-width: 140px;
    max-width: 100%;
    text-align: left;
}

.adv-input-group .wordfinder-input {
    width: 100%;
    /* Force fill */
    margin: 0;
}

.adv-input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
    /* Dark Gray for white bg */
    font-weight: 800;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sidebar Shortcode Input Override */
.shortcode-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 15px;
    margin-bottom: 10px;
    border: 2px solid #e2e8f0;
    /* Clean border */
    border-radius: 12px;
    background: #fff;
    color: var(--heading-color);
    font-weight: 700;
}

.shortcode-input:focus {
    border-color: var(--primary-color);
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.wordfinder-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 800;
    border-radius: var(--radius-lg);
    cursor: pointer;
    box-shadow: var(--shadow-btn);
    transform: translateY(0);
    transition: all 0.1s;
}

.wordfinder-button:hover {
    background: var(--primary-dark);
    transform: translateY(2px);
    box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.1);
}

.wordfinder-button:active {
    transform: translateY(4px);
    box-shadow: var(--shadow-btn-active);
}

/* =Results Cards */
.wordfinder-results {
    margin-top: 50px;
}

.word-card-simple,
.word-card-interactive {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    transition: all 0.1s;
    position: relative;
    /* Overflow Fixes */
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
    width: 100%;
}

.word-card-interactive {
    cursor: pointer;
}

.word-card-interactive:hover {
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.word-card-simple strong,
.word-card-interactive strong {
    display: block;
    font-size: 18px;
    color: var(--heading-color);
    margin-bottom: 4px;
    line-height: 1.2;
}

.word-row {
    background: var(--card-bg);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 0 0 #e2e8f0;
    border: 2px solid #e2e8f0;
    transition: transform 0.2s;
}

.word-row:hover {
    transform: translateY(-2px);
    border-color: var(--secondary-color);
}

.word-row strong {
    font-size: 22px;
    color: var(--heading-color);
    letter-spacing: 1px;
}

.word-row span {
    font-size: 14px;
    color: white;
    background: var(--secondary-color);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-weight: 800;
}

/* =Archive Grid (Game Cards) */
.archive-header {
    text-align: center;
    margin-bottom: 50px;
}

.page-title {
    font-size: 40px;
    font-weight: 900;
    color: var(--heading-color);
    margin-bottom: 10px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.post-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-card);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

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

.post-thumbnail {
    height: 180px;
    overflow: hidden;
    position: relative;
    background: #e2e8f0;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.entry-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 12px;
}

.entry-title a {
    color: var(--heading-color);
}

.entry-title a:hover {
    color: var(--primary-color);
}

.entry-excerpt {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 15px;
    flex: 1;
}

.read-more-btn {
    align-self: flex-start;
    background: #eef2ff;
    color: var(--primary-color);
    font-weight: 800;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: var(--radius-full);
}

.read-more-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* =SEO Content */
.homepage-seo-content {
    background: var(--card-bg);
    padding: 50px;
    border-radius: var(--radius-lg);
    margin-top: 80px;
    margin-bottom: 80px;
    box-shadow: var(--shadow-card);
    border: 2px solid var(--border-color);
}

/* =Header */
.site-header {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 0;
    border-bottom: 3px solid var(--border-color);
    margin-bottom: 40px;
    box-shadow: 0 4px 0 0 rgba(0, 0, 0, 0.05);
    /* 3D Effect */
}

/* ... existing header content styles ... */

/* =Footer */
.site-footer {
    margin-top: auto;
    background: var(--heading-color);
    padding: 80px 0 40px;
    color: #cbd5e1;
    border-top: 5px solid rgba(255, 255, 255, 0.1);
}

.result-group {
    /* Ensure groups are strictly separated visually */
    page-break-inside: avoid;
    break-inside: avoid;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 60px;
}

.footer-section h3 {
    color: white;
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.footer-links li {
    margin-bottom: 15px;
}

.footer-links a {
    color: #94a3b8;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s;
    display: inline-block;
}

.footer-links a:hover {
    color: var(--secondary-color);
    padding-left: 8px;
    text-shadow: 0 0 10px rgba(249, 115, 22, 0.3);
}

.copyright {
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    padding-top: 40px;
    text-align: center;
    color: #64748b;
    font-size: 15px;
    font-weight: 600;
}

/* Game Selector Styles */
.game-selector {
    background: #f1f5f9;
    /* Light gray background */
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    margin: 0 10px;
    outline: none;
    height: 46px;
    /* Match input height roughly */
}

.game-selector:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Footer Widget Styles */
.footer-grid h4.footer-title {
    color: #fff;
    font-size: 18px;
    margin-bottom: 15px;
}

.footer-bottom-widget {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.footer-bottom-widget a {
    color: #fff;
    text-decoration: none;
}

/* =Responsive */
@media (max-width: 768px) {
    .game-selector {
        width: 100%;
        margin: 0 0 10px 0;
        text-align: center;
    }

    .form-title {
        font-size: 32px;
        /* Smaller title */
        gap: 4px;
    }

    .form-title span {
        width: 40px;
        height: 40px;
        font-size: 24px;
        border-radius: 8px;
    }

    .wordfinder-form {
        padding: 20px;
        border-width: 2px;
        box-shadow: none;
    }

    .wordfinder-form .form-group {
        flex-direction: column;
        gap: 10px;
    }

    .wordfinder-input,
    .wordfinder-button {
        font-size: 16px;
        width: 100%;
        padding: 12px;
    }

    .adv-input-group {
        max-width: 100%;
    }

    .search-inputs-row {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .form-title span {
        width: 32px;
        height: 32px;
        font-size: 18px;
        box-shadow: 0 3px 0 0 #cbd5e1;
    }

    .word-row strong {
        font-size: 16px;
    }

    .words-grid,
    .wf-word-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        /* Smaller cards */
        gap: 10px;
    }

    .word-card-interactive {
        padding: 8px;
    }

    .word-text {
        font-size: 16px;
    }
}

/* =Interactive Result Cards */
.wf-result-group {
    margin-bottom: 40px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.wf-group-title {
    background: #111827;
    color: white;
    padding: 15px 25px;
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wf-count-badge {
    background: var(--secondary-color);
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 14px;
}

.wf-word-grid {
    padding: 25px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.word-card-interactive {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 0 0 #cbd5e1;
    /* Initial 3D */
    user-select: none;
}

.word-card-interactive:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 0 0 #cbd5e1;
    /* Lift effect */
    border-color: var(--primary-color);
}

.word-card-interactive:active {
    transform: translateY(1px);
    box-shadow: 0 2px 0 0 #cbd5e1;
}

.word-text {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: var(--heading-color);
    margin-bottom: 5px;
}

.word-points {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
}

/* =Definition Modal */
.wf-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    /* Black w/ opacity */
    backdrop-filter: blur(5px);
}

.wf-modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 40px;
    border-radius: 24px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

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

.wf-close-modal {
    color: #aaa;
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.wf-close-modal:hover,
.wf-close-modal:focus {
    color: #000;
}

#wf-modal-word {
    font-size: 36px;
    margin-bottom: 5px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

#wf-modal-phonetic {
    font-size: 18px;
    color: #64748b;
    font-family: monospace;
    margin-bottom: 20px;
}

.wf-score-badge {
    display: inline-block;
    background: #eff6ff;
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 99px;
    font-weight: 800;
    margin-top: 20px;
}

.wf-def-list {
    text-align: left;
    list-style: none;
    padding: 0;
    margin: 0;
}

.wf-def-list li {
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-color);
    font-size: 16px;
}

.wf-def-list li:last-child {
    border-bottom: none;
}

.wf-def-list strong {
    color: var(--secondary-color);
    margin-right: 5px;
}

.wf-loader {
    color: #94a3b8;
    font-style: italic;
    padding: 20px;
}