* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.title {
    text-align: center;
    color: white;
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.main-content {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 30px;
    align-items: start;
}

@media (max-width: 1000px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.control-panel {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.control-group {
    margin-bottom: 20px;
}

.control-group:last-of-type {
    margin-bottom: 25px;
}

label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.file-input {
    width: 100%;
    padding: 12px;
    border: 2px dashed #ddd;
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-input:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.hint {
    font-size: 0.8rem;
    color: #999;
    margin-top: 5px;
}

.text-items-container {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.text-item {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.text-item.selected {
    border-color: #667eea;
    background: #f0f4ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.text-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.text-item-title {
    font-weight: 600;
    color: #667eea;
    font-size: 0.9rem;
}

.text-item-actions {
    display: flex;
    gap: 8px;
}

.text-item-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.text-item-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

.text-item-btn.delete {
    color: #dc3545;
}

.text-item-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.text-item-input:focus {
    outline: none;
    border-color: #667eea;
}

.style-controls {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
}

.control-row {
    margin-bottom: 15px;
}

.control-row:last-child {
    margin-bottom: 0;
}

.range-input {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    background: #e0e0e0;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 8px;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.range-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.color-input {
    width: 100%;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    padding: 3px;
}

.checkbox-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    vertical-align: middle;
    margin-right: 6px;
}

.checkbox-input + span {
    vertical-align: middle;
}

.btn {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(86, 171, 47, 0.4);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(86, 171, 47, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.preview-panel {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.canvas-container {
    position: relative;
    width: 100%;
    min-height: 500px;
    background: #f5f5f5;
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#memeCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: crosshair;
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

@media (max-width: 600px) {
    .title {
        font-size: 2rem;
    }

    .control-panel,
    .preview-panel {
        padding: 20px;
    }

    .btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .canvas-container {
        min-height: 400px;
    }
}
