/* Basic Reset & Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Body & Typography */
body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f7f6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Container for Centering Content */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    width: 100%;
}

/* Accessibility: Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Header */
.main-header {
    background-color: #007bff;
    color: #fff;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.main-header .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 0.5rem;
}

.main-header h1 {
    font-size: 1.8rem;
    margin: 0;
    font-weight: 600;
}

.anycoder-link {
    color: #fff;
    text-decoration: none;
    font-weight: 400;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.2);
    transition: background-color 0.3s ease;
}

.anycoder-link:hover,
.anycoder-link:focus {
    background-color: rgba(255, 255, 255, 0.3);
    outline: none;
}

/* Main Content */
main {
    flex-grow: 1;
    padding: 2rem 1rem;
}

/* Card Styling */
.card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.card h2 {
    color: #007bff;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Search Form */
.search-form {
    display: flex;
    flex-wrap: wrap; /* Allow input and button to wrap */
    gap: 0.75rem;
    justify-content: center;
}

.search-form input[type="search"] {
    flex-grow: 1;
    padding: 0.8rem 1rem;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 1rem;
    min-width: 200px; /* Ensure input is not too small */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-form input[type="search"]:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

.search-form button {
    padding: 0.8rem 1.5rem;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.search-form button:hover,
.search-form button:focus {
    background-color: #0056b3;
    transform: translateY(-1px);
    outline: none;
}

/* Search Results */
.results-list {
    margin-top: 1.5rem;
}

.result-item {
    background-color: #f9f9f9;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s ease;
}

.result-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.result-item h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.result-item a {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
    word-wrap: break-word; /* Prevent long URLs from breaking layout */
}

.result-item a:hover,
.result-item a:focus {
    text-decoration: underline;
}

.result-item p {
    font-size: 0.95rem;
    color: #555;
}

.no-results-message {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 1rem;
}

/* Footer */
.main-footer {
    background-color: #343a40;
    color: #fff;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto; /* Pushes footer to the bottom */
}

.main-footer p {
    margin: 0;
    font-size: 0.9rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .main-header h1 {
        font-size: 1.5rem;
    }

    .main-header .header-content {
        flex-direction: column;
        text-align: center;
    }

    .main-header .anycoder-link {
        margin-top: 0.5rem;
    }

    .card {
        padding: 1rem;
    }

    .card h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    .search-form {
        flex-direction: column;
    }

    .search-form input[type="search"],
    .search-form button {
        width: 100%;
    }

    .result-item h3 {
        font-size: 1.1rem;
    }

    .result-item p {
        font-size: 0.9rem;
    }
}

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

    .main-header h1 {
        font-size: 1.3rem;
    }

    .anycoder-link {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }

    main {
        padding: 1rem 0.5rem;
    }

    .card {
        padding: 0.8rem;
        margin-bottom: 1.5rem;
    }

    .card h2 {
        font-size: 1.2rem;
    }

    .search-form input[type="search"],
    .search-form button {
        padding: 0.7rem 1rem;
        font-size: 0.95rem;
    }

    .result-item {
        padding: 0.8rem;
    }
    .result-item h3 {
        font-size: 1rem;
    }
    .result-item p {
        font-size: 0.85rem;
    }
}