/* Upload Area Styles */
.upload-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.upload-area {
    border: 3px dashed #ddd;
    border-radius: 20px;
    padding: 4rem 2rem;
    text-align: center;
    background: #f9f9f9;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color, #00D0FF);
    background: #f0f8ff;
}

.upload-area.drag-over {
    border-color: var(--primary-color, #00D0FF);
    background: #e6f7ff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    color: #ccc;
    margin-bottom: 1rem;
}

.upload-area h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.upload-area p {
    color: #666;
    margin-bottom: 1.5rem;
}

/* Memes List Styles */
.memes-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 100%;
    margin: 2rem 0;
    padding: 0;
}

.meme-list-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-align: center;
    border: none;
    margin: 0;
}

.meme-list-item:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    transform: translateX(8px);
}

.meme-number {
    display: none;
}

.meme-text {
    flex: 1;
    font-size: 1.2rem;
    line-height: 1.3;
    font-weight: 600;
    letter-spacing: 0.3px;
    max-width: 100%;
    padding: 0.2rem 1.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.meme-list-item:hover .meme-text {
    transform: scale(1.02);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.meme-arrow {
    display: none;
}

.meme-list-item:hover .meme-arrow {
    opacity: 1;
    transform: translateX(5px);
}

/* Editor Modal Styles */
.editor-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 2% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover,
.modal-close:focus {
    color: #000;
}

.modal-content h2 {
    text-align: center;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2rem;
}

.editor-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.canvas-wrapper {
    flex: 1;
    text-align: center;
}

#modalCanvas {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.editor-tools {
    flex: 0 0 350px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    max-height: 600px;
    overflow-y: auto;
}

.tool-section {
    margin-bottom: 20px;
}

.tool-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.tool-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.tool-row .tool-section {
    flex: 1;
}

#modalMemeText {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

#modalMemeText:focus {
    outline: none;
    border-color: #667eea;
}

select, input[type="range"], input[type="color"] {
    width: 100%;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
}

select:focus, input[type="range"]:focus {
    outline: none;
    border-color: #667eea;
}

input[type="color"] {
    height: 40px;
    padding: 4px;
}

input[type="range"] {
    padding: 0;
}

#fontSizeValue, #strokeWidthValue {
    display: inline-block;
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    color: #667eea;
    margin-left: 10px;
}

.style-buttons {
    display: flex;
    gap: 8px;
}

.style-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.style-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.style-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.style-btn.danger {
    color: #dc2626;
}

.style-btn.danger:hover {
    background: #fee2e2;
    border-color: #dc2626;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.action-buttons .btn {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

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

.action-buttons .btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.action-buttons .btn-secondary:hover {
    background: #d1d5db;
}

.action-buttons .btn-success {
    background: #10b981;
    color: white;
}

.action-buttons .btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
}

/* Responsividade do modal */
@media (max-width: 768px) {
    .editor-container {
        flex-direction: column;
    }
    
    .editor-tools {
        flex: 1;
        width: 100%;
        max-height: none;
    }
    
    #modalCanvas {
        max-width: 100%;
        height: auto;
    }
}

/* Preview Area */
.preview-area {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

#previewImage {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.meme-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Memes Grid */
.memes-grid {
    margin-top: 2rem;
}

.grid-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.memes-container {
    max-width: 100%;
    padding: 0 1rem;
}

.meme-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.meme-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.meme-preview {
    position: relative;
    width: 100%;
    height: 300px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.meme-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.meme-text-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 90%;
    color: white;
    font-family: 'Kanit', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    text-transform: uppercase;
    line-height: 1.3;
}

.meme-actions {
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.meme-actions button {
    flex: 1;
    padding: 0.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.select-btn {
    background: var(--primary-color, #00D0FF);
    color: white;
}

.select-btn:hover {
    background: #0099cc;
}

.share-btn {
    background: #f0f0f0;
    color: #333;
}

.share-btn:hover {
    background: #e0e0e0;
}

/* Loading State */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color, #00D0FF);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

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

/* Responsive */
@media (max-width: 768px) {
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .memes-container {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .meme-preview {
        height: 250px;
    }
}

/* Stats for memes */
.meme-stats {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding: 0.5rem;
    background: #f9f9f9;
    color: #666;
    font-size: 0.9rem;
}

.meme-stats span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}