/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Main content */
main {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

/* Meme container */
.meme-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.meme-canvas {
    position: relative;
    max-width: 100%;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.meme-actions {
    display: flex;
    justify-content: center;
    width: 100%;
}

.meme-actions .btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.meme-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.quick-controls {
    width: 100%;
    max-width: 500px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.quick-controls .text-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.quick-controls .input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-controls .input-group label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.quick-controls .input-group input[type="text"] {
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.quick-controls .input-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#memeImage {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
}

.text-overlay {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-weight: bold;
    text-align: center;
    color: white;
    text-shadow: 2px 2px 0px #000, -2px -2px 0px #000, 2px -2px 0px #000, -2px 2px 0px #000;
    font-size: 40px;
    max-width: 90%;
    word-wrap: break-word;
    line-height: 1.1;
    user-select: none;
    pointer-events: none;
}

.top-text {
    top: 20px;
}

.bottom-text {
    bottom: 20px;
}

/* Controls */
.controls {
    display: grid;
    gap: 25px;
}

.text-controls,
.image-controls,
.text-style-controls {
    display: grid;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.input-group input[type="text"],
.input-group input[type="file"] {
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

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

.style-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.style-group label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.style-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #dee2e6;
    outline: none;
    -webkit-appearance: none;
}

.style-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.style-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.style-group input[type="color"] {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.style-group span {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
    color: white;
}

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

.action-buttons {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* Footer */
footer {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.about h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.about p {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
        line-height: 1.2;
    }
    
    .subtitle {
        font-size: 0.9rem;
        line-height: 1.3;
    }
    
    main {
        padding: 15px;
    }
    
    .text-overlay {
        max-width: 95%;
    }
    
    .controls {
        gap: 15px;
    }
    
    .text-controls {
        padding: 12px;
    }
    
    .mobile-controls {
        display: grid;
        gap: 15px;
    }
    
    .image-controls,
    .text-style-controls {
        padding: 12px;
    }
    
    .input-group input[type="text"],
    .input-group input[type="file"] {
        padding: 10px;
        font-size: 0.9rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .quick-controls {
        padding: 15px;
        max-width: 100%;
    }
    
    .quick-controls .text-controls {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 15px;
    }
    
    .meme-actions .btn {
        padding: 12px 24px;
        font-size: 1rem;
        width: 100%;
        max-width: 250px;
    }
    
    .action-buttons {
        justify-content: center;
        margin-top: 15px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 1rem;
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    header h1 {
        font-size: 1.5rem;
        line-height: 1.1;
    }
    
    .subtitle {
        font-size: 0.8rem;
        line-height: 1.2;
    }
    
    main {
        padding: 12px;
    }
    
    .text-overlay {
        max-width: 98%;
    }
    
    .text-controls {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .mobile-controls {
        display: grid;
        gap: 10px;
    }
    
    .image-controls,
    .text-style-controls {
        padding: 10px;
    }
    
    .input-group input[type="text"],
    .input-group input[type="file"] {
        padding: 8px;
        font-size: 0.85rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .style-group {
        margin-bottom: 8px;
    }
    
    .style-group input[type="range"] {
        margin: 5px 0;
    }
    
    .style-group input[type="color"] {
        height: 35px;
    }
    
    .quick-controls {
        padding: 12px;
    }
    
    .quick-controls .text-controls {
        gap: 10px;
        margin-bottom: 12px;
    }
    
    .meme-actions .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        width: 100%;
        max-width: 200px;
    }
    
    .action-buttons {
        margin-top: 10px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
        width: 100%;
        max-width: 180px;
    }
    
    /* Ensure footer doesn't take up too much space on mobile */
    footer {
        padding: 20px;
    }
    
    .about h2 {
        font-size: 1.2rem;
    }
    
    .about p {
        font-size: 0.9rem;
        line-height: 1.4;
    }
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Animation for text updates */
.text-overlay {
    transition: all 0.3s ease;
}

/* Hidden class for toggling elements */
.hidden {
    display: none;
}

/* Success message */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    border: 1px solid #c3e6cb;
    text-align: center;
    font-weight: 600;
}
