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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    margin-bottom: 80px; /* Space for footer */
}

/* Header */
h1 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 2.5rem;
    font-weight: 700;
}

.description {
    text-align: center;
    color: #718096;
    margin-bottom: 30px;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Form Styles */
.filter-form {
    background: #f7fafc;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #e2e8f0;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
    font-size: 1rem;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    text-transform: uppercase;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group input::placeholder {
    color: #a0aec0;
    text-transform: none;
}

/* Button Styles */
.button-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

button[type="submit"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

button[type="submit"]:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.clear-btn {
    background: #e2e8f0;
    color: #4a5568;
}

.clear-btn:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

/* Results Styles */
.results, .error-message {
    background: #f7fafc;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.results h3, .error-message h3 {
    color: #4a5568;
    margin-bottom: 16px;
    font-size: 1.5rem;
    font-weight: 600;
}

.results-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.results-meta p {
    margin: 0;
    color: #718096;
    font-size: 0.95rem;
}

.results-meta strong {
    color: #4a5568;
}

.words-by-length {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.length-group {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e2e8f0;
}

.length-group h4 {
    color: #4a5568;
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 2px solid #667eea;
    padding-bottom: 4px;
}

.special-group {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #f39c12;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.2);
}

.special-group h4 {
    color: #d68910;
    border-bottom-color: #f39c12;
    font-weight: 700;
}

.special-word {
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
    border-color: #f39c12;
    color: #d68910;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(243, 156, 18, 0.1);
}

.special-word:hover {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.word-item {
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    text-align: center;
    font-weight: 500;
    color: #4a5568;
    transition: all 0.2s ease;
}

.word-item:hover {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.no-words {
    color: #a0aec0;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Error Message */
.error-message {
    background: #fed7d7;
    border-color: #fc8181;
}

.error-message h3 {
    color: #c53030;
}

.error-message p {
    color: #c53030;
    margin: 0;
}

/* Footer */
#footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 16px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.9rem;
    color: #718096;
}

#footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

#footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 16px;
    }

    h1 {
        font-size: 2rem;
    }

    .filter-form {
        padding: 20px;
    }

    .button-group {
        flex-direction: column;
    }

    button {
        width: 100%;
    }

    .words-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .results-meta {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .words-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .word-item {
        padding: 6px 8px;
        font-size: 0.9rem;
    }
}
