body {
    font-family: sans-serif;
    background-color: #1a202c;
    color: #e2e8f0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

.container {
    text-align: center;
    background-color: #2d3748;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

h1 {
    color: #e2e8f0;
}

.image-container {
    margin: 1.5rem 0;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #4a5568;
    border-radius: 10px;
    padding: 1rem;
    position: relative;
}

#image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 5px;
}

.info-container {
    margin-top: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    min-height: 1.5rem;
}

.cataas-container {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

#cataas-text {
    padding: 0.8rem;
    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid #4a5568;
    background-color: #1a202c;
    color: #e2e8f0;
    width: 60%;
}

button {
    background-color: #4299e1;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #2b6cb0;
}

.hidden {
    display: none;
}

.loader {
    border: 4px solid #4a5568;
    border-top: 4px solid #4299e1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    position: absolute;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#error-message {
    color: #feb2b2;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

select {
    padding: 0.8rem;
    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid #4a5568;
    background-color: #1a202c;
    color: #e2e8f0;
}

button:disabled {
    background-color: #4a5568;
    cursor: not-allowed;
}

.secondary-controls {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

#share-button {
    background-color: #1da1f2;
}

.modal {
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
}

.modal-content {
    background-color: #2d3748;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #4a5568;
    width: 80%;
    max-width: 900px;
    border-radius: 10px;
    position: relative;
}

.close-button {
    color: #e2e8f0;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: #4299e1;
    text-decoration: none;
    cursor: pointer;
}

.favorites-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}

.favorites-gallery img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 5px;
}

#clear-favorites-button {
    margin-top: 1rem;
    background-color: #c53030;
}

.toast {
    visibility: hidden;
    min-width: 250px;
    margin-left: -125px;
    background-color: #e2e8f0;
    color: #1a202c;
    text-align: center;
    border-radius: 2px;
    padding: 16px;
    position: fixed;
    z-index: 1;
    left: 50%;
    bottom: 30px;
    font-size: 17px;
}

.toast.show {
    visibility: visible;
    -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@-webkit-keyframes fadein {
    from {bottom: 0; opacity: 0;} 
    to {bottom: 30px; opacity: 1;}
}

@keyframes fadein {
    from {bottom: 0; opacity: 0;}
    to {bottom: 30px; opacity: 1;}
}

@-webkit-keyframes fadeout {
    from {bottom: 30px; opacity: 1;} 
    to {bottom: 0; opacity: 0;}
}

@keyframes fadeout {
    from {bottom: 30px; opacity: 1;}
    to {bottom: 0; opacity: 0;}
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
        margin: 1rem;
        box-shadow: none;
    }

    h1 {
        font-size: 1.5rem;
    }

    .controls {
        flex-direction: column;
    }

    .controls button,
    .controls select {
        width: 100%;
    }

    .secondary-controls {
        flex-direction: column;
    }

    .secondary-controls button {
        width: 100%;
    }

    .modal-content {
        width: 90%;
        margin: 20% auto;
    }

    .favorites-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

button:focus,
select:focus {
    outline: 3px solid #4299e1;
    outline-offset: 2px;
}

.close-button:focus {
    outline: 3px solid #4299e1;
    outline-offset: 2px;
}