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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ff7e5f, #ffffff, #4a90e2);
    background-size: 400% 400%;
    animation: gradientFlow 5s ease infinite; /* Changed from 15s to 8s for faster animation */
    color: #333;
    line-height: 1.6;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(to right, #4a90e2, #8e44ad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 10px;
    text-shadow: 0px 2px 3px rgba(0,0,0,0.1);
}

header p {
    font-size: 1.1rem;
    color: #666;
}

/* Main Content Styles */
main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Input Section */
.input-section {
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #4a90e2;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.input-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

input[type="text"], select.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input[type="text"]:focus, select.form-control:focus {
    border-color: #4a90e2;
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

button {
    background: linear-gradient(to right, #4a90e2, #5e72e4);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

button:hover {
    background: linear-gradient(to right, #3a7bc8, #4a65d5);
    transform: translateY(-2px);
    box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}

button:active {
    transform: translateY(1px);
}

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

/* Output Section */
.output-section {
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 4px solid #8e44ad;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.output-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

/* Grid Container for Images */
.grid-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(3, 1fr);
        max-width: 100%;
    }
}

/* Image Wrapper */
.image-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0,0,0,0.05);
}

.image-wrapper:hover {
    transform: translateY(-5px);
}

.meme-img {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 250px;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px 8px 0 0;
    display: block;
    margin: 0 auto;
    flex: 1;
}

/* For larger screens, we can make the image even wider */
@media (min-width: 768px) {
    .meme-img {
        width: 100%;
        height: auto;
    }
    
    .image-wrapper {
        width: 100%;
    }
    
    .grid-container {
        grid-template-columns: 1fr; /* Changed from repeat(3, 1fr) to show one larger image */
    }
    
    #meme-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 100%;
    }
}

/* Meme Text Info */
.meme-text-info {
    padding: 10px;
    background-color: #f0f8ff;
    font-size: 0.9rem;
    color: #555;
    border-top: 1px solid #eee;
    line-height: 1.4;
}

/* Image Actions */
.image-actions {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background-color: #f8f8f8;
}

.image-action-btn {
    padding: 8px 12px;
    font-size: 0.9rem;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.image-action-btn:hover {
    background-color: #3a7bc8;
}

#download-btn {
    background: linear-gradient(to right, #28a745, #20c997);
}

#download-btn:hover {
    background-color: #218838;
}

#share-btn {
    background: linear-gradient(to right, #6c757d, #5a6268);
}

#share-btn:hover {
    background-color: #5a6268;
}

#error-message {
    color: #dc3545;
    text-align: center;
    font-weight: 600;
    padding: 15px;
    background-color: white;
}

/* Hidden Class */
.hidden {
    display: none;
}

/* Footer Styles */
footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    color: #666;
    background: linear-gradient(to right, rgba(255,255,255,0.7), rgba(255,255,255,0.3), rgba(255,255,255,0.7));
    padding: 15px 0;
    border-radius: 0 0 10px 10px;
}

/* Responsive Styles */
@media (min-width: 768px) {
    main {
        flex-direction: row;
        align-items: stretch;
        min-height: 500px;
        gap: 20px;
    }
    
    .input-section, .output-section {
        flex: 1 1 50%;
        display: flex;
        flex-direction: column;
        min-height: 500px;
        max-width: 50%;
    }
    
    #loading, #error-message, #meme-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
}

@media (max-width: 767px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .input-section, .output-section {
        padding: 20px;
    }
}

/* Features Section Styles */
.features-section {
    padding: 4rem 2rem;
    background-color: #f8f9fa;
    text-align: center;
}

.features-section h2 {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: #333;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-card i {
    font-size: 2.5rem;
    color: #4a90e2;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.feature-card p {
    color: #666;
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .features-section {
        padding: 2rem 1rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .feature-card {
        padding: 1.5rem;
    }
}