/* Meme Generator Styles */
:root {
    --primary-color: #4d90fe;
    --primary-dark: #3a7bd5;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 12px;
    --box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f8fafc;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" fill="white" opacity="0.1"><polygon points="1000,100 1000,0 0,100"/></svg>');
    background-size: cover;
    background-position: bottom;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    line-height: 1.6;
}

.hero-features {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.feature-item i {
    font-size: 1.2rem;
}

.hero-preview {
    position: relative;
    z-index: 2;
}

.hero-preview img {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    max-width: 100%;
    height: auto;
}

/* Generator Section */
.generator-section {
    padding: 60px 0;
    background: white;
}

/* Template Sidebar */
.template-sidebar {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.template-search .input-group {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.template-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.category-btn {
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    transition: var(--transition);
}

.category-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.custom-upload .btn {
    border-radius: var(--border-radius);
    font-weight: 500;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}

.template-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    position: relative;
}

.template-item:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.template-item.active {
    border-color: var(--success-color);
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25);
}

.template-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.template-item .template-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem;
    text-align: center;
    opacity: 0;
    transition: var(--transition);
}

.template-item:hover .template-name {
    opacity: 1;
}

/* Meme Editor */
.meme-editor {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.editor-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--dark-color);
}

.editor-actions {
    display: flex;
    gap: 0.5rem;
}

.canvas-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 1rem;
    min-height: 400px;
    border: 2px dashed #dee2e6;
}

#memeCanvas {
    max-width: 100%;
    max-height: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: crosshair;
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.size-presets {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.preset-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Text Editor Panel */
.text-editor-panel {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.panel-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.text-layers {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.5rem;
}

.text-layer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0.25rem;
}

.text-layer-item:hover {
    background-color: #f8f9fa;
}

.text-layer-item.active {
    background-color: var(--primary-color);
    color: white;
}

.text-layer-preview {
    font-size: 0.875rem;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-layer-actions {
    display: flex;
    gap: 0.25rem;
}

.text-layer-actions button {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.text-properties {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    background: #f8f9fa;
}

.text-properties h5 {
    margin-bottom: 1rem;
    color: var(--dark-color);
    font-weight: 600;
}

.form-range {
    margin-bottom: 0.5rem;
}

.align-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Download Section */
.download-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
    text-align: center;
}

.download-header h3 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.download-header p {
    color: var(--secondary-color);
    margin-bottom: 2rem;
}

.download-options {
    max-width: 600px;
    margin: 0 auto;
}

/* Features Section */
.features-section {
    padding: 80px 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.features-section h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.features-section .lead {
    font-size: 1.25rem;
    color: var(--secondary-color);
    margin-bottom: 3rem;
}

.feature-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    height: 100%;
}

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

.feature-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: white;
    font-size: 2rem;
}

.feature-card h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.feature-card p {
    color: var(--secondary-color);
    line-height: 1.6;
}

/* Templates Showcase */
.templates-showcase {
    padding: 80px 0;
    background: white;
}

.templates-showcase h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.templates-showcase .lead {
    font-size: 1.25rem;
    color: var(--secondary-color);
    margin-bottom: 3rem;
}

.template-showcase-item {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    cursor: pointer;
}

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

.template-showcase-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.template-showcase-item .template-info {
    padding: 1rem;
}

.template-showcase-item h5 {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.template-showcase-item p {
    color: var(--secondary-color);
    font-size: 0.875rem;
    margin: 0;
}

/* FAQ Section */
.faq-section {
    padding: 80px 0;
    background: #f8fafc;
}

.faq-section h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 3rem;
}

.accordion-item {
    border: none;
    margin-bottom: 1rem;
    border-radius: var(--border-radius) !important;
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.accordion-button {
    background: white;
    border: none;
    padding: 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1.1rem;
}

.accordion-button:not(.collapsed) {
    background: var(--primary-color);
    color: white;
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: none;
    border: none;
}

.accordion-body {
    padding: 1.5rem;
    background: white;
    color: var(--secondary-color);
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-features {
        flex-direction: column;
        gap: 1rem;
    }
    
    .template-sidebar {
        margin-bottom: 2rem;
        position: static;
    }
    
    .text-editor-panel {
        position: static;
        margin-top: 2rem;
    }
    
    .template-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .canvas-container {
        min-height: 300px;
    }
    
    #memeCanvas {
        max-height: 300px;
    }
    
    .download-options .row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .features-section h2,
    .templates-showcase h2,
    .faq-section h2 {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .hero-section {
        padding: 60px 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .template-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 0.5rem;
    }
    
    .feature-card,
    .template-sidebar,
    .meme-editor,
    .text-editor-panel,
    .download-section {
        padding: 1rem;
    }
    
    .feature-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}

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

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Custom Scrollbar */
.template-grid::-webkit-scrollbar,
.text-layers::-webkit-scrollbar {
    width: 6px;
}

.template-grid::-webkit-scrollbar-track,
.text-layers::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.template-grid::-webkit-scrollbar-thumb,
.text-layers::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.template-grid::-webkit-scrollbar-thumb:hover,
.text-layers::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Utility Classes */
.text-primary { color: var(--primary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }
.border-primary { border-color: var(--primary-color) !important; }

.cursor-pointer { cursor: pointer; }
.user-select-none { user-select: none; }
.position-relative { position: relative; }
.position-absolute { position: absolute; }

.shadow-sm { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important; }
.shadow { box-shadow: var(--box-shadow) !important; }
.shadow-lg { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important; }

.rounded { border-radius: var(--border-radius) !important; }
.rounded-sm { border-radius: 6px !important; }
.rounded-lg { border-radius: 16px !important; }
